/* =========================================================
   historical.quest — The Detective's Desk of History
   Palette: #2a2018, #e8dcc0, #b83c3c, #a08060, #3a3020,
            #b8952a, #d4c498, #d4b460, #8a6a20
   Fonts:   Cormorant SC · IM Fell English · Libre Baskerville · Caveat
   ========================================================= */

:root {
    --desk: #2a2018;
    --desk-deep: #1a1208;
    --paper: #e8dcc0;
    --paper-shade: #d4c498;
    --paper-deep: #c4b48c;
    --ink: #3a3020;
    --string: #b83c3c;
    --cork: #a08060;
    --cork-deep: #806040;
    --brass: #b8952a;
    --brass-light: #d4b460;
    --brass-deep: #8a6a20;
    --lamp: rgba(255, 200, 100, 0.30);
    --lamp-soft: rgba(255, 230, 140, 0.10);
    --highlight: rgba(255, 230, 140, 0.4);

    --mx: 50vw;
    --my: 40vh;

    --display: "Cormorant SC", "Cormorant Garamond", Georgia, serif;
    --evidence: "IM Fell English", "Libre Baskerville", Georgia, serif;
    --body: "Libre Baskerville", Georgia, serif;
    --hand: "Caveat", "Bradley Hand", cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--desk);
    color: var(--paper);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
    cursor: none;
}

body {
    background:
        radial-gradient(ellipse at 50% -10%, #3a2c1a 0%, transparent 60%),
        radial-gradient(ellipse at 50% 110%, #1a1208 0%, transparent 60%),
        var(--desk);
    min-height: 100vh;
    position: relative;
}

/* Wood grain texture using SVG-like layered gradients */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        repeating-linear-gradient(
            87deg,
            rgba(0,0,0,0.06) 0px,
            rgba(0,0,0,0.06) 1px,
            transparent 1px,
            transparent 7px
        ),
        repeating-linear-gradient(
            93deg,
            rgba(255,220,180,0.02) 0px,
            rgba(255,220,180,0.02) 1px,
            transparent 1px,
            transparent 11px
        );
    opacity: 0.85;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.18 0'/></filter><rect width='300' height='300' filter='url(%23n)'/></svg>");
    opacity: 0.5;
    mix-blend-mode: overlay;
}

/* ---------- Lamp Spotlight ---------- */
.lamp-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background:
        radial-gradient(
            circle 360px at var(--mx) var(--my),
            rgba(255, 210, 130, 0.28) 0%,
            rgba(255, 200, 100, 0.18) 30%,
            rgba(60, 40, 20, 0.0) 60%,
            rgba(10, 6, 2, 0.55) 100%
        );
    transition: background 60ms linear;
    mix-blend-mode: screen;
}

/* ---------- Magnifier cursor ---------- */
.magnifier {
    position: fixed;
    top: 0; left: 0;
    width: 80px; height: 80px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    transition: transform 50ms linear;
    mix-blend-mode: normal;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
}
.magnifier svg { display: block; }

/* ---------- Masthead ---------- */
.masthead {
    position: relative;
    z-index: 4;
    padding: 28px 6vw 14px;
    border-bottom: 1px solid rgba(212, 196, 152, 0.12);
    background: linear-gradient(180deg, rgba(0,0,0,0.35), transparent);
}
.masthead-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: baseline;
    gap: 14px;
    color: var(--paper);
}
.brand-mark {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: 0.05em;
    color: var(--brass-light);
    border: 1px solid var(--brass-deep);
    padding: 4px 10px;
    background: rgba(184, 149, 42, 0.06);
}
.brand-name {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: var(--paper-shade);
}
.brand-dot { color: var(--string); }

.nav {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}
.nav a {
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--paper-shade);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 3px;
    transition: color 200ms, border-color 200ms;
}
.nav a:hover { color: var(--brass-light); border-color: var(--brass-deep); }

