/* ============================================
   mores.quest — Illuminated Grimoire Styles
   ============================================ */

/* --- Design Color Reference ---
   Parchment: #E8D8B0
   Gold Leaf: #C8A030
   Ink Dark: #2A1808
   Royal Blue: #1A3080
   Royal Red: #A01020
   Forest Green: #1A5030
   Aged Cream: #D8C8A0
*/

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 18px);
    line-height: 1.8;
    color: #2A1808;
    background-color: #E8D8B0;
    overflow-x: hidden;
    position: relative;
}

/* --- Parchment Texture Overlay --- */
#parchment-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.06;
}

/* --- Scroll Top Curl --- */
#scroll-top-curl {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 100;
    pointer-events: none;
}

#scroll-top-curl svg {
    width: 100%;
    height: 100%;
}

/* --- Marginalia Decorations --- */
.marginalia {
    position: fixed;
    top: 0;
    height: 100vh;
    width: 40px;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.marginalia.visible {
    opacity: 1;
}

.marginalia svg {
    width: 100%;
    height: 100%;
}

.marginalia-left {
    left: clamp(5px, 2vw, 30px);
}

.marginalia-right {
    right: clamp(5px, 2vw, 30px);
}

/* --- Hero / Opening Viewport --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background-color: #E8D8B0;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(20px, 4vw, 60px);
}

.hero-shield {
    width: clamp(60px, 8vw, 120px);
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-shield.visible {
    opacity: 1;
}

.hero-shield-left {
    transform: translateX(-30px);
}

.hero-shield-left.visible {
    transform: translateX(0);
}

.hero-shield-right {
    transform: translateX(30px);
}

.hero-shield-right.visible {
    transform: translateX(0);
}

.hero-shield svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(2px 4px 6px rgba(42, 24, 8, 0.3));
}

.hero-text {
    text-align: center;
}

/* --- Logotype --- */
.logotype {
    font-family: 'Cinzel Decorative', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 52px);
    color: #C8A030;
    letter-spacing: 0.05em;
    text-shadow:
        0 0 10px rgba(200, 160, 48, 0.3),
        0 0 20px rgba(200, 160, 48, 0.15),
        2px 2px 4px rgba(42, 24, 8, 0.2);
    animation: goldShimmer 1.5s ease-in-out;
}

@keyframes goldShimmer {
    0% {
        text-shadow:
            0 0 5px rgba(200, 160, 48, 0.1),
            2px 2px 4px rgba(42, 24, 8, 0.2);
        opacity: 0.5;
    }
    50% {
        text-shadow:
            0 0 25px rgba(200, 160, 48, 0.6),
            0 0 50px rgba(200, 160, 48, 0.3),
            2px 2px 4px rgba(42, 24, 8, 0.3);
        opacity: 1;
    }
    100% {
        text-shadow:
            0 0 10px rgba(200, 160, 48, 0.3),
            0 0 20px rgba(200, 160, 48, 0.15),
            2px 2px 4px rgba(42, 24, 8, 0.2);
        opacity: 1;
    }
}

.tagline {
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: clamp(14px, 1.5vw, 20px);
    color: #2A1808;
    margin-top: 12px;
    opacity: 0.8;
    letter-spacing: 0.02em;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: bobDown 2s ease-in-out infinite;
    opacity: 0.7;
}

.scroll-indicator svg {
    width: 30px;
    height: 40px;
}

.scroll-indicator span {
    font-family: 'Cinzel Decorative', 'Georgia', serif;
    font-size: 11px;
    color: #C8A030;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* --- Main Content Scroll --- */
#scroll-content {
    position: relative;
    z-index: 10;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 clamp(32px, 5vw, 60px);
    padding-bottom: 80px;
}

