/* =============================================================
   footprint.markets — A Cartographer's Reading Room
   Eight plates of an atlas. Vellum substrate, iron-gall ink.
   ============================================================= */

:root {
    --vellum-cream: #F2EAD6;
    --iron-gall: #1A1611;
    --cinnabar-red: #7A2418;
    --hunter-thalo: #3D5240;
    --sand-buff: #C8B68F;
    --bistre-shade: #5A4A2E;

    --rail-w: 72px;
    --right-gutter: 88px;

    --measure: 52ch;

    --font-display: "IM Fell English", "Cormorant Garamond", Georgia, serif;
    --font-serif:   "Cormorant Garamond", Georgia, serif;
    --font-mono:    "JetBrains Mono", ui-monospace, Menlo, monospace;
    --font-kicker:  "Caudex", "Cormorant Garamond", serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--vellum-cream);
    color: var(--iron-gall);
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.6;
    text-rendering: geometricPrecision;
    font-feature-settings: "liga", "dlig", "kern";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    /* Vellum substrate: cream + faint graticule + faint noise */
    background-color: var(--vellum-cream);
    background-image:
        /* iron-gall graticule, 8x8 squares at 4% opacity, deliberately mis-aligned */
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><path d='M8 0 L0 0 L0 8' fill='none' stroke='%231A1611' stroke-width='0.25' opacity='0.18'/></svg>"),
        /* faint noise-like spots from a turbulence-derived pattern */
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.10  0 0 0 0 0.08  0 0 0 0 0.06  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 8px 8px, 320px 320px;
    background-position: 3px 1px, 0 0;
    background-attachment: fixed, fixed;
}

/* Selection in cinnabar */
::selection { background: rgba(122, 36, 24, 0.18); color: var(--iron-gall); }

/* =====================================================
   LEFT RAIL
   ===================================================== */

.rail {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--rail-w);
    height: 100vh;
    border-right: 0.6px solid rgba(26, 22, 17, 0.6);
    background: transparent;
    z-index: 50;
    display: flex;
    align-items: stretch;
}

.rail-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 18px 6px 18px;
    gap: 18px;
}

.rail-mark {
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--iron-gall);
    border-bottom: 0.5px solid rgba(26, 22, 17, 0.4);
    padding-bottom: 12px;
    width: 80%;
    text-align: center;
}

.mini-map {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.mm-cell {
    text-decoration: none;
    color: var(--iron-gall);
    width: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 0;
    border: 0.5px solid rgba(26, 22, 17, 0.18);
    background: transparent;
    transition: border-color 200ms ease, background-color 200ms ease;
}

.mm-cell:hover { border-color: rgba(26, 22, 17, 0.55); }

.mm-num {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    color: var(--iron-gall);
}

.mm-bar {
    display: block;
    width: 30px;
    height: 6px;
    border: 0.5px solid rgba(26, 22, 17, 0.45);
    background: transparent;
    position: relative;
    overflow: hidden;
}

.mm-cell.active .mm-bar {
    background-image: repeating-linear-gradient(
        45deg,
        var(--hunter-thalo) 0,
        var(--hunter-thalo) 1px,
        transparent 1px,
        transparent 3px
    );
    background-size: 8px 8px;
    background-position: 0 0;
    animation: hatchTremor 1.4s steps(2, jump-end) infinite;
    border-color: var(--iron-gall);
}

.mm-cell.active {
    border-color: var(--cinnabar-red);
    border-width: 0.8px;
}

@keyframes hatchTremor {
    0%   { background-position: 0 0; }
    50%  { background-position: 1px 0; }
    100% { background-position: 0 0; }
}

.rail-readout {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 0.5px solid rgba(26, 22, 17, 0.3);
    border-bottom: 0.5px solid rgba(26, 22, 17, 0.3);
    padding: 8px 4px;
}

.ro-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 8.4px;
    letter-spacing: 0.06em;
    color: var(--iron-gall);
}

.ro-k { opacity: 0.55; }
.ro-v { font-weight: 500; }

.rail-inkpot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ink-label {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.16em;
    color: var(--iron-gall);
    opacity: 0.65;
}

