/* ============================================================
   freedom.study  |  vol. i, mmxxvi
   Victorian engraving plate jammed inside a debugger.
   ============================================================ */

:root {
    /* Triadic palette + paper */
    --plate-cream: #f4ecd8;
    --plate-cream-2: #e0d8c8;
    --pencil-ghost: #d6cdb8;
    --iron-ink: #1a1a24;
    --ferric-vermilion: #c8362d;
    --loyalist-cyan: #2d8fc8;
    --civic-olive: #9caa2d;

    /* Type stacks */
    --font-display: "Bodoni Moda", "Times New Roman", serif;
    --font-headline: "Inter Tight", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", "Courier New", monospace;
    --font-fraktur: "UnifrakturCook", "Bodoni Moda", serif;

    /* Layout */
    --rail-width: 240px;
    --body-max: 720px;
    --masthead-h: 180px;
    --chapter-h: 64px;

    /* Easing: elastic — overshoot then settle, ~6%, 350ms */
    --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-elastic: 350ms;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--plate-cream);
    color: var(--iron-ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

p { margin: 0 0 1.1em; }
em, i { color: var(--civic-olive); font-style: italic; }

::selection {
    background: var(--ferric-vermilion);
    color: var(--plate-cream);
}

/* ============================================================
   Printer's rule (thick-thin-thick)
   ============================================================ */
.thick-thin-thick {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    margin: 0.6em 0;
}
.rule {
    display: block;
    width: 100%;
    background: var(--iron-ink);
}
.rule-thick { height: 2px; }
.rule-thin  { height: 0.75px; }

/* ============================================================
   Masthead
   ============================================================ */
.masthead {
    position: relative;
    height: var(--masthead-h);
    width: 100%;
    background: var(--plate-cream);
    border-bottom: 0;
    overflow: hidden;
}
.masthead::before,
.masthead::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--iron-ink);
}
.masthead::before { top: 0; }
.masthead::after  { bottom: 0; }

.masthead-inner {
    position: relative;
    display: grid;
    grid-template-columns: auto 1px 1fr 1px auto;
    align-items: center;
    height: calc(var(--masthead-h) - 16px);
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 32px;
    gap: 24px;
}

.vol-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.28em;
    color: var(--civic-olive);
    text-transform: uppercase;
    white-space: nowrap;
}

.vrule {
    width: 1px;
    height: 80%;
    background: var(--iron-ink);
}

.wordmark-cluster {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cartouche {
    width: min(720px, 100%);
    height: 120px;
    display: block;
    margin-bottom: -40px;
    pointer-events: none;
}

.wordmark {
    position: relative;
    margin: 0;
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: -0.012em;
    text-transform: lowercase;
    color: var(--iron-ink);
    line-height: 1;
    z-index: 2;
}
.wordmark .wm-base,
.wordmark .wm-cyan,
.wordmark .wm-vermilion {
    display: block;
    grid-area: 1 / 1;
}
.wordmark {
    display: grid;
}
.wm-cyan,
.wm-vermilion {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: transform 200ms var(--ease-elastic), opacity 200ms ease;
    opacity: 0;
}
.wm-cyan      { color: var(--loyalist-cyan); }
.wm-vermilion { color: var(--ferric-vermilion); }

.masthead.glitch .wm-cyan      { transform: translateX(-2px); opacity: 0.95; }
.masthead.glitch .wm-vermilion { transform: translateX( 2px); opacity: 0.95; }

.subtitle {
    margin: 6px 0 0;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--iron-ink);
    text-transform: lowercase;
    opacity: 0.78;
}

/* settle on load */
.cartouche { transform: translateY(-6px); opacity: 0; transition: transform 600ms var(--ease-elastic), opacity 400ms ease; }
.masthead.settled .cartouche { transform: translateY(0); opacity: 1; }
.wordmark    { transform: scale(0.985); transition: transform 500ms var(--ease-elastic); }
.masthead.settled .wordmark { transform: scale(1); }

/* ============================================================
   Chapter banner
   ============================================================ */
