/* =================================================================
   martiallaw.wiki — declassified-archive reading-room styles
   palette: #2C3E5D #7A1F22 #8C6A3A #1F1A14 #E5D6B3 #0E0A05 #F1E8D4
   fonts:   Cormorant Garamond / EB Garamond / Special Elite / Crimson Pro
   ================================================================= */

:root {
    --vellum:    #F1E8D4;
    --parchment: #E5D6B3;
    --ink:       #1F1A14;
    --redact:    #0E0A05;
    --seal:      #7A1F22;
    --pencil:    #2C3E5D;
    --foxing:    #8C6A3A;
    --shadow:    rgba(31, 26, 20, 0.18);
    --rule:      rgba(31, 26, 20, 0.35);
    --rail-w:    22%;

    --f-display: "Cormorant Garamond", "Cormorant", "EB Garamond", Georgia, serif;
    --f-body:    "EB Garamond", "Cormorant Garamond", Georgia, serif;
    --f-stamp:   "Special Elite", "Courier Prime", "Courier New", monospace;
    --f-glossary:"Crimson Pro", "EB Garamond", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--vellum);
    color: var(--ink);
}

body {
    font-family: var(--f-body);
    font-size: 18px;
    line-height: 1.65;
    text-rendering: geometricPrecision;
    font-feature-settings: "liga", "onum", "kern";
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* paper-grain noise — hand-authored SVG, 4% opacity */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 60;
    opacity: 0.045;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0.12  0 0 0 0 0.10  0 0 0 0 0.08  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
    background-size: 280px 280px;
    mix-blend-mode: multiply;
}

/* soft long-grain fibers */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 59;
    opacity: 0.06;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='600'><g stroke='%238C6A3A' stroke-width='0.4' fill='none' opacity='0.55'><path d='M0,40 Q400,30 800,42 T1600,38'/><path d='M0,160 Q500,150 900,165 T1600,158'/><path d='M0,310 Q300,300 700,318 T1600,312'/><path d='M0,460 Q450,450 950,468 T1600,460'/></g></svg>");
    background-size: 1600px 600px;
    mix-blend-mode: multiply;
}

a { color: var(--seal); text-decoration: none; border-bottom: 1px dotted var(--seal); }
a:hover { color: var(--ink); border-bottom-color: var(--ink); }

::selection { background: var(--seal); color: var(--vellum); }

/* =================================================================
   FOLIATION GAUGE — left-edge progress sidebar
   ================================================================= */

.foliation-gauge {
    position: fixed;
    top: 0; left: 0;
    width: 40px;
    height: 100vh;
    background: var(--parchment);
    border-right: 1px solid rgba(31, 26, 20, 0.25);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-stack {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.gauge-tab {
    width: 22px;
    height: 30px;
    position: relative;
    background: var(--vellum);
    border: 1px solid var(--ink);
    box-shadow: 1px 1px 0 var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: transform 220ms ease;
}
.gauge-tab:hover { transform: translateX(2px); }

.tab-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--f-stamp);
    font-size: 9px;
    letter-spacing: 0.08em;
    color: var(--ink);
    z-index: 2;
    mix-blend-mode: multiply;
}

.tab-fill {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 0;
    background: var(--seal);
    z-index: 1;
    transition: height 600ms cubic-bezier(.7, .05, .3, .95);
    opacity: 0.85;
}

.gauge-tab.is-active .tab-fill { height: 100%; }
.gauge-tab.is-active .tab-num { color: var(--vellum); mix-blend-mode: normal; }

/* =================================================================
   DOSSIER + FOLIO — diagonal-sections, paper edges
   ================================================================= */

.dossier {
    padding-left: 40px;
    padding-block: 0;
}

.folio {
    --folio-skew: 3.5deg;
    position: relative;
    min-height: 100vh;
    padding-block: 8vh 12vh;
    padding-inline: clamp(28px, 6vw, 96px);
    margin-block: 6vh;
    background: var(--vellum);
    transform: rotate(var(--folio-skew));
    box-shadow:
        0 18px 36px -22px rgba(31, 26, 20, 0.35),
        0 4px 6px -2px rgba(31, 26, 20, 0.08);
    transform-origin: 50% 50%;
    z-index: 1;
    isolation: isolate;
}

