/* ============================================================
   lov.st — Stylesheet
   Palette: Deep Manuscript (#1C1A2E), Illuminated Blue (#3B5A8A),
   Aquarelle Sky (#7BA7C9), Vellum Blue (#B8D4E8),
   Antique Vellum (#F4F0E8), Faded Ink (#8A7A5A),
   Pressed Violet (#4A3060), Pressed Leaf (#C8DFC0)
   ============================================================ */

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

:root {
    --deep-manuscript: #1C1A2E;
    --illuminated-blue: #3B5A8A;
    --aquarelle-sky: #7BA7C9;
    --vellum-blue: #B8D4E8;
    --antique-vellum: #F4F0E8;
    --faded-ink: #8A7A5A;
    --pressed-violet: #4A3060;
    --pressed-leaf: #C8DFC0;
    --shadow-manuscript: #2E2A3A;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-smallcaps: 'Cormorant SC', 'Cormorant Garamond', serif;
    --font-marginalia: 'IM Fell English', Georgia, serif;
    --font-ui: 'Inter', system-ui, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-display);
    background-color: var(--antique-vellum);
    color: var(--deep-manuscript);
    overflow-x: hidden;
    position: relative;
}

/* ============================================================
   Book Spine Navigation
   ============================================================ */
#book-spine {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 32px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, rgba(59,90,138,0.12), transparent);
    border-right: 1px solid rgba(59,90,138,0.18);
}

.spine-label {
    font-family: var(--font-ui);
    font-size: 9px;
    font-weight: 300;
    letter-spacing: 0.22em;
    color: var(--illuminated-blue);
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    opacity: 0.75;
}

/* ============================================================
   Folio Base Styles
   ============================================================ */
.folio {
    position: relative;
    overflow: hidden;
    padding-left: 56px; /* account for spine */
}

/* ============================================================
   Folio I — The Inscription
   ============================================================ */
#folio-i {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background-color: var(--antique-vellum);
}

/* Watercolor wash layers */
.wash-layer {
    position: absolute;
    pointer-events: none;
    will-change: transform;
}

.wash-deep {
    width: 80vw;
    height: 80vw;
    max-width: 900px;
    max-height: 900px;
    top: -20%;
    right: -15%;
    border-radius: 60% 40% 55% 45% / 40% 55% 45% 60%;
    background: radial-gradient(ellipse at 40% 40%, rgba(59,90,138,0.35) 0%, rgba(123,167,201,0.22) 45%, transparent 75%);
    mix-blend-mode: multiply;
}

.wash-mid {
    width: 55vw;
    height: 55vw;
    max-width: 650px;
    max-height: 650px;
    top: 10%;
    right: 5%;
    border-radius: 45% 55% 40% 60% / 55% 40% 60% 45%;
    background: radial-gradient(ellipse at 60% 35%, rgba(184,212,232,0.5) 0%, rgba(123,167,201,0.28) 50%, transparent 80%);
    mix-blend-mode: multiply;
}

.wash-green {
    background: radial-gradient(ellipse at 40% 50%, rgba(59,90,138,0.28) 0%, rgba(200,223,192,0.25) 50%, transparent 80%);
    top: -10%;
    right: -10%;
}

.wash-green-mid {
    background: radial-gradient(ellipse at 55% 40%, rgba(200,223,192,0.4) 0%, rgba(184,212,232,0.25) 55%, transparent 85%);
    top: 20%;
    right: 8%;
}

.wash-iris {
    background: radial-gradient(ellipse at 45% 45%, rgba(74,48,96,0.3) 0%, rgba(59,90,138,0.35) 45%, transparent 80%);
    top: -15%;
    right: -10%;
    width: 90vw;
    height: 90vw;
}

.wash-iris-mid {
    background: radial-gradient(ellipse at 60% 50%, rgba(123,167,201,0.45) 0%, rgba(74,48,96,0.2) 55%, transparent 85%);
    top: 15%;
    right: 3%;
}

.wash-manuscript {
    background: radial-gradient(ellipse at 35% 40%, rgba(28,26,46,0.22) 0%, rgba(59,90,138,0.32) 50%, transparent 80%);
    top: -5%;
    right: -15%;
    width: 85vw;
    height: 85vw;
}

.wash-colophon {
    background: radial-gradient(ellipse at 50% 50%, rgba(74,48,96,0.2) 0%, rgba(59,90,138,0.15) 50%, transparent 80%);
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 0;
}

/* Manuscript layout grid */
.manuscript-layout {
    display: grid;
    grid-template-columns: 58fr 42fr;
    column-gap: 3rem;
    width: 100%;
    max-width: 1400px;
    padding: 8rem 4rem 8rem 3rem;
    position: relative;
    z-index: 2;
}

.annotation-margin {
    padding-top: 4rem;
}

/* Inscription Header */
.inscription-header {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.folio-marker {
    font-family: var(--font-smallcaps);
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    color: var(--faded-ink);
    text-transform: uppercase;
}

.domain-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(5rem, 10vw, 9rem);
    line-height: 0.9;
    color: var(--deep-manuscript);
    letter-spacing: -0.01em;
}