.chapter-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--plate-cream);
    border-bottom: 0;
}
.chapters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 36px;
    list-style: none;
    margin: 0;
    padding: 14px 32px;
    height: var(--chapter-h);
}
.chapter-link {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 12px;
    text-decoration: none;
    color: var(--iron-ink);
    padding: 6px 4px 10px;
    font-family: var(--font-headline);
    font-weight: 600;
}
.ch-numeral {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.18em;
    color: var(--ferric-vermilion);
    transition: color 120ms ease;
}
.ch-name {
    font-family: var(--font-headline);
    font-weight: 500;
    font-size: 13px;
    text-transform: lowercase;
    letter-spacing: 0.04em;
}
.elastic-underline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2px;
    width: 100%;
    height: 6px;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform var(--dur-elastic) var(--ease-elastic);
}
.chapter-link:hover .elastic-underline,
.chapter-link.active .elastic-underline {
    transform: scaleX(1);
}
.chapter-link.glitching .ch-numeral {
    color: var(--loyalist-cyan);
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0;
}

/* ============================================================
   Treatise body grid: rail | column
   ============================================================ */
.treatise {
    position: relative;
    display: grid;
    grid-template-columns: var(--rail-width) 1fr;
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 32px 64px;
    gap: 0;
}

/* ---------- LEFT RAIL ---------- */
.rail {
    position: relative;
    border-right: 0;
}
.rail-inner {
    position: sticky;
    top: calc(var(--chapter-h) + 18px);
    padding: 16px 24px 32px 8px;
}

.rail-section-marker {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: baseline;
    column-gap: 10px;
    margin-bottom: 28px;
    transition: transform var(--dur-elastic) var(--ease-elastic);
}
.rail-section-marker.snap {
    transform: scale(1.06) translateY(-2px);
}
.section-pilcrow {
    grid-row: 1 / 3;
    font-family: var(--font-mono);
    font-size: 32px;
    line-height: 1;
    color: var(--ferric-vermilion);
    align-self: center;
}
.section-numeral {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 36px;
    letter-spacing: 0.12em;
    color: var(--iron-ink);
    line-height: 1;
}
.section-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--iron-ink);
    text-transform: lowercase;
    opacity: 0.78;
    grid-column: 2;
}

.rail-tickmarks {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-left: 1px solid var(--iron-ink);
    padding: 12px 0 12px 10px;
    margin-bottom: 28px;
    width: max-content;
}
.tick {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tick::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 1px;
    background: var(--iron-ink);
    margin-left: -10px;
}
.tick-num {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--iron-ink);
    opacity: 0.7;
    letter-spacing: 0.1em;
}

.rail-marginalia {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 12px;
    border-top: 0.75px solid var(--iron-ink);
    padding-top: 14px;
}
.marginalia {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 13px;
    line-height: 1.55;
    color: var(--civic-olive);
    margin: 0;
}
.marginalia em { color: var(--civic-olive); }
.note {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--loyalist-cyan);
    margin: 0;
    opacity: 0.92;
}
.note-prefix {
    color: var(--loyalist-cyan);
    font-weight: 500;
    margin-right: 6px;
}

/* Fluted column border (right edge of rail) */
.fluted-column {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 12px;
    display: flex;
    flex-direction: row;
    gap: 2px;
    align-items: stretch;
    transition: transform 80ms linear;
    pointer-events: none;
}
.flute {
    display: block;
    height: 100%;
    background: var(--iron-ink);
}
.flute-1 { width: 1px; }
.flute-2 { width: 2px; opacity: 0.85; }
.flute-3 { width: 3px; }

/* ---------- BODY COLUMN ---------- */
.body-column {
    position: relative;
    max-width: var(--body-max);
    margin-left: 32px;
    padding: 16px 0 0;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    pointer-events: none;
    opacity: 0.04;
    z-index: 0;
}
.grid-overlay span {
    border-right: 1px solid var(--iron-ink);
    height: 100%;
}
.grid-overlay span:last-child { border-right: 0; }

/* ============================================================
   Plates (sections)
   ============================================================ */
.plate {
    position: relative;
    padding: 56px 24px 56px;
    margin: 0 0 64px;
    z-index: 1;
}

.plate-header {
    position: relative;
    padding: 24px 16px 20px;
    margin-bottom: 32px;
    border-top: 0.75px solid var(--iron-ink);
    border-bottom: 0.75px solid var(--iron-ink);
}

