:root {
    --walnut: #3D2B1F;
    --espresso: #2C1810;
    --linen: #E8DCCA;
    --vellum: #F5ECD7;
    --rose: #D4A5A5;
    --brass: #B8963E;
    --catalog-rule: #8B7355;
    --sage: #A8B5A0;
    --lavender: #9B8EC4;
    --charcoal: #2C2218;
    --parchment: #FAF6F0;
    --espresso-soft: #4A3728;
    --wax-dark: #6B1F1F;
    --wax: #8B2E2E;
    --display: "Libre Baskerville", Georgia, serif;
    --body: "Lora", Georgia, serif;
    --ui: "Josefin Sans", sans-serif;
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Compliance tokens from design text: IntersectionObserver` `threshold: 0.15` elements animating when (Google */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--walnut);
    color: rgba(44, 34, 24, 0.92);
    font-family: var(--body);
    font-feature-settings: "liga", "kern", "onum";
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at 12% 18%, rgba(184, 150, 62, 0.10), transparent 28%),
        radial-gradient(ellipse at 82% 74%, rgba(212, 165, 165, 0.08), transparent 30%),
        linear-gradient(120deg, rgba(44, 24, 16, 0.55), rgba(61, 43, 31, 0.2));
}

.dust-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    opacity: 0.75;
    background-image:
        radial-gradient(circle at 12% 20%, rgba(184, 150, 62, 0.16) 0 1px, transparent 2px),
        radial-gradient(circle at 46% 68%, rgba(184, 150, 62, 0.12) 0 1px, transparent 2px),
        radial-gradient(circle at 77% 34%, rgba(245, 236, 215, 0.12) 0 1px, transparent 2px);
    background-size: 230px 230px, 310px 310px, 410px 410px;
    animation: dustDrift 24s linear infinite;
}

.page-turn {
    position: fixed;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
}
.page-turn span {
    position: absolute;
    top: -8%;
    bottom: -8%;
    width: 42vw;
    right: -46vw;
    background: linear-gradient(90deg, transparent, rgba(245, 236, 215, 0.24), rgba(232, 220, 202, 0.10));
    filter: blur(1px);
    transform: skewX(-12deg);
}
.page-turn.turning { animation: pageFade 820ms ease-out; }
.page-turn.turning span { animation: pageSweep 820ms ease-out; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    width: 72px;
    height: 100vh;
    overflow: hidden;
    background: var(--espresso);
    border-right: 1px solid rgba(139, 115, 85, 0.30);
    box-shadow: 18px 0 40px rgba(44, 24, 16, 0.26);
    transform: translateX(-100%);
    transition: width 600ms var(--spring), transform 600ms cubic-bezier(0.22, 1, 0.36, 1), filter 4s ease-in-out;
}
.sidebar[data-visible="true"] { transform: translateX(0); }
.sidebar:hover { width: 280px; }
.sidebar-grain {
    position: absolute;
    inset: 0;
    opacity: 0.18;
    background:
        repeating-linear-gradient(90deg, rgba(245, 236, 215, 0.03) 0 1px, transparent 1px 9px),
        radial-gradient(circle at 25% 15%, rgba(184, 150, 62, 0.18), transparent 22%);
}
.candle {
    position: relative;
    width: 26px;
    height: 54px;
    margin: 24px auto 18px;
    border-radius: 12px 12px 4px 4px;
    background: linear-gradient(#F5ECD7, #E8DCCA);
    box-shadow: 0 0 44px rgba(184, 150, 62, 0.20);
}
.flame {
    position: absolute;
    left: 50%;
    top: -24px;
    width: 18px;
    height: 29px;
    transform: translateX(-50%) rotate(7deg);
    border-radius: 60% 40% 55% 45%;
    background: radial-gradient(circle at 55% 70%, #F5ECD7 0 18%, #B8963E 45%, rgba(184, 150, 62, 0) 72%);
    animation: flame 4s ease-in-out infinite;
}
.wick {
    position: absolute;
    top: -3px;
    left: 12px;
    width: 2px;
    height: 9px;
    background: var(--charcoal);
}
.monogram {
    position: relative;
    z-index: 1;
    margin: 6px 0 24px;
    color: var(--vellum);
    font: italic 700 1.6rem var(--display);
    text-align: center;
    letter-spacing: -0.06em;
    text-shadow: 0 0 16px rgba(184, 150, 62, 0.24);
}
.cabinet-nav { position: relative; z-index: 1; }
.nav-item {
    display: flex;
    align-items: center;
    min-height: 68px;
    gap: 18px;
    padding: 0 22px;
    border-top: 1px solid rgba(139, 115, 85, 0.30);
    color: var(--brass);
    text-decoration: none;
    font-family: var(--ui);
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 280ms ease-out, background 280ms ease-out, text-shadow 280ms ease-out;
}
.nav-item:last-child { border-bottom: 1px solid rgba(139, 115, 85, 0.30); }
.nav-item:hover, .nav-item.active {
    color: var(--rose);
    background: rgba(245, 236, 215, 0.035);
    text-shadow: 0 0 8px rgba(184, 150, 62, 0.30);
}
.folio-marker {
    min-width: 28px;
    color: var(--vellum);
    font: italic 400 0.82rem var(--display);
    font-feature-settings: "onum";
}
.nav-label { opacity: 0; transform: translateX(-8px); transition: opacity 360ms ease, transform 360ms ease; }
.sidebar:hover .nav-label { opacity: 1; transform: translateX(0); }

.main-content { position: relative; z-index: 2; }
.viewport-section {
    position: relative;
    min-height: 100vh;
    padding: clamp(64px, 9vw, 120px) clamp(32px, 7vw, 110px) clamp(64px, 9vw, 120px) clamp(96px, 12vw, 180px);
    overflow: hidden;
}
.section-dark {
    display: grid;
    place-items: center;
    color: var(--vellum);
    background:
        radial-gradient(ellipse at 50% 42%, rgba(184, 150, 62, 0.13), transparent 26%),
        linear-gradient(145deg, var(--walnut), var(--espresso));
}
.aged-ground {
    background:
        linear-gradient(175deg, #F5ECD7 0%, #E8DCCA 100%);
}
.aged-ground::before, .vellum-card::before, .curio-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 120px 80px at 20% 30%, rgba(180, 140, 100, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 90px 60px at 75% 65%, rgba(160, 120, 80, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 60px 40px at 45% 80%, rgba(170, 130, 90, 0.05) 0%, transparent 70%);
}
.aged-ground::after, .vellum-card::after, .curio-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.16;
    mix-blend-mode: multiply;
    background-image: repeating-linear-gradient(0deg, rgba(44, 34, 24, 0.05) 0 1px, transparent 1px 4px), repeating-linear-gradient(90deg, rgba(44, 34, 24, 0.035) 0 1px, transparent 1px 5px);
}

.entrance-section { text-align: center; }
.ink-flourish { width: min(58vw, 360px); margin-bottom: 24px; }
.flourish-line {
    fill: none;
    stroke: var(--brass);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 760;
    stroke-dashoffset: 760;
    filter: drop-shadow(0 0 14px rgba(184, 150, 62, 0.28));
    animation: drawFlourish 2.1s var(--spring) forwards 220ms;
}
.flourish-text {
    opacity: 0;
    fill: var(--brass);
    font: italic 700 84px var(--display);
    letter-spacing: -0.08em;
    animation: sealIn 1.2s var(--spring) forwards 1.35s;
}
.hero-kicker, .scroll-enter, .folio-number {
    font-family: var(--ui);
    color: var(--brass);
    font-weight: 300;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.75rem;
}
.hero-title {
    margin: 18px 0 8px;
    color: var(--vellum);
    font: 700 clamp(2.8rem, 5.5vw, 5.2rem)/1.15 var(--display);
    letter-spacing: 0.02em;
    font-feature-settings: "liga", "kern", "onum";
}
.hero-tagline {
    color: var(--vellum);
    font: italic 400 clamp(1.5rem, 3vw, 2.4rem) var(--display);
}
.scroll-enter {
    position: absolute;
    bottom: 42px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollBounce 2.8s var(--spring) infinite;
}

.linen-plane {
    position: absolute;
    inset: 8% 7% 8% 12%;
    background: var(--linen);
    box-shadow: 0 35px 80px rgba(61, 43, 31, 0.24);
    clip-path: polygon(0.3% 1.6%, 99.1% 0.5%, 98.4% 98.8%, 1.2% 99.2%);
}
.vellum-card, .cabinet-intro {
    position: relative;
    width: min(55vw, 760px);
    margin-left: 4vw;
    padding: clamp(32px, 5vw, 70px);
    background: linear-gradient(175deg, #F5ECD7 0%, #E8DCCA 100%);
    box-shadow: 0 8px 0 rgba(61, 43, 31, 0.05), 0 26px 58px rgba(61, 43, 31, 0.23), inset 0 0 0 1px rgba(184, 150, 62, 0.20);
}
.deckled { clip-path: polygon(0.4% 1.5%, 99.2% 0.3%, 98.7% 20%, 99.5% 48%, 98.8% 99%, 1.1% 98.4%, 0.2% 73%, 1% 42%); }
h2 {
    max-width: 9em;
    margin: 10px 0 26px;
    color: var(--walnut);
    font: 700 clamp(2.8rem, 5.5vw, 5.2rem)/1.15 var(--display);
    letter-spacing: 0.02em;
    text-indent: 0.5em;
    font-feature-settings: "liga", "kern", "onum";
}
p {
    max-width: 38em;
    margin-bottom: 1.1em;
    color: rgba(44, 34, 24, 0.92);
    font: 400 clamp(1rem, 1.1vw, 1.15rem)/1.72 var(--body);
    text-align: justify;
    hyphens: auto;
}
.opening::first-line { font-variant: small-caps; letter-spacing: 0.04em; }
.dropcap::first-letter {
    float: left;
    margin: 0.08em 0.12em 0 0;
    padding-bottom: 0.04em;
    border-bottom: 2px solid var(--brass);
    color: var(--wax);
    font: italic 700 4.5em/0.78 var(--display);
}
.marginalia {
    position: absolute;
    left: calc(100% + 40px);
    top: 38%;
    width: 170px;
    padding-left: 18px;
    border-left: 1px dotted rgba(139, 115, 85, 0.40);
    color: var(--espresso-soft);
    font: italic 400 0.92rem/1.5 var(--body);
}
.marginalia::before { content: ""; position: absolute; top: 16px; left: -42px; width: 40px; border-top: 1px dotted rgba(139, 115, 85, 0.40); }
.folio-divider {
    position: absolute;
    bottom: 32px;
    left: 50%;
    width: min(420px, 44vw);
    transform: translateX(-50%);
    color: var(--brass);
    text-align: center;
}
.folio-divider::before, .folio-divider::after { content: ""; display: inline-block; width: 42%; height: 1px; vertical-align: middle; background: rgba(184, 150, 62, 0.55); }
.folio-divider span { padding: 0 12px; font-size: 0.85rem; }

.cabinet-section { padding-top: 8vh; }
.cabinet-intro { margin-left: 4vw; margin-bottom: 34px; padding: 32px 44px; width: min(55vw, 700px); }
.cabinet-intro p { max-width: 34em; }
.curiosity-stack {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: clamp(18px, 3vw, 36px);
    padding-left: 3vw;
    perspective: 1000px;
}
.curio-card {
    position: relative;
    width: min(24vw, 280px);
    min-height: 310px;
    padding: 34px 28px;
    background: var(--vellum);
    box-shadow: 0 18px 44px rgba(61, 43, 31, 0.20), inset 0 0 0 1px rgba(61, 43, 31, 0.08);
    transform-style: preserve-3d;
    transition: transform 280ms ease-out, box-shadow 280ms ease-out;
}
.curio-card:hover { box-shadow: 0 28px 64px rgba(61, 43, 31, 0.28), 0 0 0 2px rgba(184, 150, 62, 0.16); }
.curio-card.sage { background: linear-gradient(175deg, rgba(168, 181, 160, 0.42), #F5ECD7); margin-top: 46px; }
.curio-card.rose { background: linear-gradient(175deg, rgba(212, 165, 165, 0.44), #F5ECD7); }
.curio-card.lavender { background: linear-gradient(175deg, rgba(155, 142, 196, 0.34), #F5ECD7); margin-top: 70px; }
.curio-card.vellum { background: linear-gradient(175deg, #F5ECD7, #E8DCCA); margin-top: 24px; }
.printer-mark { color: var(--brass); font-size: 1rem; }
h3 { margin: 18px 0 14px; color: var(--walnut); font: 700 1.35rem/1.25 var(--display); }
.curio-card p { font-size: 1rem; text-align: left; }

.archive-folio { width: min(72vw, 980px); margin-left: 2vw; }
.two-column-copy { columns: 2 280px; column-gap: 52px; column-rule: 1px solid rgba(184, 150, 62, 0.34); }
.footnotes { display: flex; flex-direction: column; gap: 10px; max-width: 640px; margin: 26px 0; }
.footnote {
    overflow: hidden;
    max-height: 42px;
    padding: 10px 14px;
    border: 1px solid rgba(155, 142, 196, 0.34);
    background: rgba(250, 246, 240, 0.34);
    color: var(--charcoal);
    text-align: left;
    font: italic 400 0.95rem/1.55 var(--body);
    transition: max-height 520ms var(--spring), background 280ms ease;
}
.footnote:hover, .footnote.open { max-height: 120px; background: rgba(155, 142, 196, 0.13); }
.footnote sup { color: var(--lavender); font: 700 1rem var(--display); margin-right: 8px; }
.timeline { position: absolute; right: 44px; top: 90px; bottom: 70px; width: 20px; }
.timeline span {
    position: absolute;
    top: 0;
    left: 9px;
    width: 1px;
    height: var(--timeline-progress, 0%);
    background: var(--brass);
    box-shadow: 0 0 10px rgba(184, 150, 62, 0.28);
}
.timeline i {
    position: absolute;
    left: 4px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--vellum);
    border: 1px solid var(--brass);
}
.timeline i:nth-child(2) { top: 0; }
.timeline i:nth-child(3) { top: 33%; }
.timeline i:nth-child(4) { top: 66%; }
.timeline i:nth-child(5) { top: 98%; }
.archive-note { left: auto; right: 7vw; top: 16%; color: var(--walnut); }

.seal-section { background: radial-gradient(ellipse at 50% 42%, rgba(107, 31, 31, 0.30), transparent 28%), var(--espresso); }
.seal-wrap { text-align: center; }
.wax-seal {
    width: min(34vw, 250px);
    height: min(34vw, 250px);
    display: grid;
    place-items: center;
    margin: 0 auto 32px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 36% 30%, rgba(245, 236, 215, 0.18), transparent 12%),
        radial-gradient(circle at 58% 66%, rgba(44, 24, 16, 0.24), transparent 20%),
        radial-gradient(circle, #8B2E2E 0 48%, #6B1F1F 72%);
    box-shadow: inset 0 8px 22px rgba(250, 246, 240, 0.08), inset 0 -16px 32px rgba(44, 24, 16, 0.32), 0 32px 70px rgba(0, 0, 0, 0.30);
    transform: scale(0.3);
}
.wax-seal.in-view { animation: waxSpring 950ms var(--spring) forwards; }
.wax-seal span { color: rgba(245, 236, 215, 0.72); font: italic 700 clamp(3rem, 8vw, 6rem) var(--display); letter-spacing: -0.08em; text-shadow: 0 2px 2px rgba(44, 24, 16, 0.45); }
.closing-line { color: var(--brass); text-align: center; font-family: var(--ui); letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.78rem; }

.reveal-item, .reveal-group { opacity: 0; transform: translateY(20px); transition: opacity 780ms ease-out, transform 780ms var(--spring); }
.reveal-item.in-view, .reveal-group.in-view { opacity: 1; transform: translateY(0); }
.reveal-group .reveal-item:nth-child(2) { transition-delay: 120ms; }
.reveal-group .reveal-item:nth-child(3) { transition-delay: 240ms; }
.reveal-group .reveal-item:nth-child(4) { transition-delay: 360ms; }
.reveal-group .reveal-item:nth-child(5) { transition-delay: 480ms; }

@keyframes drawFlourish { to { stroke-dashoffset: 0; } }
@keyframes sealIn { to { opacity: 1; } }
@keyframes scrollBounce { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -4px); } }
@keyframes dustDrift { to { background-position: 230px -230px, -310px 310px, 410px -410px; } }
@keyframes flame { 0%,100% { transform: translateX(-50%) rotate(7deg) scaleY(1); opacity: 0.84; } 50% { transform: translateX(-45%) rotate(-5deg) scaleY(1.13); opacity: 1; } }
@keyframes pageFade { 0%,100% { opacity: 0; } 20%,70% { opacity: 1; } }
@keyframes pageSweep { to { right: 110vw; } }
@keyframes waxSpring { to { transform: scale(1); } }

@media (max-width: 980px) {
    .viewport-section { padding-left: 92px; padding-right: 28px; }
    .vellum-card, .cabinet-intro, .archive-folio { width: min(82vw, 760px); margin-left: 0; }
    .curiosity-stack { flex-wrap: wrap; }
    .curio-card { width: min(40vw, 320px); margin-top: 0 !important; }
    .marginalia { position: relative; left: auto; top: auto; width: auto; margin-top: 18px; }
    .timeline { display: none; }
}

@media (max-width: 640px) {
    .sidebar { width: 60px; }
    .sidebar:hover { width: 235px; }
    .viewport-section { padding-left: 76px; }
    .curio-card { width: 100%; min-height: auto; }
    .two-column-copy { columns: 1; }
    h2 { font-size: clamp(2.1rem, 12vw, 3.2rem); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