/* =====================================================
   PAGE / ATLAS LAYOUT
   ===================================================== */

.atlas {
    margin-left: var(--rail-w);
    margin-right: var(--right-gutter);
    position: relative;
    border-left: 0.4px solid rgba(26, 22, 17, 0.18);
}

/* =====================================================
   PLATES — common
   ===================================================== */

.plate {
    position: relative;
    min-height: 100vh;
    padding: 80px clamp(28px, 6vw, 96px) 96px;
    border-bottom: 0.5px solid rgba(26, 22, 17, 0.55);
    isolation: isolate;
}

.plate-frame {
    position: relative;
    z-index: 2;
    max-width: 1140px;
    margin: 0 auto;
}

.kicker {
    font-family: var(--font-kicker);
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(26, 22, 17, 0.62);
    margin-bottom: 18px;
}

.plate-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.6rem, 5.4vw, 4.8rem);
    line-height: 1.05;
    letter-spacing: 0.02em;
    margin: 0 0 26px;
    color: var(--iron-gall);
    font-feature-settings: "liga", "dlig", "hist";
}

.plate-deck {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.18rem;
    line-height: 1.55;
    max-width: 56ch;
    color: var(--iron-gall);
    margin: 0 0 40px;
    font-feature-settings: "swsh", "liga";
}

.plate-sig {
    position: absolute;
    right: 28px;
    bottom: 22px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    color: rgba(26, 22, 17, 0.7);
    z-index: 5;
}

/* Hairline rule around current scroll-target plate */
.plate.current::after {
    content: "";
    position: absolute;
    inset: 16px;
    border: 0.5px solid var(--cinnabar-red);
    pointer-events: none;
    opacity: 0.55;
    z-index: 1;
}

/* =====================================================
   PL. I — Cover Sheet
   ===================================================== */

.plate-i {
    min-height: 130vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.plate-i .kicker {
    text-align: center;
    margin-bottom: 36px;
}

.masthead {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(3.6rem, 8.2vw, 7.8rem);
    line-height: 1.0;
    letter-spacing: 0.02em;
    margin: 0 auto 50px;
    text-align: center;
    color: var(--iron-gall);
    font-feature-settings: "liga", "dlig", "hist";
}

.cover-quote {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.18rem, 2vw, 1.45rem);
    line-height: 1.5;
    text-align: center;
    max-width: 38ch;
    margin: 0 auto 60px;
    color: var(--iron-gall);
    background-image: radial-gradient(ellipse at center, rgba(200, 182, 143, 0.22), transparent 70%);
    padding: 24px 12px;
}

.cover-rose {
    position: absolute;
    left: clamp(40px, 6vw, 100px);
    bottom: clamp(60px, 8vh, 120px);
    width: clamp(140px, 18vw, 220px);
    opacity: 0.42;
    z-index: 1;
}

.cover-rose .rose-svg { width: 100%; height: auto; display: block; }

.rose-needle {
    transform-box: fill-box;
    transform-origin: center;
    will-change: transform;
}

.cover-meta {
    display: flex;
    justify-content: space-between;
    max-width: 38ch;
    margin: 0 auto;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    color: rgba(26, 22, 17, 0.7);
}

/* =====================================================
   PL. II — Index of Tracks
   ===================================================== */

.track-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 28px 36px;
    border-top: 0.5px solid rgba(26, 22, 17, 0.45);
    border-bottom: 0.5px solid rgba(26, 22, 17, 0.45);
    padding: 24px 0 28px;
}

.trk {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 6px 4px 14px;
    border-bottom: 0.4px dashed rgba(26, 22, 17, 0.28);
    position: relative;
}

.trk-stamp {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: block;
    position: relative;
    margin-top: 2px;
}