/* Corner fleurons at every plate intersection */
.corner-fleuron {
    position: absolute;
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.corner-fleuron::before,
.corner-fleuron::after {
    content: "";
    position: absolute;
    background: var(--iron-ink);
}
.corner-fleuron::before { width: 18px; height: 1px; }
.corner-fleuron::after  { width: 1px;  height: 18px; }
.corner-fleuron.tl { top: -1px; left: -1px; }
.corner-fleuron.tl::before { top: 0; left: 0; }
.corner-fleuron.tl::after  { top: 0; left: 0; }
.corner-fleuron.tr { top: -1px; right: -1px; }
.corner-fleuron.tr::before { top: 0; right: 0; }
.corner-fleuron.tr::after  { top: 0; right: 0; }
.corner-fleuron.bl { bottom: -1px; left: -1px; }
.corner-fleuron.bl::before { bottom: 0; left: 0; }
.corner-fleuron.bl::after  { bottom: 0; left: 0; }
.corner-fleuron.br { bottom: -1px; right: -1px; }
.corner-fleuron.br::before { bottom: 0; right: 0; }
.corner-fleuron.br::after  { bottom: 0; right: 0; }

.plate-overline {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}
.plate-numeral {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    letter-spacing: 0.18em;
    color: var(--ferric-vermilion);
    text-transform: uppercase;
    line-height: 1;
    font-variant: small-caps;
}
.plate-rule {
    flex: 1;
    height: 1px;
    background: var(--iron-ink);
    align-self: center;
    transform: translateY(2px);
}
.plate-stamp {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--civic-olive);
}

.plate-title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(1.6rem, 3.4vw, 2.6rem);
    letter-spacing: -0.012em;
    line-height: 1.18;
    text-transform: lowercase;
    margin: 0 0 8px;
    color: var(--iron-ink);
}
.plate-caption {
    margin: 0;
}
.caption-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--loyalist-cyan);
    letter-spacing: 0.04em;
}

.plate-body {
    position: relative;
    padding: 12px 0 8px;
}

/* ---------- Drop cap (Plate I lede) ---------- */
.lede {
    position: relative;
    margin: 0 0 1.4em;
    font-size: 17px;
    line-height: 1.62;
}
.drop-cap {
    float: left;
    width: 80px;
    height: 100px;
    margin: 6px 16px 0 0;
    position: relative;
    cursor: pointer;
}
.drop-cap-svg {
    width: 100%;
    height: 100%;
    display: block;
}
.drop-letter {
    font-family: var(--font-fraktur);
    font-size: 76px;
    font-weight: 700;
    fill: var(--ferric-vermilion);
    transition: opacity 90ms linear;
}
.drop-hex {
    font-family: var(--font-mono);
    font-size: 16px;
    fill: var(--loyalist-cyan);
    opacity: 0;
    transition: opacity 90ms linear;
}
.plate.glitch-cap .drop-letter { opacity: 0; }
.plate.glitch-cap .drop-hex    { opacity: 1; }

/* Long-press ornament glitch */
.ornament-host.held .case-ornament,
.ornament-host.held .instrument-figure {
    filter:
        drop-shadow(2px 0 0 rgba(45,143,200,0.85))
        drop-shadow(-2px 0 0 rgba(200,54,45,0.85));
    transform: translate3d(0,0,0);
}

/* ---------- Axioms ---------- */
.axioms {
    list-style: none;
    counter-reset: axiom;
    padding: 0;
    margin: 32px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.axiom {
    position: relative;
    padding: 16px 20px 16px 22px;
    border-top: 1px solid var(--iron-ink);
    border-bottom: 1px solid var(--iron-ink);
    background:
        repeating-linear-gradient(0deg, transparent 0 7px, rgba(26,26,36,0.02) 7px 8px);
}
.axiom-label {
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.2em;
    color: var(--iron-ink);
    font-variant: small-caps;
    margin-bottom: 6px;
}
.axiom p { margin: 0; }
.callout-note {
    display: inline-block;
    margin-left: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--loyalist-cyan);
}

.closing-note {
    margin-top: 28px;
    font-style: italic;
    color: var(--iron-ink);
}
.closing-note em { color: var(--civic-olive); }

/* ============================================================
   Plate II — Cases
   ============================================================ */