/* kraft folder edge — top-left corner accent */
.folio::before {
    content: "";
    position: absolute;
    top: -1px; left: -1px; right: -1px; bottom: -1px;
    background:
        linear-gradient(135deg, rgba(140, 106, 58, 0.45) 0 38px, transparent 38px),
        linear-gradient(-135deg, rgba(140, 106, 58, 0.18) 0 24px, transparent 24px);
    pointer-events: none;
    z-index: 0;
}

/* foxing — corner aging at 12% opacity */
.folio::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 4% 6%, rgba(140, 106, 58, 0.22) 0%, transparent 28%),
        radial-gradient(ellipse at 96% 94%, rgba(140, 106, 58, 0.20) 0%, transparent 24%),
        radial-gradient(ellipse at 92% 6%, rgba(140, 106, 58, 0.14) 0%, transparent 20%),
        radial-gradient(ellipse at 4% 96%, rgba(140, 106, 58, 0.16) 0%, transparent 22%);
    z-index: 0;
    opacity: 0.85;
}

/* counter-rotate the inner content so reading remains horizontal */
.folio-inner {
    transform: rotate(calc(var(--folio-skew) * -1));
    display: grid;
    grid-template-columns: var(--rail-w) 1fr;
    column-gap: clamp(24px, 4vw, 64px);
    position: relative;
    z-index: 2;
    max-width: 1240px;
    margin-inline: auto;
}

/* ----- margin rail ----- */

.rail {
    border-right: 1px solid var(--rule);
    padding-right: clamp(14px, 2vw, 28px);
    background: linear-gradient(90deg, var(--parchment) 0%, var(--parchment) 92%, transparent 100%);
    padding-left: clamp(8px, 1.5vw, 20px);
    padding-block: 8px 24px;
    position: relative;
}

.callno {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    padding: 6px 0;
    margin-bottom: 24px;
    text-align: center;
    background: rgba(241, 232, 212, 0.5);
}

.folio-num {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 600;
    font-size: clamp(120px, 14vw, 180px);
    line-height: 0.9;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin: 8px 0 12px;
    position: relative;
    display: inline-block;
}

.folio-num::after {
    content: "";
    position: absolute;
    left: 6%; right: 12%;
    bottom: 0.06em;
    height: 4px;
    background: var(--seal);
    transform: skewX(-12deg);
    opacity: 0.92;
}

.datestamp {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    border: 1px dashed rgba(31, 26, 20, 0.55);
    padding: 6px 8px;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.4;
}

.margin-pull {
    margin: 0;
    padding: 14px 0 0;
    border-top: 1px solid var(--rule);
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(15px, 1.3vw, 18px);
    line-height: 1.45;
    color: var(--ink);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 800ms ease 200ms, transform 800ms ease 200ms;
}

.folio.is-visible .margin-pull {
    opacity: 0.92;
    transform: translateY(0);
}

/* ----- body column ----- */

.body { padding-block: 8px 24px; padding-left: clamp(8px, 1.5vw, 20px); }

.zone-label {
    font-family: var(--f-stamp);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--seal);
    margin-right: 0.5em;
    vertical-align: 0.2em;
}

.folio-heading {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: clamp(34px, 4.6vw, 60px);
    line-height: 1.05;
    margin: 0 0 24px;
    color: var(--ink);
    letter-spacing: -0.005em;
}

.lede {
    font-size: clamp(17px, 1.35vw, 20px);
    line-height: 1.7;
    margin: 0 0 28px;
    max-width: 64ch;
    font-style: italic;
    color: var(--ink);
}

.proc-para,
.tally-frame + .proc-para,
.body p {
    max-width: 64ch;
    margin: 0 0 1.1em;
}

.body p:last-child { margin-bottom: 0; }

.footnote-mark {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(31, 26, 20, 0.7);
    margin-top: 32px !important;
    border-top: 1px solid var(--rule);
    padding-top: 10px;
}

.nowrap { white-space: nowrap; }

.xref { font-style: italic; }

/* =================================================================
   REDACTION STRIPS — narrative mechanic
   ================================================================= */

.redacted {
    position: relative;
    display: inline-block;
    cursor: help;
    color: transparent;
    user-select: none;
    line-height: inherit;
    transition: transform 240ms cubic-bezier(.7, .05, .3, .95);
}