.masthead-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-family: var(--display);
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    color: var(--brass);
}

/* ---------- Section heads ---------- */
.section-head {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 56px;
    padding: 0 24px;
    position: relative;
    z-index: 4;
}
.section-tag {
    display: inline-block;
    font-family: var(--display);
    font-size: 0.78rem;
    letter-spacing: 0.32em;
    color: var(--brass);
    margin-bottom: 16px;
    padding: 4px 14px;
    border: 1px solid var(--brass-deep);
    background: rgba(184, 149, 42, 0.05);
}
.section-title {
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    letter-spacing: 0.04em;
    line-height: 1.1;
    color: var(--paper);
    margin-bottom: 18px;
}
.section-lede {
    font-family: var(--evidence);
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--paper-shade);
    max-width: 560px;
    margin: 0 auto;
}

/* ---------- HERO: The Desk ---------- */
.desk {
    position: relative;
    min-height: 100vh;
    padding: 80px 6vw 120px;
    z-index: 3;
    overflow: hidden;
}

.desk-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            91deg,
            rgba(0,0,0,0.10) 0px,
            rgba(0,0,0,0.10) 1px,
            transparent 1px,
            transparent 9px
        ),
        repeating-linear-gradient(
            89deg,
            rgba(120,80,40,0.05) 0px,
            rgba(120,80,40,0.05) 2px,
            transparent 2px,
            transparent 23px
        );
    opacity: 0.6;
    z-index: -1;
}
.desk-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.5) 100%);
    z-index: -1;
}

.desk-header {
    text-align: center;
    margin-bottom: 80px;
    position: relative;
    z-index: 4;
}
.kicker {
    font-family: var(--hand);
    font-size: 1.5rem;
    color: var(--string);
    transform: rotate(-2deg);
    display: inline-block;
    margin-bottom: 8px;
}
.display-title {
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(2.6rem, 6.5vw, 5.8rem);
    line-height: 0.95;
    letter-spacing: 0.04em;
    color: var(--paper);
    margin-bottom: 24px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.title-line-1, .title-line-2 { display: block; }
.title-line-2 {
    color: var(--brass-light);
    font-style: italic;
    font-family: "Cormorant Garamond", "Cormorant SC", Georgia, serif;
}
.lede {
    font-family: var(--evidence);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--paper-shade);
    max-width: 620px;
    margin: 0 auto;
}

/* Documents scattered on the desk */
.documents {
    position: relative;
    height: clamp(900px, 95vw, 1100px);
    max-width: 1280px;
    margin: 0 auto;
}

.document {
    position: absolute;
    width: clamp(260px, 26vw, 340px);
    background: var(--paper);
    color: var(--ink);
    padding: 26px 24px 22px;
    border-radius: 2px;
    box-shadow:
        2px 3px 8px rgba(0,0,0,0.35),
        4px 8px 24px rgba(0,0,0,0.45),
        inset 0 0 30px rgba(180,140,80,0.08);
    transform: rotate(var(--rot)) translate(0, 0);
    left: var(--x);
    top: var(--y);
    transition: transform 350ms cubic-bezier(.2,.8,.2,1),
                box-shadow 350ms;
    z-index: 5;
}
.document::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.08 0'/></filter><rect width='200' height='200' filter='url(%23p)'/></svg>");
    mix-blend-mode: multiply;
    opacity: 0.5;
    border-radius: 2px;
}
.document::after {
    content: "";
    position: absolute;
    top: -6px; left: 50%;
    width: 60px; height: 14px;
    transform: translateX(-50%) rotate(-3deg);
    background: rgba(212, 196, 152, 0.55);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    border: 1px solid rgba(120,90,50,0.2);
}
.document:hover {
    transform: rotate(0deg) translate(0, -4px) scale(1.04);
    box-shadow:
        4px 6px 14px rgba(0,0,0,0.45),
        8px 14px 38px rgba(0,0,0,0.55);
    z-index: 20;
}
.doc-stamp {
    font-family: var(--display);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--string);
    border: 1.5px solid var(--string);
    padding: 3px 8px;
    display: inline-block;
    margin-bottom: 14px;
    transform: rotate(-2deg);
    opacity: 0.85;
    background: rgba(184, 60, 60, 0.04);
}
.doc-title {
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(1.3rem, 2.1vw, 1.65rem);
    line-height: 1.15;
    letter-spacing: 0.04em;
    color: var(--ink);
    margin-bottom: 12px;
}
.doc-text {
    font-family: var(--evidence);
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--ink);
    margin-bottom: 14px;
}
.doc-meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--display);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: rgba(58, 48, 32, 0.7);
    border-top: 1px solid rgba(58,48,32,0.2);
    padding-top: 10px;
}

