/* =====================================================
   bvb.tools — The Illuminated Codex
   Colors: #F5E6C8 #2C1810 #B700FF #0AFF99 #FF0090
           #1A0A2E #FFE566 #C8A882
   Fonts: Bebas Neue, Playfair Display, EB Garamond, Space Mono
   ===================================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'EB Garamond', serif;
    font-size: 16px;
    line-height: 26px;
    color: #2C1810;
    background-color: #F5E6C8;
    overflow-x: hidden;
    position: relative;
}

/* --- Electric Gutter Line --- */
.electric-gutter {
    position: fixed;
    left: 18vw;
    top: 0;
    width: 3px;
    height: 100vh;
    background-color: #B700FF;
    z-index: 100;
    pointer-events: none;
    animation: gutter-flicker 3.7s infinite;
}

@keyframes gutter-flicker {
    0%   { opacity: 0.4; }
    47%  { opacity: 1; }
    53%  { opacity: 0.6; }
    78%  { opacity: 1; }
    100% { opacity: 0.4; }
}

/* --- Chapter Breaks --- */
.chapter-break {
    height: 12px;
    width: 100%;
    display: block;
}

.chapter-break-violet { background-color: #B700FF; }
.chapter-break-green  { background-color: #0AFF99; }
.chapter-break-magenta { background-color: #FF0090; }

/* --- Folio (Section) Base --- */
.folio {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    /* Ruled-line texture — CSS, not image */
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 25px,
        rgba(44, 24, 16, 0.06) 25px,
        rgba(44, 24, 16, 0.06) 26px
    );
}

.folio-parchment {
    background-color: #F5E6C8;
    color: #2C1810;
}

.folio-night {
    background-color: #1A0A2E;
    color: #F5E6C8;
    /* Night grid texture instead of ruled lines */
    background-image: repeating-linear-gradient(
        to right,
        transparent,
        transparent 39px,
        rgba(183, 0, 255, 0.03) 39px,
        rgba(183, 0, 255, 0.03) 40px
    ),
    repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 39px,
        rgba(183, 0, 255, 0.03) 39px,
        rgba(183, 0, 255, 0.03) 40px
    );
}

.folio-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 80px 5vw 120px 22vw; /* left pad > gutter */
    position: relative;
}

/* --- FOLIO I — Opening Illumination --- */
.folio-i {
    min-height: 100vh;
}

.folio-i .folio-inner {
    padding-top: 60px;
    padding-bottom: 140px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.domain-title-wrap {
    position: absolute;
    top: 52px;
    left: 22vw;
}

.domain-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 144px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #B700FF;
    line-height: 1;
    text-transform: uppercase;
}

.folio-i-text {
    margin-top: 240px;
    max-width: 480px;
    transform: rotate(-2deg);
}

.invitation-text {
    font-family: 'Playfair Display', serif;
    font-size: 36px;
    font-style: italic;
    font-weight: 400;
    line-height: 1.35;
    color: #2C1810;
}

/* Botanical illustration — lower right bleed */
.botanical-anchor {
    position: absolute;
    bottom: -60px;
    right: -40px;
    z-index: 1;
}

.botanical-i {
    width: 420px;
    height: 540px;
    opacity: 1;
}

.botanical-svg {
    width: 100%;
    height: 100%;
}

/* Margin annotation column */
.margin-annotation {
    position: absolute;
    left: 3vw;
    top: 50%;
    transform: translateY(-50%);
    width: 14vw;
    max-width: 160px;
    border-left: 2px solid #C8A882;
    padding-left: 12px;
}

.annotation-creature {
    display: block;
    margin-bottom: 10px;
}

.annotation-text {
    font-family: 'EB Garamond', serif;
    font-size: 12px;
    font-style: italic;
    line-height: 1.6;
    color: #2C1810;
}

/* Folio roman number */
.folio-number {
    position: absolute;
    top: 60px;
    right: 6vw;
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-style: italic;
    color: #C8A882;
    letter-spacing: 0.1em;
}