.redacted::before {
    content: "";
    position: absolute;
    inset: -1px -2px;
    background: var(--redact);
    /* jittered edges */
    clip-path: polygon(
        1% 12%, 4% 6%, 9% 14%, 16% 4%, 23% 12%, 31% 7%,
        38% 14%, 46% 5%, 54% 12%, 62% 6%, 71% 13%, 80% 5%,
        88% 12%, 96% 7%, 100% 14%,
        99% 88%, 92% 96%, 84% 88%, 75% 95%, 67% 87%,
        58% 96%, 50% 87%, 41% 95%, 33% 87%, 24% 95%,
        16% 87%, 8% 96%, 2% 88%, 0% 14%
    );
    z-index: 1;
    transition: transform 240ms cubic-bezier(.7, .05, .3, .95), filter 240ms ease;
    filter: drop-shadow(0 1px 0 rgba(0,0,0,0.4));
}

.redacted::after {
    /* the restored text, shown on hover */
    content: attr(data-restored);
    position: absolute;
    inset: 0;
    color: var(--seal);
    font-style: italic;
    font-weight: 500;
    background: transparent;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transition: opacity 200ms ease 80ms;
    white-space: normal;
}

.redacted:hover::before,
.redacted:focus-visible::before {
    transform: translate(2px, -6px) rotate(-1.2deg);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35));
}
.redacted:hover::after,
.redacted:focus-visible::after { opacity: 1; }
.redacted:hover, .redacted:focus-visible { color: var(--seal); }

/* =================================================================
   PANEL 00 / COVER
   ================================================================= */

.cover-body {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.cover-header { margin-top: 8px; }

.archive-line {
    font-family: var(--f-stamp);
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--seal);
    border-top: 1px solid var(--seal);
    border-bottom: 1px solid var(--seal);
    padding: 6px 0;
    margin-bottom: 24px;
    display: inline-block;
    padding-inline: 10px;
}

.cover-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: clamp(48px, 7.4vw, 96px);
    line-height: 1.02;
    margin: 0 0 18px;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.cover-title em {
    font-style: italic;
    color: var(--seal);
    font-weight: 600;
}

.cover-sub {
    font-family: var(--f-body);
    font-size: clamp(17px, 1.4vw, 21px);
    line-height: 1.6;
    max-width: 60ch;
    color: var(--ink);
    font-style: italic;
}

.seal-wrap {
    display: flex;
    justify-content: center;
    margin: 24px 0 8px;
    color: var(--seal);
}
.civic-seal {
    width: 280px;
    height: 280px;
    color: var(--seal);
}
.civic-seal .hanja {
    font-family: var(--f-display);
    font-size: 22px;
    fill: currentColor;
    font-weight: 700;
    font-style: italic;
}
.civic-seal .seal-text {
    font-family: var(--f-stamp);
    fill: currentColor;
}

.cover-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 14px 0;
    max-width: 60ch;
}

.meta-row { display: flex; justify-content: space-between; gap: 16px; }
.meta-key {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(31, 26, 20, 0.65);
}
.meta-val {
    font-family: var(--f-body);
    font-size: 14px;
    color: var(--ink);
    text-align: right;
}

.stamp-block { padding-top: 4px; }

.stamp {
    display: inline-block;
    font-family: var(--f-stamp);
    font-size: 18px;
    letter-spacing: 0.18em;
    color: var(--seal);
    border: 2px solid var(--seal);
    padding: 8px 14px;
    transform: rotate(-4deg);
    box-shadow: inset 0 0 0 1px var(--seal);
    background: rgba(122, 31, 34, 0.04);
    text-transform: uppercase;
}
.stamp-rescinded { font-size: 16px; }

/* =================================================================
   PANEL 01 / TIMELINE
   ================================================================= */

.timeline-list {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    border-left: 1px solid var(--rule);
    padding-left: 24px;
    max-width: 70ch;
    position: relative;
}

.tl-item {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 18px;
    padding: 14px 0;
    border-bottom: 1px dotted rgba(31, 26, 20, 0.25);
    position: relative;
}
.tl-item:last-child { border-bottom: none; }

.tl-item::before {
    content: "";
    position: absolute;
    left: -29px;
    top: 22px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--vellum);
    border: 1.5px solid var(--ink);
}