.trk-stamp::before {
    content: "";
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.trk-stamp[data-stamp="deer"]::before     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%231A1611' stroke-width='1.4' stroke-linecap='round'><path d='M22 18 q-4 14 0 26 q3 8 8 6 q3 -2 1 -10 q-3 -10 -2 -22 z'/><path d='M42 22 q-4 14 0 26 q3 8 8 6 q3 -2 1 -10 q-3 -10 -2 -22 z'/></g></svg>"); }
.trk-stamp[data-stamp="tortoise"]::before { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%231A1611' stroke-width='1.4'><ellipse cx='32' cy='32' rx='20' ry='12'/><ellipse cx='32' cy='32' rx='14' ry='8'/><ellipse cx='32' cy='32' rx='8' ry='4'/></g></svg>"); }
.trk-stamp[data-stamp="hare"]::before     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%231A1611' stroke-width='1.4' stroke-linecap='round'><path d='M16 38 l4 -16'/><path d='M28 36 l2 -18'/><path d='M40 36 l-2 -18'/><path d='M52 38 l-4 -16'/><path d='M14 44 q18 6 36 0'/></g></svg>"); }
.trk-stamp[data-stamp="heron"]::before    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%231A1611' stroke-width='1.4' stroke-linecap='round'><path d='M32 14 l0 36'/><path d='M32 50 l-12 8'/><path d='M32 50 l12 8'/><path d='M32 50 l0 6'/></g></svg>"); }
.trk-stamp[data-stamp="magpie"]::before   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%231A1611' stroke-width='1.4' stroke-linecap='round'><path d='M16 24 l4 -8 M22 24 l-2 -10 M14 30 q6 4 12 -2'/><path d='M40 36 l4 -8 M46 36 l-2 -10 M38 42 q6 4 12 -2'/></g></svg>"); }
.trk-stamp[data-stamp="bear"]::before     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%231A1611' stroke-width='1.4' stroke-linecap='round'><ellipse cx='32' cy='40' rx='14' ry='10'/><circle cx='20' cy='22' r='3'/><circle cx='28' cy='18' r='3'/><circle cx='36' cy='18' r='3'/><circle cx='44' cy='22' r='3'/><circle cx='32' cy='14' r='2.5'/></g></svg>"); }
.trk-stamp[data-stamp="badger"]::before   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%231A1611' stroke-width='1.4' stroke-linecap='round'><ellipse cx='32' cy='42' rx='18' ry='10'/><path d='M16 26 l-4 -8 M22 22 l-2 -10 M30 18 l-1 -10 M40 18 l1 -10 M48 22 l2 -10'/></g></svg>"); }
.trk-stamp[data-stamp="fox"]::before      { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%231A1611' stroke-width='1.4' stroke-linecap='round'><ellipse cx='32' cy='20' rx='3' ry='5'/><ellipse cx='20' cy='32' rx='3' ry='5'/><ellipse cx='44' cy='32' rx='3' ry='5'/><ellipse cx='32' cy='44' rx='3' ry='5'/></g></svg>"); }

/* Track ghost-trail (set by JS as a one-time effect) */
.trk-stamp.ghosted::after {
    content: "";
    position: absolute;
    left: 0;
    top: -54px;
    width: 100%;
    height: 54px;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><circle cx='32' cy='32' r='1' fill='%231A1611'/></svg>");
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0;
    animation: ghostTrail 1800ms ease-out forwards;
}

@keyframes ghostTrail {
    0%   { opacity: 0; transform: translateY(20px); }
    20%  { opacity: 0.32; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-30px); }
}

.trk-body { display: flex; flex-direction: column; gap: 4px; }

.trk-lat {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.92rem;
    color: rgba(26, 22, 17, 0.7);
    letter-spacing: 0.01em;
}

.trk-name {
    font-family: var(--font-display);
    font-size: 1.18rem;
    line-height: 1.2;
    color: var(--iron-gall);
    font-feature-settings: "liga", "dlig", "hist";
}

.trk-note {
    font-family: var(--font-serif);
    font-size: 0.99rem;
    line-height: 1.5;
    color: rgba(26, 22, 17, 0.84);
}

.trk-foot {
    margin-top: 26px;
    font-family: var(--font-serif);
    font-size: 0.99rem;
    color: rgba(26, 22, 17, 0.62);
    text-align: right;
}

/* =====================================================
   PL. III — The Tide Chart
   ===================================================== */

.plate-iii { background-image: linear-gradient(to bottom, transparent, rgba(200, 182, 143, 0.06)); }

.tide-figure {
    margin: 0;
    padding: 0;
}

.tide-svg {
    width: 100%;
    height: auto;
    display: block;
    background:
        repeating-linear-gradient(0deg, rgba(26, 22, 17, 0.03) 0 1px, transparent 1px 24px),
        repeating-linear-gradient(90deg, rgba(26, 22, 17, 0.03) 0 1px, transparent 1px 24px);
    border: 0.5px solid rgba(26, 22, 17, 0.4);
    padding: 8px;
}

.fig-caption {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: rgba(26, 22, 17, 0.78);
    margin-top: 12px;
    text-align: center;
    font-style: italic;
}

/* =====================================================
   PL. IV — Spoor Catalogue (isometric grid)
   ===================================================== */

.iso-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px 40px;
    margin-top: 20px;
}

.iso-cell {
    margin: 0;
    border: 0.5px solid rgba(26, 22, 17, 0.5);
    padding: 14px 14px 12px;
    background: rgba(242, 234, 214, 0.4);
    position: relative;
}

.iso-cell::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 0.4px dashed rgba(26, 22, 17, 0.18);
    pointer-events: none;
}