/* --- FOLIO II — Annotation Field --- */
.folio-ii {
    min-height: 120vh;
}

.folio-two-col {
    display: grid;
    /* 13-column asymmetric: annotation ~18%, main ~82% */
    grid-template-columns: 1fr 4.5fr;
    gap: 0;
    padding-left: 3vw;
    padding-right: 4vw;
    align-items: start;
}

/* Annotation column */
.annotation-col {
    padding-top: 80px;
    padding-right: 24px;
    border-right: 2px solid #C8A882;
    min-height: 100%;
}

.annotation-col-inner {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.gloss-text {
    font-family: 'EB Garamond', serif;
    font-size: 13px;
    font-style: italic;
    line-height: 1.7;
    color: #2C1810;
}

.roman-numeral {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-style: italic;
    font-weight: 700;
    color: #B700FF;
    letter-spacing: 0.1em;
    display: block;
}

.roman-numeral-night {
    color: #0AFF99;
}

.footnote-meta {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: #C8A882;
    letter-spacing: 0.05em;
    margin-top: 12px;
}

/* Main column */
.main-col {
    padding: 80px 0 120px 40px;
}

.main-col-inner {
    max-width: 720px;
}

.section-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 0.92;
    margin-bottom: 40px;
}

.section-heading-dark {
    font-size: 120px;
    color: #2C1810;
}

.section-heading-violet {
    font-size: 110px;
    color: #B700FF;
}

.section-heading-green {
    font-size: 120px;
    color: #0AFF99;
}

.section-heading-magenta {
    font-size: 100px;
    color: #FF0090;
}

/* Drop cap */
.drop-cap-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 24px;
}

.drop-cap {
    font-family: 'Playfair Display', serif;
    font-size: 92px;
    font-weight: 700;
    font-style: italic;
    line-height: 0.82;
    float: left;
    padding-right: 12px;
    padding-top: 6px;
    color: #B700FF;
}