.plate-body.cases .case {
    position: relative;
    padding: 24px 12px 12px;
    margin: 16px 0;
}
.case-ornament {
    width: 60px;
    height: 40px;
    margin-bottom: 8px;
}
.ornament-balance,
.ornament-key,
.ornament-quill,
.ornament-laurel {
    width: 100%;
    height: 100%;
    display: block;
}
.case-pair {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.case-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.18em;
    font-variant: small-caps;
    color: var(--iron-ink);
}
.case-name.a { color: var(--ferric-vermilion); }
.case-name.b { color: var(--iron-ink); }
.case-vs {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--civic-olive);
    letter-spacing: 0.1em;
}
.case-body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--iron-ink);
    margin-bottom: 10px;
}
.case-resolution {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.55;
    color: var(--loyalist-cyan);
    background: rgba(45,143,200,0.06);
    border-left: 2px solid var(--loyalist-cyan);
    padding: 10px 14px;
    margin: 0;
}

/* ============================================================
   Plate III — Instruments
   ============================================================ */
.instrument {
    margin: 28px 0;
    padding: 12px 0;
}
.instrument-header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 18px;
    border-bottom: 0.75px solid var(--iron-ink);
    padding-bottom: 10px;
}
.inst-numeral {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    color: var(--ferric-vermilion);
    letter-spacing: 0.12em;
}
.inst-title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: 22px;
    line-height: 1.22;
    margin: 0;
    color: var(--iron-ink);
    text-transform: lowercase;
    letter-spacing: -0.008em;
}
.instrument-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 22px;
    align-items: start;
}
.instrument-figure {
    margin: 0;
}
.inst-diagram {
    width: 100%;
    height: auto;
    display: block;
}
.inst-caption {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--iron-ink);
    opacity: 0.78;
    letter-spacing: 0.04em;
}
.procedure {
    margin: 0 0 14px;
    padding-left: 22px;
    counter-reset: proc;
    list-style: none;
}
.procedure li {
    position: relative;
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.55;
}
.procedure li::before {
    counter-increment: proc;
    content: counter(proc, lower-roman) ".";
    position: absolute;
    left: -22px;
    top: 0;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ferric-vermilion);
    font-size: 14px;
}
.usage-box {
    margin: 0;
    padding: 12px 14px;
    background: var(--plate-cream-2);
    border: 0.75px solid var(--iron-ink);
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--iron-ink);
    overflow-x: auto;
}
.usage-box code {
    font-family: inherit;
    color: inherit;
    white-space: pre;
}
.usage-prefix {
    color: var(--loyalist-cyan);
    font-weight: 500;
}

/* ============================================================
   Plate IV — Annexes (bibliographic)
   ============================================================ */
.bibliography {
    list-style: none;
    padding: 0;
    margin: 24px 0;
}
.bib-entry {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 12px;
    align-items: baseline;
    border-bottom: 0.5px dotted var(--iron-ink);
    padding: 8px 0;
    line-height: 1.45;
}
.bib-entry:last-child { border-bottom: 0; }
.bib-num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ferric-vermilion);
    letter-spacing: 0.06em;
    padding-top: 2px;
}
.bib-entry p {
    margin: 0;
    font-size: 15.5px;
    color: var(--iron-ink);
    text-indent: 0;
}

/* ============================================================
   Plate V — Errata
   ============================================================ */
.errata-list {
    list-style: none;
    padding: 0;
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.errata-entry {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(200, 54, 45, 0.04);
    border-left: 2px solid var(--ferric-vermilion);
}
.errata-stamp {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--ferric-vermilion);
    font-weight: 500;
    letter-spacing: 0.04em;
}
.errata-entry p {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.55;
}
.errata-num {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--loyalist-cyan);
    margin-right: 6px;
}
.errata-invite {
    margin: 24px 0 0;
    font-style: italic;
    color: var(--civic-olive);
    text-align: center;
}

/* ============================================================
   Colophon (footer)
   ============================================================ */
