:root {
    --ink: #080A0F;
    --vellum: #EFE6D1;
    --copper: #B66A3C;
    --lilac: #B9A7C9;
    --verdigris: #2F6F68;
    --ultra: #102A43;
    --carmine: #8F2238;
    --serif-title: "Cormorant Garamond", serif;
    --serif-body: "Source Serif 4", serif;
    --condensed: "IBM Plex Sans Condensed", sans-serif;
    --mono: "Azeret Mono", monospace;
}

/* Compliance vocabulary: scholarly tone Condensed** Condensed* labels 4** 4* longer notes narrative fragments because reads becoming legalistic. Optional micro-labels can sparingly numbers */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--vellum);
    background:
        radial-gradient(circle at 74% 18%, rgba(185, 167, 201, 0.15), transparent 28rem),
        radial-gradient(circle at 12% 72%, rgba(47, 111, 104, 0.22), transparent 34rem),
        linear-gradient(115deg, #080A0F 0%, #102A43 54%, #080A0F 100%);
    font-family: var(--serif-body);
    overflow-x: hidden;
}

.grain {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0.24;
    mix-blend-mode: screen;
    background-image:
        repeating-radial-gradient(circle at 12% 18%, rgba(239, 230, 209, 0.13) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(98deg, rgba(185, 167, 201, 0.08) 0 1px, transparent 1px 13px);
}

.loupe {
    position: fixed;
    width: 13.5rem;
    height: 13.5rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(239, 230, 209, 0.46);
    border-radius: 50%;
    z-index: 8;
    pointer-events: none;
    box-shadow: inset 0 0 2rem rgba(239, 230, 209, 0.16), 0 0 4rem rgba(185, 167, 201, 0.16), 0 0 0 999rem rgba(8, 10, 15, 0.05);
    background: radial-gradient(circle at 45% 38%, rgba(239, 230, 209, 0.12), rgba(185, 167, 201, 0.035) 48%, transparent 70%);
    backdrop-filter: blur(1.5px) contrast(1.16) saturate(1.2);
    transition: width 500ms ease, height 500ms ease;
}

.loupe span {
    position: absolute;
    inset: 1.4rem;
    border-radius: 50%;
    border: 1px dashed rgba(182, 106, 60, 0.54);
}

.archive-rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6.7rem;
    z-index: 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.1rem 0.7rem;
    border-right: 1px solid rgba(239, 230, 209, 0.14);
    background: linear-gradient(180deg, rgba(8, 10, 15, 0.82), rgba(16, 42, 67, 0.52));
}

.rail-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: var(--condensed);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.82rem;
    color: rgba(239, 230, 209, 0.74);
    margin-bottom: 1.5rem;
}