.latin-epigraph {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--illuminated-blue);
    line-height: 1.6;
    margin-top: 0.5rem;
}

.epigraph-attribution {
    font-family: var(--font-smallcaps);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: var(--faded-ink);
    margin-top: -0.5rem;
}

.domain-subtitle {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 300;
    color: var(--deep-manuscript);
    line-height: 1.7;
    max-width: 480px;
    margin-top: 1rem;
    border-left: 1.5px solid rgba(59,90,138,0.3);
    padding-left: 1rem;
}

/* Botanical elements in margins */
.botanical-pressed {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.botanical-svg {
    opacity: 0.85;
}

.viola-svg {
    width: 80px;
    height: 110px;
}

.rosemary-svg {
    width: 50px;
    height: 160px;
}

.fern-svg {
    width: 80px;
    height: 110px;
}

.annotation-note {
    background: rgba(184,212,232,0.12);
    border-left: 1px solid rgba(59,90,138,0.25);
    padding: 1rem 1.2rem;
    margin-top: 1rem;
}

.marginalia-text {
    font-family: var(--font-marginalia);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--faded-ink);
    line-height: 1.65;
}

/* ============================================================
   Folio II — The Catalogue
   ============================================================ */
#folio-ii {
    min-height: 150vh;
    padding: 6rem 4rem 6rem 56px;
    background-color: var(--antique-vellum);
    position: relative;
}

.folio-header-row {
    position: relative;
    z-index: 2;
    margin-bottom: 3rem;
    padding-left: 3rem;
}

.folio-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: var(--deep-manuscript);
    letter-spacing: 0.02em;
}

/* Section bloom animation */
.section-bloom {
    position: absolute;
    width: 60vw;
    height: 60vw;
    max-width: 700px;
    max-height: 700px;
    left: 5%;
    top: 10%;
    border-radius: 60% 40% 55% 45% / 40% 55% 45% 60%;
    background: radial-gradient(ellipse at 50% 50%, rgba(200,223,192,0.35) 0%, rgba(184,212,232,0.2) 55%, transparent 80%);
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 1.4s ease-out, transform 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    mix-blend-mode: multiply;
    z-index: 1;
}

.section-bloom.bloomed {
    opacity: 1;
    transform: scale(1);
}

/* Catalogue Grid */
.catalogue-grid {
    display: grid;
    grid-template-columns: 58fr 42fr;
    column-gap: 2.5rem;
    row-gap: 2.5rem;
    position: relative;
    z-index: 2;
    padding: 0 3rem;
    max-width: 1300px;
}

.catalogue-card {
    background: rgba(244,240,232,0.85);
    border: 1px solid rgba(59,90,138,0.2);
    padding: 1.8rem 1.8rem 1.4rem;
    transform: rotate(calc((var(--card-index, 0) * 0.7deg) - 1.5deg));
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    position: relative;
}

.catalogue-card:hover {
    transform: rotate(0deg) translateY(-4px);
    box-shadow: 0 8px 32px rgba(46,42,58,0.12);
    z-index: 5;
}

.card-margin-cross {
    margin-right: -20%;
    z-index: 3;
}

.card-wide {
    grid-column: span 2;
}

.card-ruling-top,
.card-ruling-bottom {
    height: 1px;
    background: rgba(59,90,138,0.25);
    margin-bottom: 1rem;
}

.card-ruling-bottom {
    margin-top: 1rem;
    margin-bottom: 0;
}

.card-author {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    margin-bottom: 0.4rem;
}

.card-author-name {
    font-family: var(--font-smallcaps);
    font-size: 1rem;
    letter-spacing: 0.12em;
    color: var(--deep-manuscript);
    font-weight: 600;
}

.card-date {
    font-family: var(--font-smallcaps);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--faded-ink);
}

.card-language {
    margin-bottom: 0.8rem;
}

.marginalia-inline {
    font-family: var(--font-marginalia);
    font-size: 0.78rem;
    font-style: italic;
    color: var(--faded-ink);
}

.card-excerpt {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.75;
    color: var(--deep-manuscript);
    border-left: none;
    quotes: "\201C" "\201D" "\2018" "\2019";
}

.card-source {
    font-family: var(--font-smallcaps);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--faded-ink);
    margin-top: 0.8rem;
}

.catalogue-margin {
    padding-top: 4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-left: 1rem;
}

/* ============================================================
   Folio III — The Illuminated Text
   ============================================================ */
#folio-iii {
    min-height: 100vh;
    background-color: var(--deep-manuscript);
    color: var(--antique-vellum);
    padding: 8rem 4rem 8rem 56px;
    position: relative;
}

#folio-iii .folio-title {
    color: var(--vellum-blue);
}

#folio-iii .folio-marker {
    color: var(--aquarelle-sky);
}

#folio-iii .folio-header-row {
    margin-bottom: 4rem;
}