/* Annotations (handwritten) */
.annot {
    position: absolute;
    font-family: var(--hand);
    font-size: 1.5rem;
    color: var(--string);
    z-index: 6;
    pointer-events: none;
    text-shadow: 0 1px 0 rgba(255,255,255,0.05);
}
.annot-1 { top: 28%; left: 28%; transform: rotate(-8deg); }
.annot-2 { top: 38%; left: 56%; transform: rotate(4deg); }
.annot-3 { top: 78%; left: 32%; transform: rotate(-3deg); font-size: 1.3rem; }

.ink-spill {
    position: absolute;
    bottom: 4%;
    right: 5%;
    z-index: 4;
    opacity: 0.7;
}

.desk-footer {
    text-align: center;
    margin-top: 60px;
    position: relative;
    z-index: 4;
}
.scroll-hint {
    font-family: var(--hand);
    font-size: 1.3rem;
    color: var(--brass-light);
    opacity: 0.7;
    animation: bob 2.4s ease-in-out infinite;
    display: inline-block;
}
@keyframes bob {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(8px); opacity: 0.9; }
}

/* ---------- BOARD: Cork ---------- */
.board {
    position: relative;
    z-index: 3;
    padding: 100px 6vw 120px;
    background: linear-gradient(180deg, var(--desk) 0%, #1f1812 50%, var(--desk) 100%);
}
.board-frame {
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
}
.board-frame-inner {
    background: linear-gradient(135deg, #4a3220 0%, #3a2818 50%, #2a1c10 100%);
    padding: 18px;
    border-radius: 4px;
    box-shadow:
        0 0 0 2px #1a1008,
        0 0 0 8px #5a3c20,
        0 0 0 10px #1a1008,
        0 30px 60px rgba(0,0,0,0.6),
        inset 0 0 50px rgba(0,0,0,0.4);
    position: relative;
}
.board-frame-inner::before,
.board-frame-inner::after {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brass-light), var(--brass-deep));
    box-shadow: 0 1px 2px rgba(0,0,0,0.6);
    z-index: 5;
}
.board-frame-inner::before { top: 14px; left: 14px; }
.board-frame-inner::after { top: 14px; right: 14px; }

.cork {
    position: relative;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(180,140,90,0.4), transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(120,80,40,0.4), transparent 60%),
        var(--cork);
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='c'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' seed='4'/><feColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.4 0 0 0 0 0.25 0 0 0 0.55 0'/></filter><rect width='200' height='200' filter='url(%23c)'/></svg>"),
        radial-gradient(ellipse at 30% 30%, rgba(180,140,90,0.4), transparent 60%),
        var(--cork);
    background-blend-mode: multiply, normal, normal;
    height: clamp(620px, 70vw, 780px);
    box-shadow:
        inset 0 0 80px rgba(80,50,20,0.6),
        inset 0 0 0 2px rgba(40,25,10,0.5);
    overflow: hidden;
    padding: 60px 80px 60px;
    border-radius: 2px;
}