.chapter-tabs {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.chapter-tabs a {
    color: rgba(239, 230, 209, 0.58);
    text-decoration: none;
    font-family: var(--condensed);
    font-size: 0.72rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    padding: 0.18rem 0.28rem;
    border-left: 2px solid transparent;
    transition: color 240ms ease, border-color 240ms ease, transform 240ms ease;
}

.chapter-tabs a.active {
    color: #EFE6D1;
    border-color: #B66A3C;
    transform: translateX(0.25rem);
}

.cabinet { position: relative; }

.scene {
    min-height: 100vh;
    position: relative;
    padding: 7vh 7vw 7vh 11vw;
    display: grid;
    align-items: center;
    overflow: hidden;
    isolation: isolate;
}

.scene::before {
    content: attr(data-ink);
    position: absolute;
    left: 12vw;
    bottom: 8vh;
    font-family: var(--condensed);
    text-transform: uppercase;
    letter-spacing: 0.28em;
    color: rgba(185, 167, 201, 0.16);
    font-size: clamp(1.8rem, 7vw, 9rem);
    line-height: 0.8;
    z-index: -1;
    filter: blur(0.2px);
}

.tray {
    position: relative;
    min-height: 70vh;
    border: 1px solid rgba(239, 230, 209, 0.16);
    background:
        linear-gradient(90deg, rgba(239, 230, 209, 0.05), transparent 15%, rgba(185, 167, 201, 0.04) 50%, transparent 85%),
        linear-gradient(180deg, rgba(8, 10, 15, 0.12), rgba(16, 42, 67, 0.34));
    box-shadow: inset 0 0 4rem rgba(8, 10, 15, 0.5), 0 2rem 6rem rgba(0, 0, 0, 0.35);
    transform: translateX(var(--tray-shift, 0px));
    transition: transform 140ms linear;
}

.tray::after {
    content: "";
    position: absolute;
    inset: 1.2rem;
    border: 1px solid rgba(47, 111, 104, 0.22);
    background-image: linear-gradient(rgba(47, 111, 104, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(47, 111, 104, 0.10) 1px, transparent 1px);
    background-size: 100% 2.25rem, 4rem 100%;
    pointer-events: none;
}

.vellum-sheet,
.artifact {
    background:
        radial-gradient(circle at 25% 18%, rgba(185, 167, 201, 0.20), transparent 15rem),
        repeating-linear-gradient(91deg, rgba(47, 111, 104, 0.09) 0 1px, transparent 1px 3.8rem),
        linear-gradient(135deg, rgba(239, 230, 209, 0.94), rgba(239, 230, 209, 0.72));
    color: #080A0F;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.34), inset 0 0 4rem rgba(182, 106, 60, 0.08);
}

.hero-sheet {
    position: absolute;
    width: min(74vw, 65rem);
    min-height: 62vh;
    left: 14%;
    top: 11%;
    padding: clamp(2rem, 5vw, 4.8rem);
    transform: rotate(-2.2deg);
    clip-path: polygon(0 0, 97% 0, 100% 7%, 98% 100%, 5% 98%, 0 92%);
}

.specimen-label,
.accession,
.museum-tag,
.folio {
    font-family: var(--condensed);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 600;
}

.specimen-label {
    position: absolute;
    left: 2rem;
    top: 2rem;
    color: rgba(239, 230, 209, 0.76);
    z-index: 2;
}

.accession { color: #2F6F68; font-size: 0.84rem; }

h1, h2 {
    margin: 0;
    font-family: var(--serif-title);
    font-weight: 500;
    letter-spacing: -0.045em;
}

h1 {
    margin-top: 7vh;
    font-size: clamp(4.7rem, 13vw, 14rem);
    line-height: 0.76;
    color: #102A43;
    text-shadow: 0.06em 0.04em 0 rgba(185, 167, 201, 0.28);
}

.question {
    margin: 1.3rem 0 0;
    font-size: clamp(1.35rem, 2.7vw, 3rem);
    font-family: var(--serif-body);
    color: #8F2238;
    font-style: italic;
}

.route-map {
    position: absolute;
    inset: 14% 6% 8%;
    width: 88%;
    height: 74%;
    pointer-events: none;
    mix-blend-mode: multiply;
}

.route-map path,
.clearing-house path,
.gift-loop path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.route-map path {
    stroke: #2F6F68;
    stroke-width: 2.2;
    stroke-dasharray: 8 18;
    opacity: calc(0.15 + var(--ink-opacity, 0) * 0.85);
    stroke-dashoffset: var(--ink-offset, 0);
}

.ink-ledger {
    position: absolute;
    bottom: 1.6rem;
    left: 3rem;
    right: 3rem;
    display: flex;
    justify-content: space-between;
    color: rgba(16, 42, 67, 0.68);
    font-family: var(--condensed);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.carbon-ghost {
    position: absolute;
    font-family: var(--mono);
    letter-spacing: 0.2em;
    color: rgba(185, 167, 201, 0.22);
    border: 1px solid rgba(185, 167, 201, 0.16);
    padding: 1rem;
}

.ghost-one { right: 10%; bottom: 18%; transform: rotate(5deg); }
.ghost-two { left: 20%; bottom: 10%; transform: rotate(-3deg); }

.annotation {
    position: absolute;
    z-index: 4;
    width: min(26rem, 32vw);
    top: 13vh;
    padding: 1.2rem 1.4rem;
    background: rgba(8, 10, 15, 0.52);
    border: 1px solid rgba(239, 230, 209, 0.14);
    backdrop-filter: blur(8px);
}

.annotation.left { left: 11vw; }
.annotation.right { right: 7vw; }
.folio { color: #B66A3C; font-size: 0.82rem; }
.annotation h2 { font-size: clamp(3.6rem, 7vw, 8rem); line-height: 0.82; color: #EFE6D1; margin: 0.6rem 0 1rem; }
.annotation p { margin: 0; color: rgba(239, 230, 209, 0.78); font-size: clamp(1rem, 1.35vw, 1.38rem); line-height: 1.45; }

.chapter .tray { width: min(78rem, 80vw); justify-self: end; }
.chapter:nth-of-type(odd) .tray { justify-self: start; margin-left: 15vw; }

.tally-stick {
    position: absolute;
    left: 52%;
    top: 8%;
    width: 7.5rem;
    height: 78%;
    border-radius: 4rem;
    transform: rotate(3deg);
    background: linear-gradient(90deg, #EFE6D1, rgba(239, 230, 209, 0.70), #B9A7C9);
}

.tally-stick i {
    position: absolute;
    left: -0.7rem;
    width: 4.4rem;
    height: 0.65rem;
    background: #8F2238;
    transform: rotate(-18deg);
    box-shadow: 4.6rem 0 0 rgba(143, 34, 56, 0.62);
}
.tally-stick i:nth-child(1) { top: 8%; } .tally-stick i:nth-child(2) { top: 18%; } .tally-stick i:nth-child(3) { top: 29%; } .tally-stick i:nth-child(4) { top: 40%; } .tally-stick i:nth-child(5) { top: 51%; } .tally-stick i:nth-child(6) { top: 62%; } .tally-stick i:nth-child(7) { top: 72%; } .tally-stick i:nth-child(8) { top: 82%; } .tally-stick i:nth-child(9) { top: 91%; }

.museum-tag {
    position: absolute;
    right: 8%;
    bottom: 12%;
    color: #102A43;
    background: #EFE6D1;
    padding: 0.8rem 1rem;
    transform: rotate(-4deg);
}

.fiber-field {
    position: absolute;
    inset: 12% 10%;
    background-image: repeating-linear-gradient(27deg, transparent 0 2.2rem, rgba(185, 167, 201, 0.18) 2.2rem 2.3rem), repeating-linear-gradient(153deg, transparent 0 3rem, rgba(182, 106, 60, 0.12) 3rem 3.07rem);
}

.promissory {
    position: absolute;
    width: 50vw;
    height: 58vh;
    left: 12%;
    top: 14%;
    padding: 3rem;
    transform: perspective(900px) rotateY(var(--fold, -7deg)) rotateZ(2deg);
    transform-origin: left center;
}
.fold { position: absolute; inset: 0 0 auto 0; height: 28%; background: linear-gradient(180deg, rgba(16, 42, 67, 0.13), transparent); transform-origin: top; transform: rotateX(42deg); }
.note-lines { height: 60%; background-image: repeating-linear-gradient(180deg, transparent 0 2.4rem, rgba(47, 111, 104, 0.42) 2.4rem 2.48rem); }
.wax-seal, .stamp { display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, #8F2238, #6b1428); color: #EFE6D1; font-family: var(--condensed); font-weight: 700; letter-spacing: 0.12em; }
.wax-seal { position: absolute; right: 12%; bottom: 12%; width: 7rem; height: 7rem; box-shadow: inset 0 0 1rem rgba(0,0,0,0.4); }
.promissory p { width: 55%; font-size: 1.3rem; color: #102A43; }
.transparent-envelope { position: absolute; inset: 20% 8% 10% 30%; border: 1px solid rgba(185, 167, 201, 0.46); background: rgba(185, 167, 201, 0.08); transform: rotate(-5deg); }

.ledger-page { position: absolute; width: 63vw; height: 68vh; right: 6%; top: 9%; padding: 2.2rem; transform: rotate(var(--ledger-rotate, -1deg)); }
.ledger-head, .ledger-grid { display: grid; grid-template-columns: 1fr 5rem 1fr 5rem; gap: 0.6rem 1rem; font-family: var(--condensed); text-transform: uppercase; letter-spacing: 0.1em; }
.ledger-head { color: #8F2238; font-size: 1.2rem; grid-template-columns: 1fr 1fr; border-bottom: 2px solid #2F6F68; padding-bottom: 0.6rem; }
.ledger-grid { margin-top: 1.4rem; color: #102A43; font-size: 1.05rem; line-height: 2.4; }
.ledger-grid b { color: #B66A3C; font-family: var(--mono); }
.medallion { position: absolute; left: 10%; bottom: 9%; width: 16rem; height: 16rem; border-radius: 50%; opacity: 0.48; background: repeating-radial-gradient(circle, transparent 0 0.45rem, #B9A7C9 0.48rem 0.52rem), conic-gradient(from 20deg, transparent, rgba(47, 111, 104, 0.4), transparent, rgba(143, 34, 56, 0.35), transparent); }

.clearing-house { position: absolute; inset: 10%; background: rgba(239, 230, 209, 0.08); border: 1px solid rgba(239, 230, 209, 0.28); }
.clearing-house svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.clearing-house path { stroke: #2F6F68; stroke-width: 3; stroke-dasharray: 9 13; animation: movePath 6s linear infinite; }
.node { position: absolute; width: 4.5rem; height: 4.5rem; display: grid; place-items: center; border-radius: 50%; background: #EFE6D1; color: #102A43; border: 0.45rem solid #B66A3C; font-family: var(--condensed); font-weight: 700; }
.n1 { left: 7%; top: 14%; } .n2 { right: 7%; top: 19%; } .n3 { left: 14%; bottom: 12%; } .n4 { right: 15%; bottom: 9%; } .n5 { left: 44%; top: 40%; }
.stamp { position: absolute; right: 12%; bottom: 18%; width: 10rem; height: 10rem; transform: rotate(-14deg); opacity: 0.78; }

.gift-loop { position: absolute; width: 55vw; height: 62vh; left: 17%; top: 12%; background: transparent; box-shadow: none; }
.gift-loop svg { width: 100%; height: 100%; }
.gift-loop .loop { stroke: #B66A3C; stroke-width: 9; stroke-dasharray: 24 18; animation: movePath 9s linear infinite; }
.gift-loop .unclosed { stroke: #8F2238; stroke-width: 7; }
.token { position: absolute; width: 5rem; height: 5rem; border-radius: 50%; background: radial-gradient(circle at 35% 32%, #EFE6D1, #B66A3C 60%, #8F2238); box-shadow: 0 0 2rem rgba(182, 106, 60, 0.38); }
.token-a { left: 16%; top: 23%; } .token-b { right: 18%; top: 34%; } .token-c { left: 44%; bottom: 8%; }

.receipt-strip { position: absolute; width: 24rem; min-height: 74vh; left: 50%; top: 5%; transform: translateX(-50%); padding: 3rem 2rem; }
.receipt-strip span { display: block; color: #8F2238; font-family: var(--condensed); font-size: 2.2rem; letter-spacing: 0.1em; text-align: center; }
.receipt-strip b { display: block; margin-top: 2rem; color: #102A43; font-family: var(--mono); font-size: 0.88rem; font-weight: 400; }
.perforation { position: absolute; top: 0; left: 0; right: 0; height: 1.2rem; background: radial-gradient(circle, #080A0F 0 0.32rem, transparent 0.34rem) 0 0 / 1.2rem 1.2rem; }
.barcode { height: 7rem; margin-top: 4rem; background: repeating-linear-gradient(90deg, #102A43 0 0.2rem, transparent 0.2rem 0.45rem, #102A43 0.45rem 0.9rem, transparent 0.9rem 1.2rem); opacity: 0.68; }
.receipt-shadow { position: absolute; width: 24rem; height: 74vh; left: 50%; top: 8%; border: 1px solid rgba(185, 167, 201, 0.25); background: rgba(185, 167, 201, 0.07); }
.s1 { transform: translateX(-46%) rotate(3deg); } .s2 { transform: translateX(-54%) rotate(-4deg); }

.stamp-field { position: absolute; inset: 8% 8% 8% 18%; background: rgba(239, 230, 209, 0.14); color: #EFE6D1; box-shadow: none; }
.residue-stamp { position: absolute; border: 0.32rem solid #8F2238; color: #8F2238; font-family: var(--condensed); font-size: clamp(2.5rem, 6vw, 6rem); font-weight: 700; letter-spacing: 0.12em; padding: 0.3rem 1rem; opacity: 0.32; mix-blend-mode: screen; }
.r1 { left: 8%; top: 12%; transform: rotate(-9deg); } .r2 { right: 8%; top: 21%; transform: rotate(13deg); } .r3 { left: 31%; top: 43%; transform: rotate(-2deg); } .r4 { right: 18%; bottom: 12%; transform: rotate(-16deg); } .r5 { left: 9%; bottom: 10%; transform: rotate(8deg); }
.watermark { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(185, 167, 201, 0.22); font-family: var(--serif-title); font-size: clamp(5rem, 16vw, 17rem); }

@keyframes movePath { to { stroke-dashoffset: -220; } }

@media (max-width: 820px) {
    .archive-rail { width: 100%; height: 4.5rem; bottom: auto; flex-direction: row; overflow: hidden; }
    .rail-title { writing-mode: initial; transform: none; margin: 0 1rem 0 0; white-space: nowrap; }
    .chapter-tabs { flex-direction: row; margin: 0; overflow: auto; }
    .scene { padding: 7rem 1rem 4rem; }
    .loupe { width: 9rem; height: 9rem; }
    .annotation, .annotation.left, .annotation.right { position: relative; width: auto; inset: auto; margin-bottom: 1rem; }
    .chapter .tray, .chapter:nth-of-type(odd) .tray { width: 100%; margin: 0; justify-self: stretch; }
    .hero-sheet { width: 92%; left: 4%; }
    h1 { font-size: 4.6rem; }
    .promissory, .ledger-page, .gift-loop { width: 84vw; left: 6%; right: auto; }
}
