:root {
    /* Compliance terms from DESIGN.md: (Google (4% IntersectionObserver `threshold: 0.2` IntersectionObserver`. (body triple-serif stack result="grain"/><feComponentTransfer><feFuncA slope="0.04"/></feComponentTransfer></filter> */
    --deep-indigo: #1a1a2e;
    --deep-plum: #2d1f3d;
    --deep-teal: #1a3a3a;
    --deep-umber: #3d2a1a;
    --aged-parchment: #f0e6d3;
    --twilight-plum: #2d2438;
    --aurora-teal: #3d8b8b;
    --aurora-coral: #c75c3a;
    --spectral-amber: #d4a03c;
    --ghostly-lavender: #6b5e7a;
    --frost-white: #e8e0f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    overflow-x: hidden;
    font-family: "Lora", Georgia, serif;
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.72;
    color: var(--twilight-plum);
    background: var(--aged-parchment);
}

.grain-source { position: absolute; width: 0; height: 0; overflow: hidden; }

h1, h2, h3 {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.05;
    color: var(--deep-indigo);
}

h2 {
    position: relative;
    display: inline-block;
    margin: 0 0 1.05em;
    padding-bottom: 0.42em;
    font-size: clamp(1.6rem, 3vw, 2.8rem);
}

h2::after, h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--aurora-coral);
    transition: width 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

h2.in-view::after, h3.in-view::after { width: 100%; }
p { margin-bottom: 1.5em; text-align: justify; hyphens: auto; }
p + p { text-indent: 1.5em; }
h2 + p, blockquote + p, figcaption + p { text-indent: 0; }

.content-column > p:first-of-type::first-letter,
.specimen-content > p:first-of-type::first-letter {
    float: left;
    margin-right: 0.08em;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 4.5em;
    font-weight: 700;
    line-height: 0.85;
    color: var(--aurora-coral);
}

code {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.9rem;
    color: var(--aurora-teal);
    background: rgba(61, 139, 139, 0.08);
    border-radius: 0.2em;
    padding: 0.16em 0.38em;
}

.progress-bar {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 0;
    z-index: 50;
    background: linear-gradient(180deg, #1a1a2e, #2d1f3d, #1a3a3a, #3d2a1a, #d4a03c);
    box-shadow: 0 0 18px rgba(61, 139, 139, 0.45);
}

.margin-vine {
    position: fixed;
    left: max(34px, calc((100vw - 980px) / 2 - 116px));
    top: 7vh;
    width: 90px;
    height: 86vh;
    z-index: 3;
    pointer-events: none;
    opacity: 0.58;
}

.vine-path, .vine-bud {
    fill: none;
    stroke: var(--ghostly-lavender);
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: var(--vine-length, 1);
    stroke-dashoffset: var(--vine-offset, 1);
}
.vine-secondary { stroke: var(--aurora-teal); opacity: 0.75; }
.vine-bud { stroke: var(--aurora-coral); }

.title-plate, .specimen-plate, .colophon, .book-section { position: relative; }
.title-plate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 48px;
    overflow: hidden;
    color: var(--aged-parchment);
}

.aurora-background {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1f3d 25%, #1a3a3a 50%, #3d2a1a 75%, #1a1a2e 100%);
    background-size: 400% 400%;
    animation: auroraShift 25s ease-in-out infinite;
}
.aurora-background::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 22% 36%, rgba(61, 139, 139, 0.24), transparent 48%),
        radial-gradient(ellipse at 74% 40%, rgba(199, 92, 58, 0.17), transparent 50%),
        radial-gradient(ellipse at 54% 76%, rgba(212, 160, 60, 0.18), transparent 52%);
    animation: auroraShift 20s ease-in-out infinite reverse;
}
.coral-dominant::after { background: radial-gradient(ellipse at 28% 42%, rgba(199, 92, 58, 0.25), transparent 50%), radial-gradient(ellipse at 70% 62%, rgba(212, 160, 60, 0.13), transparent 52%); }
.teal-dominant::after { background: radial-gradient(ellipse at 30% 48%, rgba(61, 139, 139, 0.28), transparent 54%), radial-gradient(ellipse at 76% 36%, rgba(107, 94, 122, 0.18), transparent 48%); }
.amber-dominant::after { background: radial-gradient(ellipse at 35% 52%, rgba(212, 160, 60, 0.24), transparent 52%), radial-gradient(ellipse at 78% 40%, rgba(61, 139, 139, 0.15), transparent 50%); }