.tl-time {
    font-family: var(--f-stamp);
    font-size: 14px;
    letter-spacing: 0.06em;
    color: var(--seal);
    text-transform: uppercase;
    line-height: 1.5;
    padding-top: 2px;
}

.tl-body {
    font-family: var(--f-body);
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
}

/* =================================================================
   PANEL 02 / DECLARATION — onion-skin proclamation
   ================================================================= */

.proclamation.onion-skin {
    background: rgba(241, 232, 212, 0.65);
    border: 1px solid rgba(31, 26, 20, 0.18);
    padding: clamp(24px, 4vw, 44px);
    margin: 0 0 24px;
    max-width: 72ch;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 8px 16px -10px rgba(31, 26, 20, 0.25);
    position: relative;
    background-image:
        repeating-linear-gradient(0deg, transparent 0 27px, rgba(31,26,20,0.045) 27px 28px);
}

.proc-head {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.proc-stamp {
    font-family: var(--f-stamp);
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--seal);
    margin-bottom: 6px;
}
.proc-issuer {
    font-family: var(--f-body);
    font-style: italic;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
}
.proc-date {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: rgba(31, 26, 20, 0.7);
    margin-top: 4px;
    text-transform: uppercase;
}

.proc-para {
    font-size: 17px;
    line-height: 1.75;
    color: var(--ink);
    margin: 0 0 1em;
    text-align: justify;
    hyphens: auto;
}
.proc-para strong {
    font-family: var(--f-display);
    font-weight: 700;
    font-style: italic;
    color: var(--ink);
    margin-right: 4px;
}
.proc-coda {
    font-style: italic;
    color: rgba(31, 26, 20, 0.85);
    border-top: 1px dotted var(--rule);
    padding-top: 14px;
}

/* =================================================================
   PANEL 03 / NATIONAL ASSEMBLY — tally sheet
   ================================================================= */

.tally-frame {
    position: relative;
    background: var(--vellum);
    border: 1px solid rgba(31, 26, 20, 0.35);
    padding: clamp(20px, 3vw, 36px) clamp(20px, 3vw, 36px) clamp(18px, 2.5vw, 28px);
    margin: 12px 0 28px;
    max-width: 78ch;
    overflow: hidden;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.7) inset,
        0 6px 14px -10px rgba(31, 26, 20, 0.25);
}

/* graph-paper grid */
.tally-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(0deg, rgba(44, 62, 93, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(44, 62, 93, 0.12) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.6;
}

/* watermark ring — subtle, parallaxed */
.watermark-ring {
    position: absolute;
    top: 50%; left: 50%;
    width: 320px; height: 320px;
    transform: translate(-50%, -50%);
    color: rgba(122, 31, 34, 0.18);
    pointer-events: none;
    z-index: 1;
    transition: transform 600ms ease-out;
    will-change: transform;
}
.watermark-ring svg { width: 100%; height: 100%; }
.watermark-ring text {
    font-family: var(--f-stamp);
    fill: currentColor;
    font-weight: 700;
    letter-spacing: 6px;
}

.tally-content {
    position: relative;
    z-index: 2;
}

.tally-headers {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr;
    gap: 18px;
    border-bottom: 1.5px solid var(--ink);
    padding-bottom: 8px;
    margin-bottom: 14px;
}
.tally-header-cell {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}

.tally-rows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px 14px;
    padding: 8px 0 14px;
}

.tally-bar {
    position: relative;
    height: 40px;
    border-bottom: 1px dotted rgba(31, 26, 20, 0.18);
}
.tally-bar svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}
.tally-bar svg path,
.tally-bar svg line {
    stroke: var(--pencil);
    stroke-width: 2.4;
    stroke-linecap: round;
    fill: none;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
}

.folio.is-tally-drawn .tally-bar svg path,
.folio.is-tally-drawn .tally-bar svg line {
    animation: tallyDraw 900ms cubic-bezier(.7, .05, .3, .95) forwards;
}

/* stagger via per-bar delay set inline */
@keyframes tallyDraw {
    to { stroke-dashoffset: 0; }
}

.tally-totals {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr;
    gap: 18px;
    border-top: 1.5px solid var(--ink);
    padding-top: 12px;
    align-items: end;
}