.iso-stage { aspect-ratio: 380 / 320; position: relative; overflow: hidden; }

.iso-svg { width: 100%; height: 100%; display: block; }

.iso-cell figcaption {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    line-height: 1.45;
    color: var(--iron-gall);
    margin-top: 10px;
    border-top: 0.4px solid rgba(26, 22, 17, 0.4);
    padding-top: 8px;
}

.iso-cell figcaption em {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.85rem;
    letter-spacing: 0;
    margin-right: 6px;
    color: var(--cinnabar-red);
}

/* =====================================================
   PL. V — Field Notes (manuscript spread)
   ===================================================== */

.plate-v {
    background-image: linear-gradient(to right,
        rgba(200, 182, 143, 0.08) 0,
        transparent 8%,
        transparent 92%,
        rgba(200, 182, 143, 0.08) 100%);
}

.manuscript {
    display: grid;
    grid-template-columns: 90px minmax(0, 52ch) 90px;
    gap: 28px;
    justify-content: center;
    margin: 24px auto 0;
    max-width: 880px;
    border-top: 0.5px solid rgba(26, 22, 17, 0.35);
    padding-top: 32px;
    position: relative;
}

.manuscript::before {
    /* Center fold line */
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: -8px;
    width: 0.4px;
    background: rgba(26, 22, 17, 0.08);
    pointer-events: none;
}

.margin {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-top: 8px;
}