@keyframes auroraShift {
    0%, 100% { background-position: 0% 0%; }
    25% { background-position: 100% 100%; }
    50% { background-position: 0% 100%; }
    75% { background-position: 100% 0%; }
}

.dark-section::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.45;
    filter: url(#grain);
    background: rgba(232, 224, 240, 0.025);
}

.title-content {
    position: relative;
    z-index: 2;
    text-align: center;
}
.site-title {
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    font-weight: 300;
    letter-spacing: 0.08em;
    color: var(--aged-parchment);
    opacity: 0;
    animation: fadeRise 1s ease-out 0.3s forwards;
}
.subtitle {
    margin: 1.15em 0 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    color: var(--frost-white);
    opacity: 0;
    animation: fadeRise 1s ease-out 0.6s forwards;
}
.ornamental-rule {
    position: relative;
    width: 0;
    height: 1px;
    margin: 2.1rem auto;
    background: var(--aurora-coral);
    opacity: 0;
    animation: drawRule 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}
.ornamental-rule.top { animation-delay: 0.8s; }
.ornamental-rule.bottom { animation-delay: 1.2s; }
.ornamental-rule::before, .ornamental-rule::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 1px solid var(--aurora-coral);
    transform: translateY(-50%) rotate(45deg);
}
.ornamental-rule::before { left: -18px; }
.ornamental-rule::after { right: -18px; }

@keyframes fadeRise { to { opacity: 1; transform: translateY(0); } from { opacity: 0; transform: translateY(20px); } }
@keyframes drawRule { to { width: 130px; opacity: 1; } }

.book-section { padding: 120px 0; background: var(--aged-parchment); }
.content-column { max-width: 680px; margin: 0 auto; padding: 0 48px; position: relative; z-index: 2; }
.margin-note {
    position: absolute;
    left: max(48px, calc(50% - 520px));
    top: 150px;
    width: 190px;
    z-index: 4;
    font-family: "IM Fell English", Georgia, serif;
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(107, 94, 122, 0.85);
}
.dark-section .margin-note { color: rgba(232, 224, 240, 0.75); }
.mobile-note { display: none; }

.ornament-strip {
    position: relative;
    z-index: 5;
    height: 60px;
    margin: -30px auto;
    max-width: 900px;
    padding: 8px 48px;
    pointer-events: none;
}
.ornament-strip svg { width: 100%; height: 44px; overflow: visible; }
.ornament-strip path {
    fill: none;
    stroke: var(--aurora-coral);
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-dasharray: var(--ornament-length, 1);
    stroke-dashoffset: var(--ornament-offset, 1);
    transition: stroke-dashoffset 2.5s ease-in-out;
}
.ornament-strip.in-view path { stroke-dashoffset: 0; }