.cork .section-head {
    margin-bottom: 40px;
    color: var(--paper);
}
.cork .section-tag { background: rgba(0,0,0,0.25); color: var(--brass-light); border-color: var(--brass-deep); }
.cork .section-title { color: var(--paper); text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.cork .section-lede { color: var(--paper-shade); }

.strings {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}
.string {
    stroke: var(--string);
    stroke-width: 1.6;
    stroke-linecap: round;
    fill: none;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawString 2.4s ease-out forwards;
}
.string:nth-child(2) { animation-delay: 0.3s; }
.string:nth-child(3) { animation-delay: 0.6s; }
.string:nth-child(4) { animation-delay: 0.9s; }
.string:nth-child(5) { animation-delay: 1.2s; }
.string:nth-child(6) { animation-delay: 1.5s; }
@keyframes drawString { to { stroke-dashoffset: 0; } }

/* Evidence cards on cork board */
.evidence {
    position: absolute;
    width: clamp(180px, 18vw, 240px);
    background: var(--paper);
    color: var(--ink);
    padding: 30px 18px 16px;
    border-radius: 2px;
    box-shadow:
        2px 3px 8px rgba(0,0,0,0.35),
        4px 6px 18px rgba(0,0,0,0.45);
    transform: rotate(var(--rot));
    z-index: 4;
    transition: transform 300ms cubic-bezier(.2,.8,.2,1), z-index 0s 300ms;
}
.evidence::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='e'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='2'/><feColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.08 0'/></filter><rect width='200' height='200' filter='url(%23e)'/></svg>");
    mix-blend-mode: multiply;
    opacity: 0.45;
    border-radius: 2px;
}
.evidence:hover {
    transform: rotate(0deg) scale(1.05);
    z-index: 10;
    transition: transform 300ms cubic-bezier(.2,.8,.2,1), z-index 0s 0s;
}

.pin {
    position: absolute;
    top: 8px; left: 50%;
    width: 14px; height: 14px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brass-light), var(--brass-deep));
    box-shadow:
        0 1px 2px rgba(0,0,0,0.6),
        inset 0 -1px 2px rgba(0,0,0,0.4),
        inset 0 1px 1px rgba(255,255,255,0.3);
    z-index: 2;
}
.pin::after {
    content: "";
    position: absolute;
    top: 100%; left: 50%;
    width: 1px; height: 4px;
    background: rgba(0,0,0,0.4);
    transform: translateX(-50%);
}

.ev-label {
    display: block;
    font-family: var(--display);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--string);
    margin-bottom: 8px;
    text-align: center;
}
.ev-body {
    font-family: var(--evidence);
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--ink);
    margin-bottom: 12px;
}
.ev-stamp {
    display: block;
    font-family: var(--display);
    font-size: 0.6rem;
    letter-spacing: 0.25em;
    color: rgba(58,48,32,0.5);
    border-top: 1px dashed rgba(58,48,32,0.25);
    padding-top: 6px;
    text-align: right;
}

/* Evidence positions - broken grid */
.ev-1 { top: 12%; left: 12%; }
.ev-2 { top: 22%; left: 44%; }
.ev-3 { top: 14%; left: 74%; }
.ev-4 { top: 56%; left: 22%; }
.ev-5 { top: 60%; left: 56%; }
.ev-6 { top: 48%; left: 78%; }

.cork-tag {
    position: absolute;
    bottom: 24px;
    right: 80px;
    font-family: var(--hand);
    font-size: 1.4rem;
    color: var(--paper);
    transform: rotate(-3deg);
    z-index: 5;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* ---------- FLOW: Investigation steps ---------- */
.flow {
    position: relative;
    z-index: 3;
    padding: 120px 6vw 140px;
    background: var(--desk);
}
.flow-head { margin-bottom: 80px; }

.flow-steps {
    list-style: none;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
}
.flow-steps::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 1px;
    background: linear-gradient(180deg,
        transparent,
        rgba(184, 149, 42, 0.4) 10%,
        rgba(184, 149, 42, 0.4) 90%,
        transparent);
    transform: translateX(-50%);
}