.mg-glyph {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.mg-cap {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    color: rgba(26, 22, 17, 0.6);
    text-transform: lowercase;
}

.mg-date {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    color: var(--cinnabar-red);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    align-self: flex-start;
    height: auto;
}

.mg-note {
    font-family: var(--font-serif);
    font-size: 0.86rem;
    line-height: 1.4;
    color: rgba(26, 22, 17, 0.7);
}

.ms-prose {
    font-family: var(--font-serif);
    font-size: 1.04rem;
    line-height: 1.62;
    color: var(--iron-gall);
    max-width: 52ch;
}

.ms-prose p {
    margin: 0 0 1.2em;
    /* Slight irregular baseline jitter, 2% (visual letterpress) */
    text-indent: 0;
}

.ms-prose p + p { text-indent: 1.6em; }

.ms-first {
    position: relative;
    min-height: 100px;
}

.dropcap {
    float: left;
    width: 84px;
    height: 84px;
    margin: 6px 14px 0 0;
    shape-outside: polygon(0 0, 100% 0, 100% 90%, 36% 100%, 0 100%);
    shape-margin: 6px;
}

.dropcap svg { display: block; width: 100%; height: 100%; }

.dropcap-letter {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.ms-prose em {
    font-style: italic;
    font-feature-settings: "swsh";
    color: var(--iron-gall);
}

.strikethrough {
    text-decoration: line-through;
    text-decoration-color: var(--cinnabar-red);
    text-decoration-thickness: 0.8px;
    color: rgba(26, 22, 17, 0.6);
}

.ms-sign {
    text-align: right;
    margin-top: 1.6em;
    color: rgba(26, 22, 17, 0.78);
}

/* =====================================================
   PL. VI — Reading Room
   ===================================================== */

.library {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 12px;
    border-top: 0.5px solid rgba(26, 22, 17, 0.35);
    border-bottom: 0.5px solid rgba(26, 22, 17, 0.35);
    padding: 24px 0;
}

.shelf {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 22px;
    align-items: center;
    border-bottom: 0.4px dashed rgba(26, 22, 17, 0.3);
    padding-bottom: 18px;
}

.shelf:last-child { border-bottom: none; padding-bottom: 0; }

.shelf-label {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    color: rgba(26, 22, 17, 0.7);
    text-align: right;
    border-right: 0.5px solid rgba(26, 22, 17, 0.35);
    padding-right: 18px;
}

.spines {
    display: flex;
    align-items: stretch;
    gap: 4px;
    height: 110px;
    perspective: 800px;
    position: relative;
}

.spine {
    flex: 0 1 auto;
    min-width: 38px;
    width: clamp(40px, 6vw, 56px);
    height: 100%;
    border: 0.6px solid var(--iron-gall);
    background: linear-gradient(180deg,
        rgba(200, 182, 143, 0.4) 0%,
        rgba(200, 182, 143, 0.18) 12%,
        rgba(242, 234, 214, 0.6) 100%);
    color: var(--iron-gall);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px;
    cursor: pointer;
    font-family: inherit;
    transition: transform 480ms cubic-bezier(0.22, 0.8, 0.32, 1),
                box-shadow 480ms ease,
                background 480ms ease;
    box-shadow: inset -1px 0 0 rgba(26, 22, 17, 0.18),
                inset 1px 0 0 rgba(26, 22, 17, 0.08);
    will-change: transform;
}

.spine:hover {
    transform: translateY(-4px);
    transition-duration: 280ms;
    transition-timing-function: cubic-bezier(0.22, 0.6, 0.36, 1);
    box-shadow: inset -1px 0 0 rgba(26, 22, 17, 0.18),
                inset 1px 0 0 rgba(26, 22, 17, 0.08),
                0 6px 8px -4px rgba(26, 22, 17, 0.18);
}

.spine.open {
    transform: translateY(-6px);
    border-color: var(--cinnabar-red);
}

.sp-h {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    color: rgba(26, 22, 17, 0.7);
}

.sp-t {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    line-height: 1.15;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    color: var(--iron-gall);
    text-align: left;
    flex: 1 1 auto;
    margin: 6px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-cards {
    margin-top: 18px;
    min-height: 0;
    position: relative;
}

.card {
    display: none;
    border: 0.6px solid rgba(26, 22, 17, 0.6);
    background: rgba(242, 234, 214, 0.55);
    padding: 22px 26px 20px;
    max-width: 540px;
    position: relative;
    box-shadow:
        inset 0 0 0 1px rgba(200, 182, 143, 0.18),
        2px 2px 0 rgba(26, 22, 17, 0.08);
    background-image:
        repeating-linear-gradient(0deg, transparent 0 22px, rgba(26, 22, 17, 0.07) 22px 22.5px);
}

.card.active { display: block; animation: cardSlideIn 360ms cubic-bezier(0.22, 0.8, 0.32, 1); }

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-corner {
    position: absolute;
    top: 12px;
    right: 18px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    color: rgba(26, 22, 17, 0.62);
}

.card h4 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.45rem;
    line-height: 1.2;
    margin: 0 0 12px;
    color: var(--iron-gall);
    font-feature-settings: "liga", "dlig", "hist";
}

.card p {
    font-family: var(--font-serif);
    font-size: 1.04rem;
    line-height: 1.55;
    margin: 0;
    color: var(--iron-gall);
}

.card-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 0.4px solid rgba(26, 22, 17, 0.35);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: rgba(26, 22, 17, 0.7);
}

/* =====================================================
   PL. VII — Migration Map
   ===================================================== */

.plate-vii { background-image: linear-gradient(to bottom, transparent, rgba(61, 82, 64, 0.05)); }

.map-figure { margin: 0; }

.map-svg {
    width: 100%;
    height: auto;
    display: block;
    border: 0.5px solid rgba(26, 22, 17, 0.4);
    padding: 6px;
}

.trail {
    stroke-dasharray: 4 4;
    /* Initial state: full path hidden, will be drawn on enter */
    pathLength: 1;
}

.trail.draw {
    stroke-dashoffset: 0;
    animation: drawTrail 4s ease-out forwards;
}

@keyframes drawTrail {
    from { stroke-dashoffset: 600; opacity: 0.2; }
    to   { stroke-dashoffset: 0;   opacity: 1;   }
}

/* =====================================================
   PL. VIII — Colophon
   ===================================================== */

.plate-viii {
    min-height: 100vh;
    padding-bottom: 140px;
}

.colophon {
    margin: 24px 0 36px;
    padding: 22px 24px;
    border: 0.5px solid rgba(26, 22, 17, 0.4);
    background: rgba(200, 182, 143, 0.08);
    display: grid;
    grid-template-columns: minmax(0, 580px);
    gap: 0;
    max-width: 720px;
}

.col-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 0.4px dashed rgba(26, 22, 17, 0.28);
    font-family: var(--font-serif);
    font-size: 1.02rem;
    line-height: 1.5;
}