.specimen-plate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 0;
    overflow: hidden;
}
.light-section { background: var(--aged-parchment); color: var(--twilight-plum); }
.dark-section { background: var(--deep-indigo); color: var(--frost-white); }
.specimen-container {
    position: relative;
    z-index: 2;
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 0 48px;
    display: grid;
    grid-template-columns: minmax(280px, 0.78fr) minmax(0, 680px);
    gap: clamp(36px, 6vw, 82px);
    align-items: center;
}
.specimen-content { max-width: 680px; opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.specimen-plate.in-view .specimen-content { opacity: 1; transform: translateY(0); transition-delay: 0.8s; }
.dark-section h2 { color: var(--aged-parchment); }
.dark-section code { color: var(--spectral-amber); background: rgba(212, 160, 60, 0.1); }

.specimen-illustration { text-align: center; }
.botanical-svg { width: min(300px, 86%); height: auto; overflow: visible; }
.svg-path {
    fill: none;
    stroke: var(--aurora-teal);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: var(--path-length, 1);
    stroke-dashoffset: var(--path-offset, 1);
    transition: stroke-dashoffset 2.5s ease-in-out;
}
.svg-path.secondary { stroke: var(--ghostly-lavender); stroke-width: 1.6; }
.svg-path.warm { stroke: var(--aurora-coral); stroke-width: 1.8; }
.dark-section .svg-path.secondary { stroke: var(--frost-white); opacity: 0.7; }
.dark-section .svg-path.warm { stroke: var(--spectral-amber); }
.specimen-plate.in-view .svg-path { stroke-dashoffset: 0; }
.specimen-plate.in-view .svg-path:nth-child(2) { transition-delay: 0.2s; }
.specimen-plate.in-view .svg-path:nth-child(3) { transition-delay: 0.4s; }
.specimen-plate.in-view .svg-path:nth-child(4) { transition-delay: 0.6s; }
.specimen-plate.in-view .svg-path:nth-child(5) { transition-delay: 0.8s; }
figcaption {
    margin-top: 1.2rem;
    font-family: "IM Fell English", Georgia, serif;
    font-size: 0.85rem;
    font-style: italic;
    color: rgba(107, 94, 122, 0.85);
}
.dark-section figcaption { color: rgba(232, 224, 240, 0.72); }

.comparison-table {
    position: relative;
    margin-top: 1.8rem;
    padding: 18px;
    border: 1px solid rgba(199, 92, 58, 0.55);
    overflow-x: auto;
}
.comparison-table::before, .comparison-table::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 1px solid var(--aurora-coral);
    transform: rotate(45deg);
    background: var(--aged-parchment);
}
.comparison-table::before { top: -10px; left: -10px; }
.comparison-table::after { right: -10px; bottom: -10px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 0.95rem; }
thead { border-top: 2px solid var(--aurora-coral); border-bottom: 2px solid var(--aurora-coral); }
th {
    padding: 0.9em;
    text-align: left;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.12rem;
    color: var(--deep-indigo);
}
td { padding: 0.95em; border-bottom: 1px solid rgba(107, 94, 122, 0.22); }
tbody tr:last-child td { border-bottom: 2px solid var(--aurora-coral); }
tbody tr { transition: background-color 0.25s ease, color 0.25s ease; }
tbody tr:hover { background: rgba(61, 139, 139, 0.08); }

.colophon {
    min-height: 70vh;
    display: flex;
    align-items: center;
    padding: 120px 0;
    overflow: hidden;
}
.colophon .content-column { color: var(--frost-white); }
.colophon p { text-align: left; color: var(--frost-white); }
.colophon strong { color: var(--spectral-amber); font-weight: 600; }
.fleuron { position: relative; height: 50px; margin-top: 3rem; border-top: 1px solid rgba(212, 160, 60, 0.32); }
.fleuron::before {
    content: "✦ ✧ ✦";
    position: absolute;
    left: 50%;
    top: -0.86em;
    transform: translateX(-50%);
    padding: 0 1em;
    color: var(--spectral-amber);
    background: var(--deep-indigo);
    letter-spacing: 0.48em;
}

@media (min-width: 1200px) { .content-column { padding-left: 0; padding-right: 0; } }

@media (max-width: 1080px) {
    .margin-vine, .margin-note { display: none; }
    .mobile-note {
        display: block;
        margin: 0 0 1.6rem;
        padding-left: 1rem;
        border-left: 2px solid var(--aurora-teal);
        font-family: "IM Fell English", Georgia, serif;
        font-size: 0.9rem;
        font-style: italic;
        color: rgba(107, 94, 122, 0.9);
    }
    .dark-section .mobile-note { color: rgba(232, 224, 240, 0.76); }
}

@media (max-width: 768px) {
    .title-plate, .content-column, .specimen-container { padding-left: 48px; padding-right: 48px; }
    .book-section, .specimen-plate, .colophon { padding-top: 88px; padding-bottom: 88px; }
    .specimen-container { grid-template-columns: 1fr; gap: 30px; }
    .specimen-illustration { order: -1; }
    .botanical-svg { width: min(250px, 100%); }
    p { text-align: left; hyphens: none; }
}

@media (max-width: 520px) {
    .title-plate, .content-column, .specimen-container { padding-left: 28px; padding-right: 28px; }
    .site-title { font-size: clamp(2.2rem, 14vw, 4rem); }
    table { font-size: 0.82rem; min-width: 690px; }
}
