/******
    _              _                                _ 
   | |            | |                              | |
 __| |___ ___  ___| |__  __ _ ___   ___   ___   ___| |__   ___  _ __
|__   __ / _ \/ __|  _ \|  _ ‘ _ \ / _ \ / _ \ / __|  _ \ / _ \/  __\
   | |_ |  __/ (__| | | | | | | | | (_) | (_) | (__| | | |  __/| |
   \_ _ /\___/\___|_| |_|_| |_| |_|\___/ \___/ \___|_| |_|\___/|_|

******/

/*** ### General Configuration ### ***/
:root {
    --background-color: #F5F1E8;
    --text-color: #403028;
    --wood-color: #8B4513;
    --wood-highlight: #A0522D;
    --wood-shadow: #5C2E0E;
    --rosary-line-color: #403028;
    --modal-bg: #ffffff;
    --timeline-color: #C1A78A;
    --timeline-active-color: var(--wood-shadow);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Be Vietnam Pro', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
}

/*** ### Main Container for the Rosary App ### ***/
#rosary-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
}

/*** ### Screen Styles ### ***/
.screen {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    scroll-snap-align: start;
    text-align: center;
    position: relative;
}

.content {
    max-width: 960px;
    width: 100%;
    animation: fadeIn 1s ease-in-out;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none; 
}
.content::-webkit-scrollbar { 
    display: none;
}


@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--wood-shadow);
}

h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--wood-shadow);
}

p {
    line-height: 1.6;
    font-size: 1.1rem;
}

.mystery-intro {
    margin: 1.5rem 0;
    color: var(--wood-shadow);
    font-size: 1.15rem;
    font-weight: 500;
}

.quote {
    font-style: italic;
    margin: 1.5rem 0;
    color: #6b4f40;
}

.scroll-down-prompt {
    margin-top: 10rem;
    font-size: 0.9rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/*** ### Rosary Components ### ***/
.rosary-parts {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8rem; 
    width: 100%;
    position: relative;
}

.rosary-item-container {
    display: flex;
    align-items: center; 
    width: 100%;
    max-width: 800px;
    gap: 3rem; 
    margin: 0 auto;
    position: relative;
}

.rosary-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 120px; 
    position: relative;
}

.rosary-text {
    flex-grow: 1;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/*** ### Beads and Cross ### ***/
.rosary-part {
    z-index: 2; 
    flex-shrink: 0; 
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease-out;
}

.rosary-part:hover {
    transform: scale(1.1);
}

.bead {
    background: radial-gradient(circle at 30% 30%, var(--wood-highlight), var(--wood-color));
    box-shadow: 
        inset 0 -3px 5px rgba(0,0,0,0.3), 
        0 5px 10px rgba(0,0,0,0.4);
}

.bead.large {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.bead.small {
    width: 30px; 
    height: 30px;
    border-radius: 50%;
}

.cross {
    width: 25px; 
    height: 90px; 
    background: var(--wood-color);
    position: relative;
    border-radius: 3px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.4);
}

.cross::before {
    content: '';
    position: absolute;
    top: 30px; 
    left: -20px; 
    width: 65px; 
    height: 25px; 
    background: var(--wood-color);
    border-radius: 3px;
}

.bead-group-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px; 
    position: relative;
}

.bead-group-horizontal {
    display: flex;
    justify-content: flex-start;
    gap: 4px;
    margin-bottom: 1rem;
    position: relative;
}

.bead-group-horizontal::before {
    content: '';
    position: absolute;
    left: 15px;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    height: 2px;
    background-color: var(--rosary-line-color);
    z-index: 1;
}

.interactive-prayer {
    text-decoration: underline;
    text-decoration-style: dotted;
    cursor: pointer;
    font-weight: 600;
}

/*** ### Timeline Navigation ### ***/
#timeline {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

#timeline ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#timeline li {
    width: 15px;
    height: 15px;
    margin: 12px 0;
    background-color: var(--timeline-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

#timeline li span {
    position: absolute;
    right: 150%;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    font-size: 1rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#timeline li:hover {
    background-color: var(--timeline-active-color);
    transform: scale(1.2);
}
#timeline li:hover span {
    opacity: 1;
    visibility: visible;
}

#timeline li.active {
    background-color: var(--timeline-active-color);
    transform: scale(1.4);
    border: 3px solid var(--background-color);
    outline: 2px solid var(--timeline-active-color);
}
#timeline li.active span {
    opacity: 1;
    visibility: visible;
    font-weight: 600;
    font-size: 1.1rem;
}

#timeline ul::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--timeline-color);
    z-index: -1;
}

/*** ### Prayers Modal Styles ### ***/
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#modal-overlay:not(.hidden) {
    opacity: 1;
}

#modal-box {
    background-color: var(--modal-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#modal-overlay:not(.hidden) #modal-box {
    transform: scale(1);
}

#modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

#modal-close-btn:hover {
    color: #333;
}

#modal-title {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: var(--wood-shadow);
    text-align: center;
}

#modal-content {
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: left;
}
#modal-content p {
    white-space: pre-wrap;
}

#modal-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto 0;
    border-radius: 4px;
}

.hidden {
    display: none !important;
}


/*** ### Responsive for smaller screens ### ***/
@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    p { font-size: 1rem; }
    .rosary-parts { gap: 1.5rem; }
    .rosary-item-container { gap: 2rem; }

    .rosary-item-container {
        flex-direction: column; 
        align-items: center;
        text-align: center;
        gap: 1rem; 
    }
    .rosary-visual {
        width: auto; 
    }
    .rosary-text {
        text-align: center;
        width: 100%;
    }
    
    .bead-group-horizontal {
        justify-content: center;
    }

    .bead.small {
        width: 22px;
        height: 22px;
    }
    .bead-group-horizontal::before {
        left: 11px;
        right: 11px;
    }

    #timeline {
        display: none;
    }
}

@media (max-width: 400px) {
    .bead.small {
        width: 18px;
        height: 18px;
    }
    .bead-group-horizontal {
        gap: 2px;
    }
    .bead-group-horizontal::before {
        left: 9px;
        right: 9px;
    }
}