.step {
    position: relative;
    margin-bottom: 60px;
    opacity: 0;
    transition: opacity 800ms ease-out, transform 800ms cubic-bezier(.2,.8,.2,1);
    will-change: transform, opacity;
}
.step[data-side="left"]  { transform: translateX(-80px); }
.step[data-side="right"] { transform: translateX(80px); }
.step.in-view {
    opacity: 1;
    transform: translateX(0);
}

.step-panel {
    width: 48%;
    background: var(--paper);
    color: var(--ink);
    padding: 36px 38px 32px;
    border-radius: 2px;
    box-shadow:
        3px 4px 12px rgba(0,0,0,0.35),
        6px 10px 30px rgba(0,0,0,0.45);
    position: relative;
}
.step-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='s'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.08 0'/></filter><rect width='200' height='200' filter='url(%23s)'/></svg>");
    mix-blend-mode: multiply;
    opacity: 0.4;
    border-radius: 2px;
}
.step-panel::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brass-light), var(--brass-deep));
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    z-index: 2;
}

.step[data-side="left"] .step-panel { margin-right: auto; }
.step[data-side="right"] .step-panel { margin-left: auto; }

.step[data-side="left"] .step-panel::after  { right: -52px; transform: translateY(-50%); }
.step[data-side="right"] .step-panel::after { left:  -52px; transform: translateY(-50%); }

.step-num {
    font-family: var(--display);
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--string);
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: 0.04em;
}
.step-title {
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(1.5rem, 2.4vw, 1.9rem);
    letter-spacing: 0.04em;
    color: var(--ink);
    margin-bottom: 14px;
}
.step-text {
    font-family: var(--body);
    font-size: 0.98rem;
    line-height: 1.75;
    color: var(--ink);
    margin-bottom: 16px;
}
.step-margin {
    font-family: var(--hand);
    font-size: 1.25rem;
    color: var(--string);
    transform: rotate(-1deg);
    margin-top: 8px;
}

/* ---------- ARCHIVE: Filing drawer ---------- */
.archive {
    position: relative;
    z-index: 3;
    padding: 120px 6vw 140px;
    background: linear-gradient(180deg, var(--desk) 0%, #1c1410 100%);
}
.archive-head { margin-bottom: 60px; }

.drawer {
    max-width: 1280px;
    margin: 0 auto;
    background:
        linear-gradient(180deg, #6a4a26 0%, #503418 100%);
    border-radius: 4px;
    padding: 30px 36px 40px;
    box-shadow:
        0 0 0 2px #2a1a0a,
        0 0 0 6px #4a3018,
        0 0 0 8px #1a1008,
        0 30px 80px rgba(0,0,0,0.6),
        inset 0 0 30px rgba(0,0,0,0.3);
    position: relative;
}

.drawer-rail {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(0,0,0,0.4);
}
.rail-screw {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--paper-shade), var(--brass-deep));
    box-shadow: inset 0 -1px 1px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
    position: relative;
}
.rail-screw::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 8px; height: 1px;
    background: rgba(0,0,0,0.6);
    transform: translate(-50%, -50%) rotate(45deg);
}
.rail-handle {
    width: 180px;
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(180deg, var(--brass-light), var(--brass-deep));
    box-shadow:
        inset 0 -2px 2px rgba(0,0,0,0.4),
        inset 0 1px 1px rgba(255,255,255,0.3),
        0 2px 4px rgba(0,0,0,0.5);
}

.tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 32px;
}
.tab {
    font-family: var(--display);
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    color: var(--ink);
    background: var(--paper-shade);
    border: none;
    padding: 12px 24px 10px;
    cursor: none;
    clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 -2px 4px rgba(0,0,0,0.15);
    transform: translateY(0);
    transition: transform 200ms, background 200ms;
    font-weight: 600;
}
.tab:hover {
    transform: translateY(-3px);
    background: var(--paper);
}
.tab.active {
    background: var(--paper);
    color: var(--string);
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5), inset 0 -2px 4px rgba(0,0,0,0.1);
}