.drop-cap-violet { color: #B700FF; }
.drop-cap-green  { color: #0AFF99; }
.drop-cap-magenta { color: #FF0090; }

.body-text {
    font-family: 'EB Garamond', serif;
    font-size: 16px;
    line-height: 26px;
    color: #2C1810;
    margin-bottom: 20px;
}

.body-text-parchment {
    color: #F5E6C8;
}

/* Pull quote */
.pull-quote {
    border-left: 3px solid #FFE566;
    background-color: rgba(255, 229, 102, 0.15);
    padding: 20px 24px;
    margin: 36px 0;
    transform: rotate(1deg);
}

.pull-quote p {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-style: italic;
    color: #2C1810;
    line-height: 1.5;
    margin-bottom: 10px;
}

.pull-quote cite {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #C8A882;
    font-style: normal;
}

.pull-quote-offset {
    margin-left: 40px;
    transform: rotate(-1deg);
}

/* Tool diagram */
.tool-diagram {
    margin-top: 60px;
    margin-left: 40%;
    max-width: 320px;
    position: relative;
}

.tool-diagram svg {
    width: 100%;
    height: auto;
}

.diagram-caption {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: #C8A882;
    margin-top: 10px;
    font-style: italic;
}

/* --- FOLIO III — Night Study --- */
.folio-iii {
    min-height: 100vh;
}

.folio-night-inner {
    display: grid;
    grid-template-columns: 55% 45%;
    gap: 0;
    padding: 0;
    max-width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

.specimen-plate {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Slight left bleed */
    margin-left: -5%;
}

.specimen-plate svg {
    width: 90%;
    max-width: 420px;
    height: auto;
    filter: drop-shadow(0 0 12px rgba(10, 255, 153, 0.3))
            drop-shadow(0 0 6px rgba(183, 0, 255, 0.2));
}

.night-text-col {
    padding: 80px 5vw 100px 4vw;
    display: flex;
    align-items: center;
}

.night-text-inner {
    max-width: 480px;
}

.night-annotation {
    border-left: 2px solid #0AFF99;
    padding-left: 16px;
    margin: 28px 0;
}

.annotation-text-night {
    font-family: 'EB Garamond', serif;
    font-size: 13px;
    font-style: italic;
    color: #C8A882;
    line-height: 1.7;
}

/* --- FOLIO IV — Scholar's Index --- */
.folio-iv {
    min-height: 140vh;
}

.folio-tilted .folio-inner {
    /* Section tilt: CSS transform on inner content */
    transform-origin: center top;
}

.index-entry {
    margin-bottom: 48px;
    padding-bottom: 36px;
    border-bottom: 1px solid rgba(200, 168, 130, 0.4);
}

.index-entry:last-of-type {
    border-bottom: none;
}

.entry-heading {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-style: italic;
    font-weight: 700;
    color: #2C1810;
    margin-bottom: 12px;
    clear: both;
}

/* --- FOLIO V — Electric Colophon --- */
.folio-v {
    min-height: 80vh;
}

.folio-v-inner {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding-left: 10vw;
    padding-right: 10vw;
    position: relative;
}

.colophon-heading-wrap {
    margin-bottom: 60px;
}

.colophon-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(60px, 10vw, 160px);
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #FF0090;
    text-transform: uppercase;
    line-height: 0.92;
}

/* Only centered element in the entire design */
.colophon-domain {
    text-align: center;
    width: 100%;
}

.colophon-domain-text {
    font-family: 'EB Garamond', serif;
    font-size: 18px;
    font-style: italic;
    color: #F5E6C8;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.colophon-meta {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #C8A882;
    letter-spacing: 0.08em;
}

/* Margin creature - lower left */
.colophon-creature {
    position: absolute;
    bottom: 32px;
    left: 5vw;
    opacity: 0.7;
}

/* --- Entrance Animations --- */
/* Initial state: content hidden, shifted down with tilt */
.folio-content-hidden {
    opacity: 0;
    transform: translateY(28px) rotate(var(--section-tilt, 0deg));
}

.folio-content-visible {
    opacity: 1;
    transform: translateY(0) rotate(var(--section-tilt, 0deg));
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* Section tilt via CSS custom property */
.folio-i   { --section-tilt: -2deg; }
.folio-ii  { --section-tilt: 3deg; }
.folio-iii { --section-tilt: -4deg; }
.folio-iv  { --section-tilt: 7deg; }
.folio-v   { --section-tilt: -3deg; }

/* Animated entrance helpers applied by JS */
.animate-in {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Parallax handled via JS (illustration at 0.6x scroll speed) */
.botanical-anchor,
.specimen-plate {
    will-change: transform;
}

/* --- Responsive adjustments --- */
@media (max-width: 900px) {
    .domain-title { font-size: 80px; }

    .folio-two-col {
        grid-template-columns: 1fr;
        padding-left: 4vw;
    }

    .annotation-col {
        border-right: none;
        border-bottom: 2px solid #C8A882;
        padding-right: 0;
        padding-bottom: 20px;
        position: static;
    }

    .annotation-col-inner {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .main-col {
        padding-left: 0;
    }

    .folio-night-inner {
        grid-template-columns: 1fr;
    }

    .specimen-plate {
        min-height: 60vh;
        margin-left: 0;
    }

    .section-heading-dark,
    .section-heading-violet,
    .section-heading-green {
        font-size: 64px;
    }

    .colophon-heading { font-size: 56px; }

    .electric-gutter { display: none; }

    .folio-inner {
        padding-left: 4vw;
    }

    .domain-title-wrap { left: 4vw; }

    .margin-annotation { display: none; }
}

@media (max-width: 600px) {
    .domain-title { font-size: 56px; }
    .drop-cap { font-size: 64px; }
    .section-heading-dark,
    .section-heading-violet,
    .section-heading-green,
    .section-heading-magenta {
        font-size: 48px;
    }
    .invitation-text { font-size: 24px; }
}