/* --- Chapter Shield Markers --- */
.chapter-shield {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.chapter-shield[data-direction="left"] {
    transform: translateX(-60px);
}

.chapter-shield[data-direction="right"] {
    transform: translateX(60px);
}

.chapter-shield.visible {
    opacity: 1;
    transform: translateX(0);
}

.chapter-shield svg {
    width: clamp(50px, 7vw, 90px);
    height: auto;
    filter: drop-shadow(2px 3px 5px rgba(42, 24, 8, 0.25));
}

.chapter-label {
    font-family: 'Cinzel Decorative', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(12px, 1.2vw, 16px);
    color: #C8A030;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 12px;
}

/* --- Heraldic Accent Colors (used in inline SVGs and highlights) --- */
.chapter-shield[data-direction="left"] .chapter-label {
    color: #1A3080;
}

.chapter-shield[data-direction="right"] .chapter-label {
    color: #A01020;
}

/* --- Quest Sections --- */
.quest-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.8s ease-out;
    box-shadow: 0 4px 8px rgba(42, 24, 8, 0.2);
    margin-bottom: 0;
    position: relative;
}

.quest-section.visible {
    box-shadow: none;
}

.section-content {
    padding: 20px 0 40px 0;
}

.section-content p {
    margin-bottom: 1.4em;
    text-align: justify;
    hyphens: auto;
}

.section-content p:last-child {
    margin-bottom: 0;
}

.section-content em {
    font-style: italic;
    color: #1A5030;
}

/* --- Illuminated Initial Letters --- */
.illuminated-initial {
    float: left;
    font-family: 'Cinzel Decorative', 'Georgia', serif;
    font-size: clamp(48px, 6vw, 80px);
    font-weight: 700;
    line-height: 1;
    margin: 0 12px 0 0;
    color: #C8A030;
    border: 2px solid #C8A030;
    padding: 4px 8px;
    background: #2A1808;
    text-shadow: 0 0 8px rgba(200, 160, 48, 0.4);
    position: relative;
}

.illuminated-initial::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid rgba(200, 160, 48, 0.3);
    pointer-events: none;
}

.illuminated-initial::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border: 1px solid rgba(200, 160, 48, 0.15);
    pointer-events: none;
}

/* --- Gold Divider Between Sections --- */
.quest-section + .chapter-shield::before {
    content: '';
    display: block;
    width: 60%;
    max-width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #C8A030, transparent);
    margin: 0 auto 20px auto;
}

/* --- Footer / Colophon --- */
#colophon {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(to bottom, #E8D8B0, #D8C8A0);
}

.footer-ornament {
    margin-bottom: 20px;
}

.footer-ornament svg {
    width: clamp(120px, 20vw, 200px);
    height: auto;
}

.footer-text {
    font-family: 'Cinzel Decorative', 'Georgia', serif;
    font-size: clamp(14px, 1.5vw, 18px);
    font-weight: 700;
    color: #C8A030;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.footer-motto {
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: clamp(12px, 1vw, 15px);
    color: #2A1808;
    opacity: 0.6;
    letter-spacing: 0.03em;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .marginalia {
        display: none;
    }

    .hero-content {
        flex-direction: column;
        gap: 20px;
    }

    .hero-shield {
        width: 60px;
    }

    .hero-content {
        flex-direction: row;
    }

    #scroll-content {
        padding: 0 clamp(20px, 4vw, 40px);
    }

    .chapter-shield svg {
        width: 60px;
    }
}

@media (max-width: 480px) {
    .hero-shield {
        width: 45px;
    }

    .hero-content {
        gap: 15px;
    }

    .scroll-indicator {
        bottom: 25px;
    }

    .chapter-shield {
        padding: 30px 0;
    }
}

/* --- Selection Styling --- */
::selection {
    background: rgba(200, 160, 48, 0.3);
    color: #2A1808;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #D8C8A0;
}

::-webkit-scrollbar-thumb {
    background: #C8A030;
    border-radius: 5px;
    border: 2px solid #D8C8A0;
}

::-webkit-scrollbar-thumb:hover {
    background: #A08020;
}