.catalog {
    background: var(--paper);
    padding: 30px 30px 20px;
    border-radius: 2px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
    position: relative;
}
.catalog::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='cat'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='8'/><feColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.06 0'/></filter><rect width='200' height='200' filter='url(%23cat)'/></svg>");
    mix-blend-mode: multiply;
    opacity: 0.5;
    border-radius: 2px;
}

.card-entry {
    display: grid;
    grid-template-columns: 110px 1fr 130px;
    gap: 22px;
    align-items: start;
    padding: 18px 4px;
    border-bottom: 1px dashed rgba(58,48,32,0.3);
    color: var(--ink);
    transition: background 200ms, transform 200ms;
    position: relative;
    z-index: 2;
}
.card-entry:last-child { border-bottom: none; }
.card-entry:hover {
    background: var(--highlight);
    transform: translateX(4px);
}

.card-entry.hidden { display: none; }

.card-index {
    font-family: var(--display);
    font-size: 0.82rem;
    letter-spacing: 0.22em;
    color: var(--string);
    border-right: 1px solid rgba(58,48,32,0.3);
    padding-right: 18px;
    text-align: right;
    padding-top: 4px;
}

.card-body h4 {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: 0.04em;
    color: var(--ink);
    margin-bottom: 8px;
}
.card-body p {
    font-family: var(--evidence);
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--ink);
}

.card-tag {
    font-family: var(--display);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: rgba(58,48,32,0.65);
    text-align: right;
    padding-top: 4px;
}

.drawer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    font-family: var(--display);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    color: rgba(232,220,192,0.55);
}

/* ---------- COLOPHON ---------- */
.colophon {
    position: relative;
    z-index: 3;
    padding: 120px 6vw 100px;
    background: var(--desk-deep);
    text-align: center;
}
.colophon-inner {
    max-width: 760px;
    margin: 0 auto;
}
.quote {
    font-family: "Cormorant Garamond", "Cormorant SC", Georgia, serif;
    font-style: italic;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    line-height: 1.5;
    color: var(--paper);
    margin-bottom: 14px;
}
.quote-cite {
    font-family: var(--display);
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    color: var(--brass);
    margin-bottom: 36px;
}
.rule {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(184,149,42,0.5), transparent);
    margin: 0 auto 36px;
    max-width: 200px;
}
.colophon-text {
    font-family: var(--evidence);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--paper-shade);
    margin-bottom: 36px;
}
.colophon-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    font-family: var(--display);
    font-size: 0.72rem;
    letter-spacing: 0.25em;
    color: rgba(212,196,152,0.5);
    border-top: 1px solid rgba(212,196,152,0.15);
    padding-top: 22px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    html, body { cursor: auto; }
    .magnifier { display: none; }

    .documents {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    .document {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: 480px;
        margin: 0 auto;
    }
    .annot, .ink-spill { display: none; }

    .cork {
        height: auto;
        padding: 40px 30px;
    }
    .cork .strings { display: none; }
    .evidence {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: 360px;
        margin: 16px auto;
    }
    .cork-tag { position: relative; bottom: auto; right: auto; display: block; text-align: center; margin-top: 24px; }

    .step-panel { width: 100%; }
    .flow-steps::before { left: 8px; }
    .step[data-side="left"] .step-panel::after,
    .step[data-side="right"] .step-panel::after { display: none; }

    .card-entry {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .card-index, .card-tag { text-align: left; border: none; padding: 0; }
}

@media (max-width: 600px) {
    .masthead-inner { gap: 12px; }
    .masthead-meta { display: none; }
    .nav { gap: 14px; }
    .nav a { font-size: 0.7rem; letter-spacing: 0.16em; }
    .desk { padding: 60px 5vw 80px; }
}
