/* ============================================
   mores.quest -- Illuminated Manuscript Styles
   Palette: Parchment Gold (medieval scroll)
   ============================================ */

:root {
    --parchment: #E8D8B0;       /* primary background */
    --aged-cream: #D8C8A0;      /* darker parchment */
    --gold-leaf: #C8A030;       /* illuminated accent */
    --ink-dark: #2A1808;        /* primary text */
    --royal-blue: #1A3080;      /* heraldic */
    --royal-red: #A01020;       /* heraldic */
    --forest-green: #1A5030;    /* heraldic */
}

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

html {
    scroll-behavior: smooth;
}

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

/* Parchment texture overlay - fixed, full screen */
.parchment-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
}

/* Scroll-top curl */
.scroll-top-curl {
    position: relative;
    width: 100vw;
    height: 60px;
    z-index: 3;
    background: #E8D8B0;
    border-bottom: 1px solid #D8C8A0;
}

.scroll-top-curl svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(42, 24, 8, 0.25));
}

/* ============================================
   HERO / Opening Viewport
   ============================================ */
.hero {
    min-height: calc(100vh - 60px);
    width: 100vw;
    background: #E8D8B0;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px clamp(20px, 5vw, 80px);
}

.hero-inner {
    max-width: 1100px;
    width: 100%;
    text-align: center;
    position: relative;
    display: grid;
    grid-template-columns: 130px 1fr 130px;
    grid-template-rows: auto auto auto auto;
    gap: 24px clamp(20px, 4vw, 60px);
    align-items: center;
}

.hero-shield {
    width: 130px;
    height: 170px;
    opacity: 0;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    grid-row: 1;
}

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

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

.hero-shield.shield-revealed {
    opacity: 1;
    transform: translateX(0);
}

.hero-shield svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 6px 12px rgba(42, 24, 8, 0.35));
}

.logotype {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-weight: 900;
    font-size: clamp(36px, 7vw, 88px);
    letter-spacing: 0.04em;
    color: #2A1808;
    line-height: 1.05;
    grid-column: 2;
    grid-row: 1;
    text-shadow:
        0 0 1px #C8A030,
        0 2px 0 #C8A030,
        0 3px 6px rgba(168, 130, 30, 0.5),
        2px 4px 0 rgba(42, 24, 8, 0.15);
    animation: gold-shimmer 3s ease-in-out infinite;
}

@keyframes gold-shimmer {
    0%, 100% {
        text-shadow:
            0 0 1px #C8A030,
            0 2px 0 #C8A030,
            0 3px 6px rgba(168, 130, 30, 0.5),
            2px 4px 0 rgba(42, 24, 8, 0.15);
    }
    50% {
        text-shadow:
            0 0 4px #C8A030,
            0 2px 0 #C8A030,
            0 0 14px rgba(200, 160, 48, 0.85),
            2px 4px 0 rgba(42, 24, 8, 0.15);
    }
}

.hero-tagline {
    grid-column: 1 / -1;
    grid-row: 2;
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: clamp(16px, 1.6vw, 22px);
    color: #2A1808;
    max-width: 720px;
    margin: 0 auto;
    line-height: 1.6;
    opacity: 0;
    animation: fade-in-up 1s ease-out 0.6s forwards;
}

.hero-banner {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 32px;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    animation: fade-in-up 1s ease-out 1s forwards;
}

.hero-banner svg {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(42, 24, 8, 0.4));
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-indicator {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    animation: fade-in-up 1s ease-out 1.4s forwards;
}

.scroll-indicator span {
    font-family: 'Cinzel Decorative', serif;
    font-size: 12px;
    letter-spacing: 0.4em;
    color: #2A1808;
    font-weight: 700;
}

.scroll-indicator svg {
    width: 24px;
    height: 32px;
    animation: bob 2s ease-in-out infinite;
}

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

/* ============================================
   MANUSCRIPT - main scroll body
   ============================================ */
.manuscript {
    width: 100vw;
    background: #E8D8B0;
    position: relative;
    z-index: 2;
    padding: 80px 0 0;
}

/* Marginalia (vine decorations along margins) */
.marginalia {
    position: absolute;
    top: 0;
    width: 60px;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.marginalia-left {
    left: clamp(8px, 4vw, 60px);
}

.marginalia-right {
    right: clamp(8px, 4vw, 60px);
}

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

@media (max-width: 720px) {
    .marginalia {
        opacity: 0.5;
        width: 30px;
    }
    .marginalia-left { left: 4px; }
    .marginalia-right { right: 4px; }
}

/* Scroll-layout column */
.scroll-column {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 clamp(32px, 5vw, 60px);
    position: relative;
    z-index: 3;
}

/* Each chapter section unfurls on reveal */
.manuscript-section {
    margin-bottom: 80px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition:
        max-height 0.9s ease-out,
        opacity 0.7s ease-out;
    position: relative;
}

.manuscript-section.unfurled {
    max-height: var(--unfurl-height, 5000px);
    opacity: 1;
    /* Paper-curl shadow at the leading edge */
    box-shadow: 0 4px 8px rgba(42, 24, 8, 0.0);
}

.manuscript-section.unfurled::before {
    content: "";
    display: block;
    height: 4px;
    width: 100%;
    box-shadow: 0 4px 8px rgba(42, 24, 8, 0.2);
    pointer-events: none;
    margin-bottom: -4px;
}

/* Heraldic chapter marker */
.chapter-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 0 0 32px;
    transform: translateX(-80px);
    opacity: 0;
    transition: transform 0.7s ease-out 0.3s, opacity 0.7s ease-out 0.3s;
}