.tally-total-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tt-num {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 700;
    font-size: 44px;
    line-height: 1;
    color: var(--seal);
    letter-spacing: -0.01em;
}
.tally-total-cell:nth-child(1) .tt-num { color: var(--seal); }
.tally-total-cell:nth-child(2) .tt-num,
.tally-total-cell:nth-child(3) .tt-num {
    color: rgba(31, 26, 20, 0.7);
}
.tt-label {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}

/* =================================================================
   PANEL 04 / IMPEACHMENT — citation chain
   ================================================================= */

.citation-chain {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    max-width: 72ch;
}

.cite-link {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid var(--rule);
    position: relative;
}
.cite-link:last-child { border-bottom: 1px solid var(--rule); }
.cite-link::before {
    content: "";
    position: absolute;
    left: 32px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(122, 31, 34, 0.5);
}
.cite-link:first-child::before { top: 50%; }
.cite-link:last-child::before  { bottom: 50%; }

.cite-marker {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 700;
    font-size: 28px;
    color: var(--seal);
    line-height: 1.1;
    background: var(--vellum);
    z-index: 2;
    position: relative;
    padding-top: 4px;
}
.cite-detail { padding-top: 2px; }

.cite-title {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 600;
    font-size: 22px;
    color: var(--ink);
    margin-bottom: 4px;
    line-height: 1.25;
}
.cite-cite {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(31, 26, 20, 0.75);
    margin-bottom: 8px;
}
.cite-note {
    font-family: var(--f-body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
}
.cite-note strong {
    font-family: var(--f-display);
    font-weight: 700;
    color: var(--seal);
}

/* =================================================================
   PANEL 05 / GLOSSARY — paper-card index
   ================================================================= */

.card-set {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(14px, 1.6vw, 22px);
    margin: 8px 0 24px;
    max-width: 1080px;
}

.index-card {
    background: linear-gradient(180deg, #FAF1DD 0%, var(--vellum) 100%);
    border: 1px solid rgba(31, 26, 20, 0.35);
    padding: 16px 18px 14px;
    position: relative;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        2px 3px 0 rgba(140, 106, 58, 0.18),
        0 6px 12px -8px rgba(31, 26, 20, 0.25);
    /* uneven cant per-card, applied via :nth-child */
    transform: rotate(-0.6deg);
    transition: transform 220ms ease, box-shadow 220ms ease;
}
.index-card:nth-child(2n)   { transform: rotate(0.55deg); }
.index-card:nth-child(3n)   { transform: rotate(-0.35deg); }
.index-card:nth-child(5n)   { transform: rotate(0.85deg); }
.index-card:nth-child(7n)   { transform: rotate(-0.9deg); }

.index-card:hover {
    transform: rotate(0deg) translateY(-2px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        3px 4px 0 rgba(140, 106, 58, 0.22),
        0 12px 22px -10px rgba(31, 26, 20, 0.32);
}

/* punched hole top-left, archivist's index card */
.index-card::before {
    content: "";
    position: absolute;
    top: 8px; left: 10px;
    width: 8px; height: 8px;
    background: var(--vellum);
    border: 1px solid rgba(31, 26, 20, 0.45);
    border-radius: 50%;
    box-shadow: inset 0 1px 1px rgba(31, 26, 20, 0.25);
}

.card-term {
    font-family: var(--f-glossary);
    font-weight: 700;
    font-size: 18px;
    line-height: 1.15;
    margin: 4px 0 8px 22px;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-variant-caps: small-caps;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 6px;
}

.card-def {
    font-family: var(--f-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    margin: 0 0 12px;
}
.card-def em {
    font-family: var(--f-display);
    font-style: italic;
    color: var(--seal);
}

.card-foot {
    font-family: var(--f-stamp);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(31, 26, 20, 0.65);
    border-top: 1px dotted var(--rule);
    padding-top: 6px;
    text-align: right;
}

/* =================================================================
   PANEL 06 / FURTHER READING
   ================================================================= */

.biblio {
    list-style: none;
    margin: 0 0 32px;
    padding: 0;
    max-width: 72ch;
}

.biblio-item {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dotted rgba(31, 26, 20, 0.25);
    line-height: 1.55;
    font-size: 16px;
}
.biblio-item:last-child { border-bottom: none; }

.bib-num {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 700;
    font-size: 22px;
    color: var(--seal);
    line-height: 1;
    padding-top: 2px;
}

.bib-detail em {
    font-family: var(--f-display);
    font-style: italic;
    color: var(--ink);
}

/* return-to-stacks card */
.returncard {
    margin: 24px 0;
    max-width: 56ch;
}
.rc-frame {
    border: 2px solid var(--seal);
    padding: 18px 22px 16px;
    background:
        repeating-linear-gradient(45deg, rgba(122,31,34,0.04) 0 6px, transparent 6px 12px),
        var(--vellum);
    transform: rotate(-1.2deg);
    box-shadow: 4px 5px 0 rgba(140, 106, 58, 0.22);
    position: relative;
}
.rc-title {
    font-family: var(--f-stamp);
    font-size: 16px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--seal);
    border-bottom: 1px solid var(--seal);
    padding-bottom: 6px;
    margin-bottom: 12px;
    text-align: center;
}
.rc-body { display: flex; flex-direction: column; gap: 4px; }
.rc-line { display: flex; justify-content: space-between; gap: 20px; }
.rc-key {
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(31, 26, 20, 0.7);
}
.rc-val {
    font-family: var(--f-body);
    font-size: 14px;
    color: var(--ink);
    text-align: right;
}
.rc-stamps {
    margin-top: 14px;
    display: flex;
    gap: 12px;
    justify-content: center;
}
.rc-stamp {
    font-family: var(--f-stamp);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--seal);
    border: 1px solid var(--seal);
    padding: 4px 8px;
    transform: rotate(-3deg);
}
.rc-stamps .rc-stamp:nth-child(2) { transform: rotate(2deg); }

/* footer mark with small civic seal */
.folder-footer {
    margin-top: 36px;
    padding-top: 16px;
    border-top: 1px solid var(--rule);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    color: rgba(31, 26, 20, 0.85);
    font-family: var(--f-stamp);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.ff-seal {
    width: 24px; height: 24px;
    display: inline-flex;
    color: var(--seal);
}
.ff-text { flex: 1 1 240px; }
.ff-link {
    font-family: var(--f-stamp);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px dotted var(--seal);
}

/* =================================================================
   RESPONSIVE — collapse rail on mobile
   ================================================================= */

@media (max-width: 1023px) {
    .folio-inner {
        grid-template-columns: 1fr;
        row-gap: 20px;
    }
    .rail {
        border-right: none;
        border-bottom: 1px solid var(--rule);
        background: var(--parchment);
        padding: 14px 16px;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "callno callno"
            "num    pull"
            "date   pull";
        column-gap: 18px;
        row-gap: 8px;
    }
    .callno    { grid-area: callno; margin-bottom: 6px; text-align: left; padding-inline: 8px; }
    .folio-num { grid-area: num; font-size: 76px; line-height: 0.95; }
    .datestamp { grid-area: date; align-self: end; margin-bottom: 0; }
    .margin-pull { grid-area: pull; padding-top: 6px; border-top: none; font-size: 14px; }
}

@media (max-width: 720px) {
    body { font-size: 16px; }
    .dossier { padding-left: 32px; }
    .foliation-gauge { width: 32px; }
    .gauge-tab { width: 18px; height: 24px; }
    .tab-num { font-size: 8px; }
    .folio {
        padding-inline: 18px;
        margin-block: 4vh;
    }
    .cover-title { font-size: 38px; }
    .folio-heading { font-size: 28px; }
    .tl-item { grid-template-columns: 64px 1fr; gap: 10px; }
    .citation-chain .cite-link { grid-template-columns: 50px 1fr; gap: 10px; }
    .cite-link::before { left: 22px; }
    .tally-headers,
    .tally-totals { grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
    .tt-num { font-size: 30px; }
    .index-card { padding: 14px 14px 12px; }
    .card-term { margin-left: 18px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .watermark-ring { transition: none; }
    .folio { transform: none; }
    .folio-inner { transform: none; }
    .tally-bar svg path,
    .tally-bar svg line { stroke-dashoffset: 0 !important; animation: none !important; }
    .margin-pull { opacity: 0.92; transform: none; transition: none; }
}