.col-row:last-child { border-bottom: none; }

.col-row dt {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    color: rgba(26, 22, 17, 0.7);
    text-transform: uppercase;
    padding-top: 2px;
}

.col-row dd { margin: 0; color: var(--iron-gall); }

.col-row dd code {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    color: var(--cinnabar-red);
    letter-spacing: 0.06em;
}

.col-letter {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.18rem;
    text-align: center;
    margin: 32px 0 12px;
    color: rgba(26, 22, 17, 0.85);
    font-feature-settings: "swsh";
}

.signature {
    display: block;
    max-width: 420px;
    margin: 12px auto 0;
    text-decoration: none;
    color: var(--iron-gall);
    cursor: pointer;
}

.sig-svg { width: 100%; height: auto; display: block; }

.sig-fallback {
    display: block;
    text-align: center;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    color: rgba(26, 22, 17, 0.6);
}

/* =====================================================
   Mobile collapse: <720px -> orthographic, no rail
   ===================================================== */

@media (max-width: 720px) {
    .rail {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 38px;
        border-right: none;
        border-bottom: 0.5px solid rgba(26, 22, 17, 0.45);
        background: var(--vellum-cream);
    }
    .rail-inner {
        flex-direction: row;
        padding: 4px 12px;
        gap: 10px;
        align-items: center;
    }
    .rail-mark { border: none; padding: 0; width: auto; font-size: 12px; }
    .mini-map { display: none; }
    .rail-readout { flex-direction: row; border: none; padding: 0; gap: 12px; flex: 0 0 auto; }
    .ro-row { font-size: 8px; gap: 4px; }
    .rail-inkpot { display: none; }

    .atlas {
        margin: 38px 0 0;
        border: none;
    }
    .plate {
        padding: 56px 22px 80px;
    }
    .plate-sig { right: 14px; bottom: 12px; font-size: 0.62rem; }
    .iso-grid { grid-template-columns: 1fr; }
    .track-list { grid-template-columns: 1fr; }
    .manuscript {
        grid-template-columns: 1fr;
        padding: 18px 4px 0;
    }
    .manuscript::before { display: none; }
    .margin { flex-direction: row; flex-wrap: wrap; gap: 14px; }
    .mg-date { writing-mode: horizontal-tb; transform: none; }
    .shelf {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .shelf-label { text-align: left; border-right: none; border-bottom: 0.5px solid rgba(26, 22, 17, 0.35); padding: 0 0 6px; }
    .spines { height: 96px; flex-wrap: wrap; }
    .col-row { grid-template-columns: 1fr; gap: 2px; }
    .cover-rose { width: 130px; left: 14px; bottom: 18px; opacity: 0.36; }
    .masthead { font-size: clamp(2.6rem, 14vw, 4.8rem); margin-bottom: 30px; }
}

/* =====================================================
   Reduced motion
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .rose-needle { animation: none !important; }
    .mm-cell.active .mm-bar { animation: none !important; }
    .trail.draw { animation: none !important; stroke-dashoffset: 0 !important; }
    .trk-stamp.ghosted::after { animation: none !important; }
}