.manuscript-section.unfurled .chapter-marker {
    transform: translateX(0);
    opacity: 1;
}

/* Alternate sides for visual rhythm */
.manuscript-section[data-chapter="II"] .chapter-marker,
.manuscript-section[data-chapter="IV"] .chapter-marker {
    transform: translateX(80px);
}

.manuscript-section[data-chapter="II"].unfurled .chapter-marker,
.manuscript-section[data-chapter="IV"].unfurled .chapter-marker {
    transform: translateX(0);
}

.chapter-marker svg {
    width: 80px;
    height: 100px;
    filter: drop-shadow(0 4px 6px rgba(42, 24, 8, 0.3));
}

.chapter-numeral {
    font-family: 'Cinzel Decorative', serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.35em;
    color: #C8A030;
    text-transform: uppercase;
    text-shadow: 0 1px 0 #2A1808;
}

/* Section title */
.section-title {
    font-family: 'Cinzel Decorative', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 52px);
    color: #2A1808;
    text-align: center;
    line-height: 1.2;
    margin-bottom: 32px;
    padding: 0 0 16px;
    border-bottom: 2px solid #C8A030;
    position: relative;
}

.section-title::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 12px;
    height: 12px;
    transform: translateX(-50%) rotate(45deg);
    background: #C8A030;
    border: 2px solid #2A1808;
}

/* Body paragraphs */
.section-body {
    font-family: 'EB Garamond', serif;
    font-size: clamp(15px, 1.1vw, 18px);
    line-height: 1.8;
    color: #2A1808;
    text-align: justify;
    margin-bottom: 24px;
    text-indent: 0;
}

.section-body + .section-body {
    text-indent: 2em;
}

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

.illuminated-initial::before,
.illuminated-initial::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1.5px solid #C8A030;
    background: #2A1808;
}

.illuminated-initial::before {
    top: -5px;
    left: -5px;
    border-right: none;
    border-bottom: none;
}

.illuminated-initial::after {
    bottom: -5px;
    right: -5px;
    border-left: none;
    border-top: none;
}

/* End of manuscript seal */
.manuscript-end {
    text-align: center;
    padding: 80px 0 100px;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.manuscript-end.unfurled {
    opacity: 1;
}

.manuscript-end svg {
    width: 180px;
    height: 180px;
    filter: drop-shadow(0 6px 12px rgba(42, 24, 8, 0.4));
    animation: seal-rotate 30s linear infinite;
}

@keyframes seal-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.end-mark {
    margin-top: 24px;
    font-family: 'Cinzel Decorative', serif;
    font-size: 16px;
    letter-spacing: 0.3em;
    color: #C8A030;
    text-shadow: 0 1px 0 #2A1808;
}

/* Scroll-bottom curl */
.scroll-bottom-curl {
    width: 100vw;
    height: 60px;
    background: #E8D8B0;
    position: relative;
    z-index: 3;
}

.scroll-bottom-curl svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 -4px 6px rgba(42, 24, 8, 0.25));
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 720px) {
    .hero-inner {
        grid-template-columns: 80px 1fr 80px;
        gap: 16px clamp(8px, 3vw, 24px);
    }
    .hero-shield {
        width: 80px;
        height: 105px;
    }
    .hero-tagline {
        font-size: 16px;
    }
    .scroll-column {
        padding: 0 clamp(40px, 8vw, 60px);
    }
    .chapter-marker svg {
        width: 64px;
        height: 80px;
    }
    .illuminated-initial {
        font-size: 48px;
        padding: 4px 8px;
        margin: 2px 10px 0 0;
    }
}

@media (max-width: 480px) {
    .hero-inner {
        grid-template-columns: 1fr;
    }
    .hero-shield {
        display: none;
    }
    .hero-shield.hero-shield-left {
        display: block;
        margin: 0 auto;
        width: 80px;
        height: 105px;
        grid-column: 1;
    }
    .logotype {
        grid-column: 1;
        grid-row: 2;
    }
    .hero-shield-right {
        display: none;
    }
}

/* ============================================
   Heraldic accent classes (used for SVG color
   parity and selection highlights)
   ============================================ */
.heraldic-blue { color: #1A3080; fill: #1A3080; }
.heraldic-red { color: #A01020; fill: #A01020; }
.heraldic-green { color: #1A5030; fill: #1A5030; }

::selection {
    background: #A01020;
    color: #E8D8B0;
}
::-moz-selection {
    background: #A01020;
    color: #E8D8B0;
}

/* Chapter-specific accent strokes echoing each shield's color */
.manuscript-section[data-chapter="I"] .section-title { border-bottom-color: #A01020; }
.manuscript-section[data-chapter="II"] .section-title { border-bottom-color: #1A3080; }
.manuscript-section[data-chapter="III"] .section-title { border-bottom-color: #1A5030; }
.manuscript-section[data-chapter="IV"] .section-title { border-bottom-color: #C8A030; }
.manuscript-section[data-chapter="V"] .section-title { border-bottom-color: #2A1808; }