.colophon {
    position: relative;
    background: var(--plate-cream);
    padding: 64px 32px 56px;
    border-top: 2px solid var(--iron-ink);
}
.colophon-inner {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}
.colophon-ornament {
    width: 240px;
    height: 40px;
    margin: 0 auto 18px;
    display: block;
}
.colophon-text {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.65;
    color: var(--iron-ink);
    margin: 0 0 22px;
}
.colophon-text em { color: var(--iron-ink); font-style: italic; }
.colophon-palette {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    flex-wrap: wrap;
}
.cp-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 0.75px solid var(--iron-ink);
}
.cp-vermilion { background: var(--ferric-vermilion); }
.cp-cyan      { background: var(--loyalist-cyan); }
.cp-olive     { background: var(--civic-olive); }
.cp-text { margin-left: 6px; }

.end-of-volume {
    position: relative;
    margin: 28px 0 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 0.32em;
    font-variant: small-caps;
    color: var(--iron-ink);
    display: inline-block;
    padding: 6px 12px;
}
.eov-base { position: relative; z-index: 1; }
.eov-tear {
    position: absolute;
    inset: 0;
    color: var(--ferric-vermilion);
    clip-path: inset(40% 0 40% 0);
    transform: translateX(0);
    opacity: 0;
    pointer-events: none;
}
.end-of-volume.tearing .eov-tear {
    opacity: 1;
    animation: eov-tear-anim 600ms steps(6, end);
}
@keyframes eov-tear-anim {
    0%   { transform: translateX(0);   clip-path: inset(40% 0 40% 0); }
    25%  { transform: translateX(-3px); clip-path: inset(20% 0 60% 0); }
    50%  { transform: translateX(3px);  clip-path: inset(60% 0 20% 0); }
    75%  { transform: translateX(-2px); clip-path: inset(35% 0 45% 0); }
    100% { transform: translateX(0);   clip-path: inset(40% 0 40% 0); opacity: 0; }
}

/* ============================================================
   to-top obelisk
   ============================================================ */
.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--plate-cream);
    border: 0.75px solid var(--iron-ink);
    padding: 8px 10px;
    cursor: pointer;
    transform: translateY(20px);
    opacity: 0;
    transition: transform var(--dur-elastic) var(--ease-elastic), opacity 200ms ease;
    z-index: 80;
}
.to-top.visible {
    transform: translateY(0);
    opacity: 1;
}
.to-top svg {
    width: 18px;
    height: 36px;
    display: block;
}
.to-top-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-top: 4px;
    color: var(--iron-ink);
}

/* ============================================================
   Plate body typography refinements
   ============================================================ */
.plate-body p { font-size: 17px; line-height: 1.65; }
.plate-body .lede { font-size: 17.5px; }
.drop-cap-text { font-weight: 500; }

/* ============================================================
   Mobile / responsive
   ============================================================ */
@media (max-width: 880px) {
    .treatise {
        grid-template-columns: 1fr;
        padding: 16px 16px 48px;
    }
    .rail {
        position: relative;
        margin: 0 0 16px;
    }
    .rail-inner {
        position: relative;
        top: 0;
        padding: 12px 0;
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 14px;
        align-items: start;
    }
    .rail-section-marker { margin-bottom: 0; }
    .rail-tickmarks { display: none; }
    .rail-marginalia {
        border-top: 0;
        padding-top: 0;
        grid-column: 1 / -1;
        font-size: 12px;
    }
    .fluted-column {
        width: 1px;
        right: -8px;
    }
    .fluted-column .flute-2,
    .fluted-column .flute-3 { display: none; }
    .body-column {
        margin-left: 0;
    }
    .drop-cap {
        width: 60px;
        height: 78px;
    }
    .drop-letter { font-size: 56px; }
    .instrument-grid {
        grid-template-columns: 1fr;
    }
    .chapters {
        gap: 18px;
        padding: 8px 16px;
        flex-wrap: wrap;
    }
    .ch-name { display: none; }
    .masthead {
        height: auto;
        padding: 24px 0;
    }
    .masthead-inner {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 0 16px;
        height: auto;
    }
    .vrule, .vol-tag { display: none; }
    .cartouche { margin-bottom: -20px; height: 90px; }
}

@media (max-width: 520px) {
    .plate { padding: 32px 12px; }
    .plate-numeral { font-size: 2rem; }
    .plate-title { font-size: 1.4rem; }
    .case-pair { gap: 10px; }
    .case-name { font-size: 16px; }
}