.illuminated-layout {
    display: grid;
    grid-template-columns: 58fr 42fr;
    column-gap: 4rem;
    max-width: 1300px;
    position: relative;
    z-index: 2;
    padding-left: 3rem;
}

.illuminated-column {
    position: relative;
}

.illuminated-text {
    font-family: var(--font-display);
    font-weight: 300;
    color: var(--antique-vellum);
}

.illuminated-passage {
    font-size: 1.25rem;
    line-height: 2;
    margin-bottom: 1.5rem;
}

/* Drop capital */
.drop-cap-container .illuminated-passage:first-child::first-letter {
    font-size: 4.5em;
    float: left;
    line-height: 0.8;
    padding-right: 0.08em;
    color: var(--illuminated-blue);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
}

.secondary-passage .illuminated-passage {
    font-size: 1.1rem;
    line-height: 1.9;
    padding-top: 4rem;
    border-left: 1px solid rgba(123,167,201,0.3);
    padding-left: 2rem;
}

.secondary-passage .drop-cap-container .illuminated-passage:first-child::first-letter {
    font-size: 3.5em;
    color: var(--aquarelle-sky);
}

.illuminated-attribution {
    font-family: var(--font-smallcaps);
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--aquarelle-sky);
    margin-top: 1.5rem;
}

/* ============================================================
   Folio IV — The Marginalia
   ============================================================ */
#folio-iv {
    min-height: 120vh;
    background-color: var(--antique-vellum);
    padding: 8rem 4rem 8rem 56px;
    position: relative;
}

.marginalia-grid {
    display: grid;
    grid-template-columns: 58fr 42fr;
    grid-template-rows: auto;
    column-gap: 3rem;
    row-gap: 2rem;
    max-width: 1300px;
    position: relative;
    z-index: 2;
    padding-left: 3rem;
}

.annotation-block {
    padding: 1.5rem;
    position: relative;
    border-bottom: 1px solid rgba(46,42,58,0.1);
}

.block-main {
    grid-column: 1;
}

.block-cross-margin {
    grid-column: 2;
}

.block-margin {
    grid-column: 2;
}

.block-span {
    grid-column: 1 / -1;
    border-left: 2px solid rgba(74,48,96,0.3);
    padding-left: 2rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.wax-seal {
    display: inline-flex;
    margin-bottom: 1rem;
    filter: drop-shadow(0 3px 6px rgba(74,48,96,0.35));
}

.block-span .wax-seal {
    flex-shrink: 0;
    margin-bottom: 0;
    margin-top: 0.3rem;
}

.seal-svg {
    width: 48px;
    height: 48px;
}

.ruling-line {
    height: 1px;
    background: rgba(59,90,138,0.25);
    margin-bottom: 1.2rem;
}

.annotation-quote {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.8;
    color: var(--deep-manuscript);
}

.annotation-quote em {
    color: var(--illuminated-blue);
}

.annotation-meta {
    margin-top: 0.8rem;
}

/* ============================================================
   Folio V — The Colophon
   ============================================================ */
#folio-v {
    min-height: 80vh;
    background-color: var(--antique-vellum);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-top: 1px solid #2E2A3A20;
}

.colophon-content {
    max-width: 620px;
    text-align: center;
    position: relative;
    z-index: 2;
    padding: 4rem 2rem;
}

.ornamental-svg {
    width: 300px;
    height: 20px;
}

.ornamental-rule-top {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: center;
}

.ornamental-rule-bottom {
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
}

.colophon-text {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.08rem;
    font-weight: 300;
    line-height: 1.9;
    color: var(--deep-manuscript);
}

.colophon-text em {
    color: var(--illuminated-blue);
    font-style: normal;
}

.colophon-botanical {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    opacity: 0.65;
}

.colophon-credit {
    margin-top: 1.5rem;
}

/* ============================================================
   Parallax Wash Layers (JS-driven)
   ============================================================ */
.wash-layer[data-speed] {
    transition: none; /* JS will handle transform */
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .manuscript-layout,
    .catalogue-grid,
    .illuminated-layout,
    .marginalia-grid {
        grid-template-columns: 1fr;
    }

    .card-margin-cross {
        margin-right: 0;
    }

    .card-wide {
        grid-column: span 1;
    }

    .block-span {
        grid-column: 1;
        flex-direction: column;
    }

    .block-cross-margin,
    .block-margin {
        grid-column: 1;
    }

    .annotation-margin {
        padding-top: 2rem;
    }

    .secondary-passage .illuminated-passage {
        padding-top: 2rem;
    }

    .folio {
        padding-left: 44px;
    }

    #folio-ii {
        padding: 4rem 2rem 4rem 44px;
    }

    #folio-iii,
    #folio-iv {
        padding: 5rem 2rem 5rem 44px;
    }
}

@media (max-width: 600px) {
    .domain-title {
        font-size: 4rem;
    }

    #book-spine {
        width: 24px;
    }

    .spine-label {
        font-size: 7px;
    }
}
