/* =============================================================================
   The Humiliation Principle — app.css
   Direction: Ledger v2 · Adapted to the working application · 5 September 2026
   One file. No build step, no framework, no CDN, no runtime requests but /fonts and /media.

   Order: 1 fonts · 2 tokens · 3 reset · 4 shell · 5 layout · 6 outline · 7 document
          8 cards · 9 maths & diagrams · 10 notes · 11 popover, cite, banners
          12 cover · 13 generated pages · 14 author face · 15 states · 16 print
   ============================================================================= */

/* 1 ── fonts ─────────────────────────────────────────────────────────────────
   Self-hosted, open licence. STIX Two Text (SIL OFL) carries everything the
   reader sees; IBM Plex Mono (SIL OFL) appears only in the workshop and in
   machine strings (keys, permalinks, diffs). Subset to latin + latin-ext +
   the maths italics used inline. */
@font-face {
  font-family: "STIX Two Text";
  src: url("/fonts/STIXTwoText-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "STIX Two Text";
  src: url("/fonts/STIXTwoText-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "STIX Two Text";
  src: url("/fonts/STIXTwoText-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "STIX Two Text";
  src: url("/fonts/STIXTwoText-SemiBoldItalic.woff2") format("woff2");
  font-weight: 600; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

@font-face { font-family: "STIX Two Text"; src: url("/fonts/STIXTwoText-Regular-LatinExt.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "STIX Two Text"; src: url("/fonts/STIXTwoText-Italic-LatinExt.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "STIX Two Text"; src: url("/fonts/STIXTwoText-SemiBold-LatinExt.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "STIX Two Text"; src: url("/fonts/STIXTwoText-SemiBoldItalic-LatinExt.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-Regular-LatinExt.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-Medium-LatinExt.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* 2 ── tokens ───────────────────────────────────────────────────────────── */
:root {
  color-scheme: light dark;

  /* paper and ink — warm neutrals, chroma never above .012 */
  --paper:        #fcfbf7;
  --paper-sunk:   #f5f2ea;
  --paper-raised: #ffffff;
  --ink:          #17150f;
  --ink-2:        #3a3730;
  --ink-muted:    #6b665a;   /* 5.5:1 on --paper — carries every number and mark */
  --ink-faint:    #9d9787;   /* non-text only: disabled controls. Never informational text. */
  --rule:         #d8d4c8;
  --rule-faint:   #e8e5db;
  --rule-strong:  #17150f;

  /* signals — one lightness, one chroma, three hues. Never decorative. */
  --sig-negative:      oklch(42% .13 32);
  --sig-negative-wash: oklch(96% .028 32);
  --sig-positive:      oklch(42% .09 152);
  --sig-positive-wash: oklch(96% .024 152);
  --sig-pending:       oklch(45% .09 80);
  --sig-pending-wash:  oklch(96.5% .034 80);
  --focus:             oklch(50% .16 255);

  /* type */
  --font-text: "STIX Two Text", "Times New Roman", Times, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --fs-label:    0.75rem;    /* 12px — tracked small caps */
  --fs-fine:     0.8125rem;  /* 13px — margin notes, keys */
  --fs-small:    0.9375rem;  /* 15px — notes, outline, nav */
  --fs-body:     1.125rem;   /* 18px — the reading size */
  --fs-lede:     1.25rem;
  --fs-h3:       1.375rem;
  --fs-h2:       1.75rem;
  --fs-h1:       2.1875rem;  /* 35px — generated page heading */
  --fs-display:  3rem;
  --fs-cover:    4.125rem;   /* 66px */

  /* Document hierarchy is independent of whether a level has its own page. */
  --fs-title-book:       3.5rem;
  --fs-title-part:       3rem;
  --fs-title-chapter:    2.5rem;
  --fs-title-section:    2.1875rem;
  --fs-title-subsection: 1.75rem;

  --lh-text:  1.62;
  --lh-snug:  1.45;
  --lh-tight: 1.16;
  --track-caps: .2em;

  /* grid */
  --measure:     42rem;      /* 672px ≈ 73 characters at --fs-body */
  --col-outline: 21rem;
  --gutter-num:  5.5rem;     /* the hanging number band. Nothing else lives here. */
  --page-x:      2.5rem;
  --header-h:    3.625rem;
  --max-page:    100rem;

  /* space — 4px base */
  --s1: .25rem; --s2: .5rem;  --s3: .75rem; --s4: 1rem;   --s5: 1.5rem;
  --s6: 2rem;   --s7: 2.75rem; --s8: 3.5rem; --s9: 4.5rem; --s10: 6rem;

  /* other */
  --tap: 2.75rem;            /* 44px */
  --dyad-box: clamp(6.5rem, 16vh, 12.25rem);
  --math-scale: 1.06;        /* KaTeX beside STIX Two Text: x-heights agree here */
  --pop-w: 22rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #15140f;
    --paper-sunk:   #1c1a14;
    --paper-raised: #201e17;
    --ink:          #eae7dd;
    --ink-2:        #cac6b9;
    --ink-muted:    #9c9787;
    --ink-faint:    #6b6759;
    --rule:         #332f26;
    --rule-faint:   #26231c;
    --rule-strong:  #eae7dd;

    --sig-negative:      oklch(72% .12 32);
    --sig-negative-wash: oklch(26% .05 32);
    --sig-positive:      oklch(72% .09 152);
    --sig-positive-wash: oklch(26% .04 152);
    --sig-pending:       oklch(74% .09 80);
    --sig-pending-wash:  oklch(27% .045 80);
    --focus:             oklch(72% .15 255);
  }
}

/* 3 ── reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: var(--lh-text);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ol, ul, pre, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
a:hover { border-bottom-color: var(--ink); }
a:visited { color: var(--ink); }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 1px;
}

::selection { background: var(--sig-pending-wash); color: var(--ink); }

.num, time, .tabular { font-variant-numeric: tabular-nums lining-nums; }

.muted { color: var(--ink-muted); }

.label {
  font-size: var(--fs-label);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* 4 ── shell ────────────────────────────────────────────────────────────── */
.site-header {
  container: site-header / inline-size;
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s5);
  height: var(--header-h);
  padding-inline: var(--page-x);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.site-mark {
  flex: none;
  display: grid; place-items: center;
  width: var(--tap); height: var(--tap);
  margin-left: calc(var(--s2) * -1);
  border: 0;
  color: var(--ink);
}
.site-mark svg { display: block; width: 1.75rem; height: 1.75rem; }

.site-nav { display: flex; align-items: center; gap: var(--s5); font-size: var(--fs-small); }
.site-nav a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--ink-2); border-bottom: 0; }
.site-nav a:hover { color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink); }
.site-nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink); }

.site-search { margin-left: var(--s1); }
.site-search input {
  width: 11rem; height: 2rem;
  padding: 0 var(--s2);
  background: transparent;
  border: 0; border-bottom: 1px solid var(--rule);
  font-size: var(--fs-small);
}
.site-search input::placeholder { color: var(--ink-muted); }
.site-search input:focus-visible { border-bottom-color: var(--focus); }

.outline-toggle {
  display: none;
  align-items: center; gap: var(--s2);
  min-height: var(--tap); padding-inline: var(--s2);
  background: none; border: 0;
  font-size: var(--fs-small);
  box-shadow: inset 0 -1px 0 var(--ink);
}

/* 5 ── layout ───────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--col-outline) minmax(0, 1fr);
  max-width: var(--max-page);
  margin-inline: auto;
}

.text { padding: var(--s9) 0 var(--s10); min-width: 0; }

/* Reading and section editing have Contents and one main column; Workshop registers use
   the full frame without Contents. Workshop metadata belongs in
   the main flow; a legacy margin element must never recreate a third pane. */
.layout > .margin { display: none; }
.layout > .text {
  padding-inline-end: var(--page-x);
  container: workspace / inline-size;
}

/* 6 ── outline ──────────────────────────────────────────────────────────
   The rule belongs to the heading and stops there: it is drawn under the word
   "Contents" with 1.75rem of air before the first row, so no rule can ever
   arrive at the height of a hanging number. */
.outline {
  position: sticky; top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow: hidden auto; overscroll-behavior: contain;
  padding: var(--s9) var(--s4) var(--s8) var(--s6);
  border-right: 1px solid var(--rule-faint);
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
}
.outline > ol { margin-top: var(--s7); }

.outline li { display: grid; grid-template-columns: 2.5rem 1fr auto auto; align-items: baseline; }
.outline li > ol { grid-column: 1 / -1; }
.outline .num { color: var(--ink-muted); font-weight: 400; }
.outline a {
  grid-column: 2;
  display: block;
  padding: var(--s1) 0;
  color: var(--ink-2);
  font-weight: 400;
  border-bottom: 0;
  text-wrap: pretty;
}
.outline a:hover { color: var(--ink); }

/* every level starts at the same left edge: the number already carries the depth,
   so indentation would state it twice. Depth is a type step and group spacing. */
.outline .part      { margin-top: var(--s5); font-size: var(--fs-small); }
.outline .part > a  { color: var(--ink); }
.outline .chapter   { margin-top: var(--s3); font-size: var(--fs-small); }
.outline .section   { font-size: .90625rem; }
.outline .subsection{ font-size: .84375rem; }
.outline .front,
.outline .appendix  { margin-top: var(--s3); }
.outline .generated { margin-top: var(--s2); }
.outline .front:first-child { margin-top: 0; }
.outline .appendix + .appendix { margin-top: 0; }

/* Mark only the current entry; ancestor .current classes do not add emphasis. */
.outline li:is([aria-current="page"], [aria-current="location"]) > :is(a, .num) {
  color: var(--ink);
}

/* Collapsible groups: app.js sets data-collapsed on the li.
   The Ledger rules below place the control in the title's grid row. */
.outline li { position: relative; }
.outline li[data-collapsed] > ol { display: none; }
.outline .twist {
  position: absolute; left: -1.375rem; top: 0;
  width: 1.5rem; height: 1.5rem;
  background: none; border: 0;
  font-size: var(--fs-fine); color: var(--ink-muted);
  cursor: pointer;
}
.outline li[data-collapsed] > .twist::before { content: "+"; }
.outline .twist::before { content: "−"; }

/* 7 ── document ─────────────────────────────────────────────────────────
   Two columns: the number band, then the measure. Every child sits in the
   measure; only the section number is allowed into the band. */
.doc {
  display: grid;
  grid-template-columns: var(--gutter-num) minmax(0, var(--measure));
  justify-content: start;   /* the text hangs off the contents; free width collects
                               on the outer edge, as a page’s outer margin does */
  align-content: start;
  scroll-margin-top: calc(var(--header-h) + var(--s5));
}
.doc > * { grid-column: 2; }

/* Embedded parts, chapters and sections share the outer document's number band.
   Placing them in column 2 would add another gutter at every nesting level. */
.doc > .doc { grid-column: 1 / -1; }
@supports (grid-template-columns: subgrid) {
  .doc > .doc { grid-template-columns: subgrid; }
}

.doc-head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: baseline;
}
@supports not (grid-template-columns: subgrid) {
  .doc-head { grid-template-columns: var(--gutter-num) minmax(0, var(--measure)); }
}
.doc-head > .num {
  grid-column: 1;
  padding-right: var(--s5);
  text-align: right;
  font-size: var(--fs-h3);
  font-weight: 400;
  color: var(--ink-muted);
}
.doc-title {
  grid-column: 2;
  font-size: var(--fs-title-section);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -.008em;
  text-wrap: pretty;
}

.doc-tools {
  grid-column: 2;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4);
  margin-top: var(--s3);
  font-size: var(--fs-fine);
}
.doc-tools .permalink,
.doc-tools .cite-btn,
.doc-tools .share-btn,
.doc-tools .bookmark-btn {
  display: inline-flex; align-items: center;
  min-height: var(--tap); padding: 0;
  background: none; border: 0;
  color: var(--ink-muted);
  box-shadow: inset 0 -1px 0 var(--rule);
  cursor: pointer;
}
.doc-tools .permalink:hover,
.doc-tools .cite-btn:hover,
.doc-tools .share-btn:hover,
.doc-tools .bookmark-btn:hover { color: var(--ink); }
.doc-tools .permalink, .doc-tools .cite-btn, .doc-tools .share-btn, .doc-tools .bookmark-btn {
  font-family: var(--font-mono); font-size: .75rem; font-weight: 400;
  line-height: var(--lh-text);
  text-decoration: none;
}
/* "Copied" for a moment after the message went to the clipboard. */
.doc-tools .share-btn[data-state="copied"] { color: var(--ink); box-shadow: none; cursor: default; }
.doc-tools .permalink { min-width: 0; overflow-wrap: anywhere; }

.text p { margin-top: var(--s5); text-wrap: pretty; }
.doc-head + p, .doc-tools + p { margin-top: var(--s7); }
.text p:first-child { margin-top: 0; }

.text img {
  display: block;
  width: 100%; height: auto;
  margin: var(--s6) 0 0;
  background: var(--paper-sunk);
}

/* paragraph marks: quiet, always reachable. Padding gives a 44px tap target
   without touching the line box: the glyph sets at .9em, so the block padding has to carry the
   rest of the floor at both reading sizes. */
.para-link {
  margin-left: .35em;
  padding: .9375rem .75rem;
  border-bottom: 0;
  color: var(--ink-muted);
  font-size: .9em;
  opacity: 0;
  transition: opacity .12s linear;
}
p:hover > .para-link,
p:focus-within > .para-link,
.para-link:focus-visible { opacity: 1; }
.para-link:hover, .para-link:focus-visible { color: var(--ink); }
@media (hover: none) { .para-link { opacity: 1; } }
.para-glyph { display: inline-block; width: 1em; text-align: center; }
.para-link[data-state="copied"] { opacity: 1; }
.copy-status { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); }
.copy-status:not(.visually-hidden) { transform: translateX(-50%); z-index: 100; max-width: calc(100vw - 2rem); padding: .625rem .875rem; border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink); font: .75rem/1.5 var(--font-mono); text-align: center; pointer-events: none; }

/* cross-references and terms */
.xref { border-bottom: 1px solid var(--rule); }
.xref[data-target-type="section"] { font-variant-numeric: tabular-nums; }
.xref:hover { border-bottom-color: var(--ink); }
.xref.broken {
  color: var(--sig-negative);
  border-bottom: 1px dotted var(--sig-negative);
  cursor: help;
}
.xref.broken:hover { border-bottom-style: dotted; }

/* 8 ── cards ────────────────────────────────────────────────────────────
   No boxes, no fills, no left accents: a strong rule above, a hairline below,
   and a tracked label. The label is the ornament. */
.card { margin-top: var(--s6); }
.card > p { margin-top: var(--s2); }
.card > p:first-of-type { margin-top: var(--s2); }

.card-label {
  font-size: var(--fs-label);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-muted);
}
.card-link { position: relative; display: inline-block; min-width: calc(7ch + .7em); color: inherit; border: 0; text-decoration: none; }
/* Enlarge the label's hit area without moving the first prose baseline or adjacent figure. */
.card-link::before { content: ""; position: absolute; right: 0; top: 50%; width: 100%; min-width: 44px; height: 44px; transform: translateY(-50%); }
.card-link:is(:hover, :focus-visible) { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.card-link[data-state="copied"] { color: var(--ink); text-decoration: none; }
.card-title { font-size: var(--fs-label); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--ink); }
.card-title::before { content: "· "; color: var(--ink-muted); }

.card.term {
  padding: var(--s4) 0 var(--s5);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
}
.card.term p { font-size: 1.0625rem; }

.card.example {
  padding-left: var(--s6);
  border-left: 0;
}
.card.example p { color: var(--ink-2); font-size: 1.0625rem; }

.card.todo {
  padding: var(--s3) var(--s4);
  background: var(--sig-pending-wash);
  border: 1px dashed var(--sig-pending);
  font-size: 1rem;
}
.card.todo .card-label { color: var(--sig-pending); }
body.reader .card.todo { display: none; }

/* 9 ── maths and diagrams ───────────────────────────────────────────────
   KaTeX writes into .math. Inline maths is scaled to sit with STIX Two Text;
   display maths scrolls and never wraps. Only an explicitly authored tag has a label. */
.math { font-size: calc(1em * var(--math-scale)); }
/* KaTeX's own stylesheet enlarges .katex by 1.21; the scale above is the whole adjustment. */
.math .katex { font-size: 1em; }
.math-inline { white-space: nowrap; }

.math-display {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* Centre the differently sized text; keep trailing space outside both cells. */
  align-items: center;
  margin-top: var(--s6);
  padding-bottom: var(--s2);
  font-size: calc(1.15rem * var(--math-scale));
}
.math-display > .katex-display,
.math-display > .math-scroll {
  margin: 0;
  overflow-x: auto; overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.math-display::after {
  content: none;
  justify-self: end;
  font-family: var(--font-text);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}
.math-display[data-tag] { grid-template-columns: minmax(0, 1fr) 4.5rem; }
.math-display[data-tag]::after { content: "(" attr(data-tag) ")"; }
.math-display:not([data-tag]) > :is(.math-scroll, .katex-display) { grid-column: 1 / -1; }

pre.mermaid { overflow-x: auto; }
.diagram {
  margin-top: var(--s6);
  overflow-x: auto;
  text-align: center;
}
.diagram svg { max-width: 100%; height: auto; }
.diagram-error {
  margin-top: var(--s6);
  padding: var(--s3) var(--s4);
  background: var(--sig-negative-wash);
  border: 1px solid var(--sig-negative);
  font-family: var(--font-mono);
  font-size: var(--fs-fine);
  color: var(--sig-negative);
  white-space: pre-wrap;
}

/* 10 ── notes, citations, navigation ────────────────────────────────────
   One numbered sequence per chapter or front document, including its sections:
   the list carries the start attribute for its containing scope. */
sup.cite, sup.fn-ref {
  font-size: .68em;
  line-height: 0;
  vertical-align: .5em;
  font-variant-numeric: tabular-nums;
}
sup.cite:empty::before  { content: attr(data-n); }
sup.fn-ref:empty::before { content: attr(data-n); }
sup.cite a, sup.fn-ref a, sup.cite:hover, sup.fn-ref:hover { cursor: pointer; }

.footnotes {
  margin-top: var(--s8);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  color: var(--ink-2);
}
.footnotes ol { list-style: decimal; padding-left: 2.25rem; }
.footnotes li { margin-top: var(--s2); }
.footnotes li::marker { color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.doc-nav {
  display: flex; justify-content: space-between; gap: var(--s5);
  margin-top: var(--s8);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule-strong);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}
.doc-nav a {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-width: 0;
  min-height: var(--tap);
  color: var(--ink-2); border-bottom: 0;
}
.doc-nav a:hover { color: var(--ink); }
.doc-nav a[rel="prev"]::before { content: "←"; color: var(--ink-muted); }
.doc-nav a[rel="next"]::after  { content: "→"; color: var(--ink-muted); }

/* 11 ── popover, cite box, banners, margin marks ───────────────────────
   app.js sets --pop-x / --pop-y on #popover; the phone rule ignores them and
   docks the same element as a bottom sheet. */
/* Two ways in, one box. Where the browser supports anchor positioning, the panel
   pins itself to whatever opened it (app.js puts anchor-name on that element) and
   no coordinates exist to go stale; --pop-x/--pop-y stay as the fallback path. */
.popover {
  position: absolute;
  left: var(--pop-x, 0); top: var(--pop-y, 0);
  z-index: 40;
  width: var(--pop-w); max-width: calc(100vw - var(--s6));
  padding: var(--s4);
  background: var(--paper-raised);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgb(23 21 15 / .08);
  font-size: 1rem;
  line-height: var(--lh-snug);
}
.popover[hidden] { display: none; }
/* position-area re-bases left/top onto the anchor rather than replacing them, so the
   anchored path must clear both. app.js either sets data-anchored + anchor-name on the
   trigger, or falls back to --pop-x / --pop-y. */
@supports (position-area: bottom span-right) {
  .popover[data-anchored] {
    left: auto; top: auto;
    margin-top: .5rem;
    position-area: bottom span-right;
    position-try-fallbacks: flip-block, flip-inline;
  }
}
.popover .pop-head {
  display: flex; align-items: baseline; gap: var(--s2);
  margin-bottom: var(--s2);
  font-size: var(--fs-label);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-muted);
}
.popover .pop-num { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.popover .pop-title { font-weight: 600; font-size: 1.0625rem; line-height: var(--lh-snug); }
.popover .pop-body { margin-top: var(--s2); color: var(--ink-2); font-size: 1rem; }
.popover .pop-more { display: inline-flex; min-height: var(--tap); align-items: center; margin-top: var(--s2); font-size: var(--fs-fine); color: var(--ink-muted); }

.cite-box {
  position: fixed; right: var(--page-x); bottom: var(--s5);
  z-index: 45;
  width: 28rem; max-width: calc(100vw - var(--s6));
  padding: var(--s4);
  background: var(--paper-raised);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgb(23 21 15 / .08);
}
.cite-box[hidden] { display: none; }
.cite-box .cite-kind {
  display: flex; gap: var(--s4);
  margin-bottom: var(--s3);
  font-size: var(--fs-label); letter-spacing: var(--track-caps); text-transform: uppercase;
  color: var(--ink-muted);
}
.cite-box .cite-kind [aria-current] { color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink); }
.cite-text {
  margin: 0;
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: var(--lh-snug);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cite-box .copy {
  min-height: var(--tap); margin-top: var(--s3); padding-inline: var(--s4);
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink);
  font-size: var(--fs-small);
  cursor: pointer;
}
.cite-box .copy:hover { background: var(--ink-2); }
dialog.cite-box { margin: 0; inset: auto var(--page-x) var(--s5) auto; max-height: 80vh; overflow-y: auto; }
dialog.cite-box::backdrop { background: rgb(23 21 15 / .12); }
.cite-box .cite-close {
  margin-left: auto; min-height: var(--tap); padding: 0 var(--s2);
  font: inherit; letter-spacing: normal; text-transform: none;
  color: var(--ink-muted); border: 0; background: none; cursor: pointer;
}
dialog.cite-box .cite-kind { align-items: center; }
.cite-box .copy-status { margin-left: var(--s3); font-size: var(--fs-fine); color: var(--ink-muted); }

.version-banner {
  padding: var(--s3) var(--page-x);
  background: var(--sig-pending-wash);
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-small);
  color: var(--ink-2);
}
.version-banner a { color: var(--ink); border-bottom-color: var(--ink-muted); }

.mark {
  font-size: var(--fs-fine);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}
.mark + .mark { margin-top: var(--s3); }
.mark.referenced { font-variant-numeric: tabular-nums; }
body.reader .mark.referenced { display: none; }

/* 12 ── cover and holding page ──────────────────────────────────────────
   The mark's box is 12.25rem; the circle plus its dots reach 92.5% of the
   viewBox, so nothing can be clipped at any size. */
.cover {
  display: grid; place-content: center; justify-items: center;
  min-height: 100vh;
  padding: clamp(1.5rem, 5vh, 4.5rem) var(--page-x);
  text-align: center;
}
.dyad {
  display: grid; place-items: center;
  width: var(--dyad-box); aspect-ratio: 1;
  margin-bottom: clamp(1.5rem, 5vh, 4.5rem);
  color: var(--ink);
}
.dyad svg { display: block; width: 100%; height: 100%; }

.cover-title {
  width: min(100%, 47.5rem);
  padding-top: clamp(1.25rem, 3.5vh, 2.75rem);
  border-top: 1px solid var(--rule-strong);
  font-size: var(--fs-cover);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -.012em;
  text-wrap: balance;
}
.cover-subtitle { margin-top: var(--s4); font-size: 1.5625rem; font-style: italic; color: var(--ink-2); }
.cover-author { margin-top: clamp(1.5rem, 4vh, 3.5rem); font-size: 1.0625rem; letter-spacing: .18em; text-transform: uppercase; }
.cover-status {
  width: min(100%, 47.5rem);
  margin-top: clamp(1.25rem, 3.5vh, 2.75rem);
  padding-top: clamp(.75rem, 2vh, 1.5rem);
  border-top: 1px solid var(--rule);
  font-size: var(--fs-small);
  color: var(--ink-muted);
}
.cover-action {
  display: inline-flex; align-items: center;
  min-height: var(--tap);
  margin-top: clamp(1.5rem, 4vh, 3.5rem);
  font-size: 1.125rem;
  border-bottom: 1px solid var(--ink);
}
.cover-action:hover { box-shadow: inset 0 -2px 0 var(--ink); }

/* 13 ── generated pages: terminology, bibliography, search ─────────────── */
.page-head { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline; }
@supports not (grid-template-columns: subgrid) {
  .page-head { grid-template-columns: var(--gutter-num) minmax(0, var(--measure)); }
}
.page-head > .num { grid-column: 1; padding-right: var(--s5); text-align: right; font-size: var(--fs-h3); color: var(--ink-muted); }
.page-head > h1 { grid-column: 2; font-size: var(--fs-h1); font-weight: 600; line-height: var(--lh-tight); }
.page-lede { margin-top: var(--s4); color: var(--ink-2); font-size: 1.0625rem; }

.term-index {
  display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2);
  margin-top: var(--s6);
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-small);
}
.term-index :is(a, span) {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2rem; min-height: 2rem;
  border-bottom: 0; color: var(--ink-2);
}
.term-index a:hover { color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink); }
.term-index :is(a[aria-disabled="true"], span) { color: var(--ink-muted); opacity: .55; pointer-events: none; }

.termlist { margin-top: var(--s6); }
.termlist .card.term .card-label { display: none; }
.termlist .card.term { margin-top: 0; padding: var(--s5) 0; border-top: 1px solid var(--rule); border-bottom: 0; }
.termlist .card.term:first-child { border-top: 1px solid var(--rule-strong); }
.termlist .card.term .card-title { font-size: var(--fs-h3); letter-spacing: -.005em; text-transform: none; }
.termlist .card.term .card-title::before { content: ""; }
.term-source {
  display: inline-flex; align-items: center; min-height: var(--tap);
  margin-top: var(--s2);
  font-size: var(--fs-fine);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--rule);
}
.term-source:hover { color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink); }
.alpha-mark {
  margin-top: var(--s8);
  padding-bottom: var(--s2);
  font-size: var(--fs-h2);
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule-faint);
}

/* 14 ── author face ─────────────────────────────────────────────────────
   Same shell, same grid. The reading views only gain marks; the workshop
   screens (editor, history, publish) become tool-like. */
.doc.workshop { grid-template-columns: var(--gutter-num) minmax(0, 1fr); }
.workshop > * { min-width: 0; }
.workshop > p { max-width: var(--measure); }
.context-details {
  margin-top: var(--s4);
  padding-block: var(--s2);
  border-bottom: 1px solid var(--rule-faint);
  font-size: var(--fs-small);
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}
.context-details .mark { margin-top: var(--s2); }

.status {
  grid-column: 3; align-self: center;
  width: .5rem; height: .5rem; margin-left: var(--s2);
  border: 1px solid var(--ink-muted);
  border-radius: 50%;
}
.status-draft  { background: transparent; }
.status-review { background: linear-gradient(90deg, var(--sig-pending) 50%, transparent 50%); border-color: var(--sig-pending); }
.status-final  { background: var(--ink); border-color: var(--ink); }

body.reader .status { display: none; }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--rule);
  background: var(--paper-sunk);
  font-size: var(--fs-small);
}
.banner[hidden] { display: none; }
.banner .banner-num { font-family: var(--font-mono); font-size: var(--fs-fine); }
.banner.live { background: var(--sig-positive-wash); border-color: var(--sig-positive); }
.banner.live .banner-num { color: var(--sig-positive); }
.banner.conflict { background: var(--sig-negative-wash); border-color: var(--sig-negative); }
.banner button {
  min-height: var(--tap); padding-inline: var(--s3); white-space: nowrap;
  background: var(--paper-raised); border: 1px solid var(--ink);
  font-size: var(--fs-fine); cursor: pointer;
}
.banner .banner-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-left: auto; }

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s4);
  padding-inline-start: var(--page-x);
}
.editor > * { min-width: 0; }
.editor-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s4); min-width: 0; }
.editor-head .num {
  font-family: var(--font-mono); font-size: var(--fs-small);
  color: var(--ink-muted);
}
.editor-head input {
  flex: 1;
  min-width: 0;
  padding: var(--s2) 0;
  background: transparent;
  border: 0; border-bottom: 1px solid var(--rule);
  font-size: var(--fs-h2); font-weight: 600; letter-spacing: -.01em;
}
.editor-head input:focus-visible { border-bottom-color: var(--focus); }

.editor-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); min-height: 0; }
.pane { position: relative; display: grid; min-width: 0; min-height: 0; }
.pane[hidden] { display: none; }

.editor textarea {
  width: 100%; min-height: 26rem;
  padding: var(--s4);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: .9375rem;
  line-height: 1.7;
  resize: vertical;
  tab-size: 2;
}
.editor textarea:focus-visible { border-color: var(--focus); }

.pane.preview { min-height: 26rem; border: 1px solid var(--rule); background: var(--paper); overflow-y: auto; }
.pane.preview:focus { outline: none; }
.pane.preview > .text { padding: var(--s5); }
.pane.preview .doc { grid-template-columns: 3rem minmax(0, 1fr); }

.menu {
  position: absolute;
  left: clamp(0px, var(--menu-x, var(--s4)), max(0px, calc(100% - 15rem)));
  top: clamp(0px, var(--menu-y, var(--s4)), max(0px, calc(100% - 20rem)));
  z-index: 30;
  width: min(15rem, 100%);
  max-height: min(20rem, 100%);
  overflow-y: auto;
  overflow-wrap: anywhere;
  padding: var(--s1) 0;
  background: var(--paper-raised);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgb(23 21 15 / .08);
  font-family: var(--font-mono);
  font-size: var(--fs-fine);
}
.menu[hidden] { display: none; }
.menu .menu-label {
  padding: var(--s2) var(--s3);
  font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted);
}
.menu .item {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  min-height: 2.25rem; padding: var(--s1) var(--s3);
  cursor: pointer;
}
.menu .item .item-hint { margin-left: auto; color: var(--ink-muted); }
.menu .item.active { background: var(--ink); color: var(--paper); }
.menu .item.active .item-hint { color: var(--paper-sunk); }

.editor-bar {
  position: sticky; bottom: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  padding: var(--s3) 0 var(--s5);
  background: var(--paper);
  border-top: 1px solid var(--rule-strong);
  font-size: var(--fs-small);
}
.editor-bar select,
.editor-bar input {
  min-height: var(--tap); padding: 0 var(--s3);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  font-size: var(--fs-small);
}
.editor-bar input[name="message"] { flex: 1; min-width: 12rem; }
/* The primary action is a button in a form and a link when it leads somewhere; one shape. */
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding-inline: var(--s4);
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink);
  cursor: pointer;
}
a.primary { border-bottom: 1px solid var(--ink); }
.primary:hover { background: var(--ink-2); }
a.primary:hover { color: var(--paper); border-bottom-color: var(--ink-2); }
.primary:disabled { background: transparent; color: var(--ink-faint); border-color: var(--rule); cursor: not-allowed; }
.editor-bar button[type="button"] {
  min-height: var(--tap); padding-inline: var(--s4);
  background: var(--paper-raised); border: 1px solid var(--ink);
  cursor: pointer;
}
kbd {
  padding: 0 .25rem;
  border: 1px solid currentColor;
  font-family: var(--font-mono); font-size: .75em;
  opacity: .8;
}
#editor-status { font-size: var(--fs-fine); color: var(--ink-muted); }

/* history and diff */
.table-scroll {
  position: relative;
  min-width: 0; max-width: 100%; margin-top: var(--s6);
  overflow-x: auto; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.table-scroll > :is(.revisions, .rows) { margin-top: 0; }
.text .table-scroll-hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  margin-top: var(--s2); font-size: var(--fs-fine); color: var(--ink-muted);
}
.table-scroll-hint[hidden] { display: none; }
.table-scroll-message { flex: 1 1 10rem; }
.table-pan {
  flex: none; min-width: var(--tap); min-height: var(--tap);
  padding: 0 var(--s2); border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink); cursor: pointer;
}
.table-pan:disabled { color: var(--ink-faint); cursor: default; }
.table-scroll[data-overflow] :is(th, td):last-child {
  position: sticky; right: 0; z-index: 1;
  padding-left: var(--s2); background: var(--paper);
  box-shadow: -1px 0 0 var(--rule);
}
.revisions, .rows {
  width: 100%; margin-top: var(--s6); border-collapse: collapse;
  table-layout: fixed; font-size: var(--fs-small); overflow-wrap: anywhere;
}
.rows-notes { min-width: 42rem; }
.rows-sources, .rows-broken { min-width: 44rem; }
.revisions, .rows-changes { min-width: 48rem; }
.revisions th, .rows th {
  padding: var(--s2) var(--s3) var(--s2) 0;
  border-bottom: 1px solid var(--rule-strong);
  font-size: var(--fs-label); letter-spacing: var(--track-caps); text-transform: uppercase;
  font-weight: 400; color: var(--ink-muted); text-align: left;
}
.revisions td, .rows td { padding: var(--s3) var(--s3) var(--s3) 0; border-bottom: 1px solid var(--rule-faint); vertical-align: top; }
.revisions :is(th, td):last-child, .rows :is(th, td):last-child { padding-right: 0; }
.revisions th:nth-child(1) { width: 3rem; }
.revisions th:nth-child(2) { width: 10.5rem; }
.revisions th:nth-child(3) { width: 8rem; }
.revisions th:nth-child(5) { width: 8rem; }
.revisions th:last-child, .rows th:last-child { width: 4rem; }
.rows-notes th:nth-child(2) { width: 20%; }
.rows-notes th:nth-child(3) { width: 7rem; }
.rows-sources th:nth-child(2) { width: 16%; }
.rows-sources th:nth-child(3) { width: 6rem; }
.rows-broken th:nth-child(1) { width: 6rem; }
.rows-broken th:nth-child(2) { width: 23%; }
.rows-broken th:nth-child(4) { width: 7rem; }
.rows-broken th:last-child { width: 6rem; }
.rows-changes th:nth-child(1) { width: 8rem; }
.rows-changes th:nth-child(2) { width: 22%; }
.rows-changes th:nth-child(3) { width: 8rem; }
.rows-changes th:nth-child(5) { width: 7rem; }
.revisions td:last-child a, .rows td:last-child a, .changed li > a, .checks li > a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); min-width: var(--tap);
  margin-block: -.625rem;
  border: 0; text-decoration: underline; text-underline-offset: .2em;
}
.changed li > a, .checks li > a { margin-block: 0; }
.revisions .rev-num, .revisions .rev-date, .rows .mono { font-family: var(--font-mono); font-size: var(--fs-fine); color: var(--ink-muted); }
/* A label breaks at spaces, never inside a word: "Introduction, II" is a name, not an identifier. */
.rows td.mono, .revisions .rev-num, .revisions .rev-date { overflow-wrap: normal; word-break: normal; }
.revisions tr[aria-current] .rev-num { color: var(--ink); }
.revisions .rev-actor.is-claude, .rows .is-claude { color: var(--sig-positive); }

.diff {
  margin-top: var(--s6);
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  counter-reset: diffline;
  font-family: var(--font-mono);
  font-size: var(--fs-fine);
  line-height: 1.75;
  overflow-x: auto;
}
.diff > div { position: relative; padding: 0 var(--s4) 0 4rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff > div::before {
  counter-increment: diffline;
  content: counter(diffline);
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 2.75rem; padding-right: var(--s2);
  border-right: 1px solid var(--rule-faint);
  color: var(--ink-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.diff-eq { color: var(--ink-2); }
.diff-del { background: var(--sig-negative-wash); color: var(--ink); }
.diff-add { background: var(--sig-positive-wash); color: var(--ink); }
.diff del { background: color-mix(in oklab, var(--sig-negative) 22%, transparent); text-decoration: line-through; }
.diff ins { background: color-mix(in oklab, var(--sig-positive) 22%, transparent); text-decoration: none; }

/* publish */
.publish { margin-top: var(--s6); }
.publish h2, .publish .publish-label, .section-label {
  margin-top: var(--s7);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-label); letter-spacing: var(--track-caps); text-transform: uppercase;
  font-weight: 400; color: var(--ink-muted);
}
.checks, .changed { font-size: var(--fs-small); }
.checks li, .changed li {
  display: grid; grid-template-columns: 1.75rem 1fr auto;
  align-items: baseline;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule-faint);
}
.checks li::before { font-family: var(--font-mono); }
.checks li.ok::before   { content: "✓"; color: var(--sig-positive); }
.checks li.fail::before { content: "×"; color: var(--sig-negative); }
.checks li.fail { color: var(--ink); }
.changed li { grid-template-columns: 7rem minmax(0, 1fr) auto; gap: var(--s3); font-variant-numeric: tabular-nums; }
/* Front matter is named rather than numbered, so this cell holds a title as well as a §: it wraps
   at spaces and never runs into the column beside it. */
.changed .changed-num {
  min-width: 0; font-family: var(--font-mono); font-size: var(--fs-fine); color: var(--ink-muted);
  overflow-wrap: normal; word-break: normal; line-height: var(--lh-snug);
}
.publish-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s6); }
.publish-status { font-size: 1rem; }
.publish-bar input { flex: 1 1 14rem; min-width: 0; width: 100%; min-height: var(--tap); padding: 0 var(--s3); background: var(--paper-raised); border: 1px solid var(--rule); }
.publish-reasons { margin-top: var(--s3); font-size: var(--fs-fine); color: var(--sig-negative); }


/* 18 ── book, part and chapter views ────────────────────────────────────
   The same .doc, one level up: the number in its band, and an inline contents
   for what the level contains. */
/* The first embedded document needs air after contents or introductory text too. */
.doc > .doc { margin-top: var(--s9); }
.doc + .doc { margin-top: var(--s10); padding-top: var(--s8); border-top: 1px solid var(--rule); }
/* Use the document's semantic level, never DOM nesting or the current view. */
.doc.level-book > .doc-head > .doc-title { font-size: var(--fs-title-book); line-height: 1.08; }
.doc.level-part > .doc-head > .doc-title { font-size: var(--fs-title-part); line-height: 1.08; }
.doc.level-chapter > .doc-head > .doc-title { font-size: var(--fs-title-chapter); }
.doc.level-front > .doc-head > .doc-title { font-size: var(--fs-title-chapter); }
.doc.level-section > .doc-head > .doc-title { font-size: var(--fs-title-section); }
.doc.level-subsection > .doc-head > .doc-title { font-size: var(--fs-title-subsection); }
.doc-summary { margin-top: var(--s5); font-size: var(--fs-lede); line-height: var(--lh-snug); color: var(--ink-2); text-wrap: pretty; }
.text .preview-note { margin-top: var(--s3); font-size: var(--fs-fine); color: var(--ink-muted); }

.contents-inline { margin-top: var(--s6); font-size: var(--fs-small); }
.contents-inline li {
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: baseline; gap: 0 var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule-faint);
}
.contents-inline li:first-child { border-top: 1px solid var(--rule); }
.contents-inline .num { color: var(--ink-muted); font-size: .9em; }
.contents-inline a { border-bottom: 0; }
.contents-inline a:hover { box-shadow: inset 0 -1px 0 var(--ink); }
.contents-inline .count { font-size: var(--fs-fine); color: var(--ink-muted); white-space: nowrap; }

/* 19 ── bibliography ──────────────────────────────────────────────────── */
.biblist { margin-top: var(--s6); }
.bib-entry {
  padding: var(--s4) 0 var(--s5);
  border-top: 1px solid var(--rule);
  padding-left: 2rem; text-indent: -2rem;
  font-size: 1.0625rem; line-height: var(--lh-snug);
}
.bib-entry:first-child { border-top: 1px solid var(--rule-strong); }
.bib-cited-in {
  display: block; margin-top: var(--s2); text-indent: 0;
  font-size: var(--fs-fine); font-variant-numeric: tabular-nums; color: var(--ink-muted);
}
.bib-cited-in a { color: var(--ink-muted); }
.bib-doi { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-muted); }

/* 20 ── search ────────────────────────────────────────────────────────── */
.search-form { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }
.search-form input {
  flex: 1; min-width: 0; min-height: var(--tap); padding: 0 var(--s3);
  background: var(--paper-raised); border: 1px solid var(--rule);
  font-family: var(--font-text); font-size: var(--fs-body);
}
.search-summary { margin-top: var(--s4); font-size: var(--fs-fine); font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.result a { border-bottom: 0; }
.result .result-title { display: block; margin-top: var(--s1); font-weight: 600; }
.result p { margin-top: var(--s2); font-size: 1.0625rem; line-height: var(--lh-snug); color: var(--ink-2); }

/* 21 ── author: dashboard, to-do, broken references, notes, sources ───── */
/* The separators are drawn by each card, not by a coloured grid behind them: a row that does not
   fill would otherwise end in a block of rule colour. */
.dash {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: 1px;
  margin-top: var(--s6);
  background: transparent;
}
.dash-card { padding: var(--s4); background: var(--paper); box-shadow: 0 0 0 1px var(--rule); }
.dash-card .card-label { display: block; margin-bottom: var(--s3); }
.dash-figure { font-family: var(--font-mono); font-size: 2rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.dash-note { margin-top: var(--s2); font-size: var(--fs-fine); line-height: var(--lh-snug); color: var(--ink-muted); }
.dash-card.is-blocked .dash-figure { color: var(--sig-negative); }
.dash-card.is-ok .dash-figure { color: var(--sig-positive); }
.dash-card.is-pending .dash-figure { color: var(--sig-pending); }

.todolist { display: grid; gap: var(--s4); margin-top: var(--s6); }
.todolist .card.todo { margin-top: 0; }
.todo-where {
  display: inline-flex; align-items: center; min-height: var(--tap);
  font-size: var(--fs-fine); font-variant-numeric: tabular-nums;
  color: var(--sig-pending); border-bottom: 0; box-shadow: inset 0 -1px 0 currentColor;
}
.broken-target { font-family: var(--font-mono); font-size: var(--fs-fine); color: var(--sig-negative); }

.taglist { display: flex; flex-wrap: wrap; gap: var(--s1); }
.tag {
  display: inline-flex; align-items: center; min-height: 1.5rem; padding: 0 .4rem;
  border: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: .6875rem; color: var(--ink-muted);
}
.add-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  margin-top: var(--s6); padding: var(--s4);
  background: var(--paper-sunk); border: 1px solid var(--rule);
}
.add-form input {
  flex: 1 1 14rem; min-width: 0; width: 100%; min-height: var(--tap); padding: 0 var(--s3);
  background: var(--paper-raised); border: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: var(--fs-small);
}
.add-form .add-hint { flex-basis: 100%; font-size: var(--fs-fine); color: var(--ink-muted); }

/* specimen sheets only (states.html): a demo popover stays inside its own box at
   every width instead of docking as the bottom sheet. Never used by a real page. */
.popover-specimen { position: relative; }
.popover-specimen .popover {
  position: absolute; inset: auto; left: 0; top: 0;
  width: 100%; max-width: none;
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgb(23 21 15 / .08);
}
/* This author sample is intentionally visible on the component sheet only. */
body.reader .author-specimen.card.todo,
body.reader .author-specimen .status { display: block; }

/* 15 ── states, search, motion ─────────────────────────────────────────── */
.results { margin-top: var(--s6); }
.result { padding: var(--s5) 0; border-bottom: 1px solid var(--rule-faint); }
.result .result-num { font-family: var(--font-mono); font-size: var(--fs-fine); color: var(--ink-muted); }
.result mark { background: var(--sig-pending-wash); color: var(--ink); }
.empty-state { margin-top: var(--s6); padding: var(--s6) 0; border-top: 1px solid var(--rule); color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  .para-link { transition: none; }
  .dyad * { animation: none !important; transition: none !important; }
}

/* 16 ── responsive ─────────────────────────────────────────────────────── */
/* Em-based queries also respond when the reader enlarges text independently. */
@media (min-width: 48rem) {
  @container site-header (max-width: 58em) {
    .site-search { display: none; }
  }
}
@media (max-width: 74.99rem) {
  :root { --col-outline: 18rem; --page-x: 2rem; }
  .layout { grid-template-columns: var(--col-outline) minmax(0, 1fr); }
}

@media (max-width: 47.99rem) {
  :root {
    --fs-body: 1.0625rem;
    --fs-h1: 1.5625rem;
    --fs-cover: 2.375rem;
    --fs-display: 2rem;
    --fs-title-book: 2.25rem;
    --fs-title-part: 2rem;
    --fs-title-chapter: 1.75rem;
    --fs-title-section: 1.5625rem;
    --fs-title-subsection: 1.375rem;
    --page-x: 1.25rem;
    --gutter-num: 0rem;
    --dyad-box: 7.375rem;
    --header-h: 3.25rem;
  }
  .site-header { gap: var(--s3); }
  .site-nav, .site-search { display: none; }
  .outline-toggle { display: inline-flex; }

  .layout { grid-template-columns: minmax(0, 1fr); }
  .text { padding: var(--s6) var(--page-x) var(--s9); }

  .layout > .outline {
    position: fixed; inset: var(--header-h) 0 0 0;
    z-index: 25;
    max-height: none;
    padding: var(--s5) var(--page-x) var(--s9);
    background: var(--paper);
    border-right: 0;
    transform: translateX(-100%);
    transition: transform .16s ease-out;
  }
  .layout > .outline[data-open] { transform: none; }
  .outline a { min-height: var(--tap); display: flex; align-items: center; }
  /* In the drawer the twist is touched, so it takes a full target at the end of its row,
     where there is room the left margin does not have. */
  .outline .twist { left: auto; right: 0; top: 0; width: var(--tap); height: var(--tap); }
  .outline .section, .outline .subsection { font-size: var(--fs-small); }
  @media (prefers-reduced-motion: reduce) { .layout > .outline { transition: none; } }

  .doc, .doc.workshop, .doc-head, .page-head { grid-template-columns: minmax(0, 1fr); }
  .doc > *, .doc-head > *, .page-head > .num, .page-head > h1 { grid-column: 1; }
  .doc-head > .num, .page-head > .num {
    padding-right: 0;
    text-align: left;
    font-size: var(--fs-small);
    order: -1;
    margin-bottom: var(--s2);
  }
  .card.example { padding-left: var(--s4); }
  .math-display[data-tag] { grid-template-columns: minmax(0, 1fr) 3.25rem; }

  .popover {
    position: fixed; inset: auto 0 0 0;
    width: auto; max-width: none;
    max-height: 62vh; overflow-y: auto;
    padding: var(--s5) var(--page-x) var(--s6);
    border: 0; border-top: 1px solid var(--ink);
    box-shadow: 0 -6px 24px rgb(23 21 15 / .12);
  }
  .popover[data-anchored] { position-area: none; margin-top: 0; left: auto; top: auto; }
  .cite-box { position: fixed; inset: auto 0 0 0; width: auto; max-width: none; border: 0; border-top: 1px solid var(--ink); }
  dialog.cite-box { inset: auto 0 0 0; width: 100%; max-height: 70vh; }

  .popover-specimen { min-height: 20rem; }

  .editor { padding-inline: 0; }
  .editor-bar input[name="message"] { flex-basis: 100%; min-width: 0; }
  .editor-bar { padding-bottom: var(--s4); }
  .contents-inline li { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .contents-inline .count { display: none; }

}

/* The editor responds to its available width. Tables always retain their native
   rows and columns; only their containing .table-scroll region may scroll. */
@container workspace (max-width: 56rem) {
  .editor-bar { position: static; }
}

/* 23 — Ledger v2 adaptation, 5 September 2026.
   Visual vocabulary from the supplied Ledger references; the live application's
   semantic tables, scientific rendering and interaction contracts remain in use. */
:root {
  color-scheme: light;
  --paper: #fff; --paper-sunk: #eef0f2; --paper-raised: #fff; --canvas: #fff;
  --ink: #16181c; --ink-2: #41464e; --ink-muted: #5a6069; --ink-faint: #78808a;
  --rule: #dfe2e6; --rule-faint: #eceef1; --rule-strong: #16181c; --outline-divider: #000; --rule-link: #c8cdd3;
  --definition: #f7f8f9; --active: #f2f4f6;
  --chip-fill: rgb(22 24 28 / .055); --chip-edge: rgb(22 24 28 / .1);
  --sig-negative: #9b2c1a; --sig-negative-wash: #fff2ed;
  --sig-positive: #1f5c3d; --sig-positive-wash: #edf5f0;
  --sig-pending: #805416; --sig-pending-wash: #faf5e9; --focus: #16181c;
  --fs-body: 1.15625rem; --fs-label: .6875rem; --fs-fine: .8125rem;
  --fs-h1: 2.125rem; --fs-title-book: 3.5rem; --fs-title-part: 3rem;
  --fs-title-chapter: 2.5rem; --fs-title-section: 2.125rem; --fs-title-subsection: 1.875rem;
  --lh-text: 1.62; --track-caps: .12em;
  --col-outline: 20.5rem; --gutter-num: 5.5rem; --ledger-inset: 1.5rem;
  --row-start: calc(var(--gutter-num) + var(--ledger-inset));
  --ledger-end: var(--row-start); --measure: 44.5rem; --header-h: 3.75rem; --strip-h: 2.75rem;
  --page-x: 1.5rem; --max-page: calc(var(--col-outline) + var(--row-start) + var(--measure) + var(--row-start)); --pop-w: 22.25rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15171a; --paper-sunk: #1b1e22; --paper-raised: #1b1e22; --canvas: #111316;
    --ink: #e7eaee; --ink-2: #b9c0c8; --ink-muted: #8d959e; --ink-faint: #7f8892;
    --rule-strong: #565d66; --rule: #2c3137; --rule-faint: #24282d; --outline-divider: #565d66; --rule-link: #3a4046;
    --definition: #1b1e22; --active: #22262b;
    --chip-fill: rgb(231 234 238 / .07); --chip-edge: rgb(231 234 238 / .18);
    --sig-negative: #e2846c; --sig-negative-wash: #30201e;
    --sig-positive: #7fb894; --sig-positive-wash: #1b2922;
    --sig-pending: #d1ae75; --sig-pending-wash: #2a251d; --focus: #e7eaee;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15171a; --paper-sunk: #1b1e22; --paper-raised: #1b1e22; --canvas: #111316;
  --ink: #e7eaee; --ink-2: #b9c0c8; --ink-muted: #8d959e; --ink-faint: #7f8892;
  --rule-strong: #565d66; --rule: #2c3137; --rule-faint: #24282d; --outline-divider: #565d66; --rule-link: #3a4046;
  --definition: #1b1e22; --active: #22262b;
  --chip-fill: rgb(231 234 238 / .07); --chip-edge: rgb(231 234 238 / .18);
  --sig-negative: #e2846c; --sig-negative-wash: #30201e;
  --sig-positive: #7fb894; --sig-positive-wash: #1b2922;
  --sig-pending: #d1ae75; --sig-pending-wash: #2a251d; --focus: #e7eaee;
}
html { background: var(--paper); scroll-padding-top: var(--anchor-offset, calc(var(--header-h) + var(--strip-h))); }
@media screen {
  html { scrollbar-gutter: stable; }
  body:has(> :is(.layout, .cover)) {
    /* Fine page edges: dense hairlines widen and fade into the outer canvas. */
    --canvas-lines:
      var(--rule) 0 1px, transparent 1px 3px,
      color-mix(in srgb, var(--rule) 70%, transparent) 3px 4px, transparent 4px 7px,
      color-mix(in srgb, var(--rule) 55%, transparent) 7px 8px, transparent 8px 12px,
      color-mix(in srgb, var(--rule) 43%, transparent) 12px 13px, transparent 13px 18px,
      color-mix(in srgb, var(--rule) 33%, transparent) 18px 19px, transparent 19px 26px,
      color-mix(in srgb, var(--rule) 25%, transparent) 26px 27px, transparent 27px 36px,
      color-mix(in srgb, var(--rule) 18%, transparent) 36px 37px, transparent 37px 49px,
      color-mix(in srgb, var(--rule) 12%, transparent) 49px 50px, transparent 50px 66px,
      color-mix(in srgb, var(--rule) 7%, transparent) 66px 67px, transparent 67px 88px,
      color-mix(in srgb, var(--rule) 3%, transparent) 88px 89px, transparent 89px;
    background-color: var(--canvas);
    background-image: linear-gradient(to left, var(--canvas-lines)), linear-gradient(to right, var(--canvas-lines));
    background-size: max(0px, calc((100% - var(--max-page)) / 2)) 100%;
    background-position: left top, right top;
    background-repeat: no-repeat;
  }
  .layout, .cover { background: var(--paper); }
  .cover { max-width: var(--max-page); margin-inline: auto; }
}
[hidden] { display: none !important; }
.skip-link { position: fixed; top: .5rem; left: max(.5rem, calc((100% - var(--max-page)) / 2 + .5rem)); z-index: 100; min-height: 44px; padding: .625rem .875rem; border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink); font: .8125rem/1.5 var(--font-mono); transform: translateY(calc(-100% - 1rem)); }
.skip-link:focus { transform: none; }
.num, .label, .card-label, .section-label,
.todo-where, .search-summary, .term-index, .pop-head, .pop-more, .cite-kind,
.primary, .editor-bar, .add-form button, .banner-actions, .cover-status {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.site-header, .crumb { max-width: var(--max-page); margin-inline: auto; }
.site-header {
  position: sticky; top: 0; z-index: 50; display: flex; gap: 1.5rem;
  min-height: var(--header-h); padding: 0 .75rem; border-bottom: 1px solid var(--rule-strong);
}
.site-mark { margin: 0; justify-items: start; }
.header-menu { display: contents; }
.site-nav { flex: none; gap: 1.375rem; min-width: 0; font-size: 1rem; }
.site-nav .mobile-search-link { display: none; }
.site-search { display: block; flex: 0 1 12.5rem; margin-left: auto; }
.site-search input { width: 100%; font: .8125rem var(--font-mono); }
.view-switch { display: inline-flex; align-items: center; justify-content: center; gap: .625rem; flex: 1 0 auto; font: 400 .8125rem/1.4 var(--font-mono); letter-spacing: 0; }
.view-switch > :is(a, span) { display: inline-flex; align-items: center; justify-content: center; gap: .625rem; min-height: var(--tap); padding: 0; border: 0; color: var(--ink-muted); white-space: nowrap; }
.view-switch > [aria-current] { color: var(--ink); font-weight: 500; }
.view-switch > a:hover { color: var(--ink); }
.view-switch-track { position: relative; display: block; flex: none; width: 30px; height: 16px; border: 1px solid var(--rule-link); border-radius: 999px; background: var(--active); }
.view-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.view-switch:has(> [aria-current]:last-child) .view-switch-track::after { left: 16px; }
.view-switch > a:hover .view-switch-track { border-color: var(--ink-muted); }
.view-switch + .site-search { margin-left: 0; }
.site-nav a:is(:hover, [aria-current]) { box-shadow: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }
.bookmark-nav { gap: .375rem; white-space: nowrap; }
.bookmark-count { display: inline-grid; place-items: center; flex: none; min-width: 1.25rem; aspect-ratio: 1; padding: 0 .1875rem; border: 1px solid currentColor; border-radius: 50%; color: var(--ink-muted); font: 400 .625rem/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.site-nav .bookmark-nav:is(:hover, [aria-current]) { text-decoration: none; }
.site-nav .bookmark-nav:is(:hover, [aria-current]) .bookmark-nav-label { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }
.theme-controls { display: flex; align-items: center; gap: .375rem; margin-left: auto; flex: none; }
.site-header .theme-controls { margin-left: 0; }
.theme-toggle { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; background: none; border: 0; cursor: pointer; }
.site-header .theme-toggle { justify-items: end; }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .fill-left { display: none; }
.theme-toggle[aria-pressed="true"] .fill-left { display: block; }
.theme-toggle[aria-pressed="true"] .fill-right { display: none; }
.cover-controls { position: absolute; top: 1rem; right: calc(max(0px, (100% - var(--max-page)) / 2) + 1.5rem); z-index: 2; }
.crumb {
  position: sticky; top: var(--header-h); z-index: 45;
  display: flex; align-items: stretch; min-height: var(--strip-h);
  background: var(--paper); border-bottom: 1px solid var(--rule-strong);
  font: 500 .6875rem/1.4 var(--font-mono); letter-spacing: .07em;
}
.crumb-state, .crumb .reading-time { display: flex; align-items: center; padding: .5rem 1rem; margin: 0; color: var(--ink-muted); }
.crumb-state { text-transform: uppercase; border-right: 1px solid var(--rule); }
.crumb-path { display: flex; flex: 1; min-width: 0; overflow: auto hidden; scrollbar-width: thin; text-transform: uppercase; letter-spacing: .12em; }
.crumb-path > :is(a, span) { display: flex; flex: none; align-items: center; min-height: var(--strip-h); padding: .5rem 1rem; border: 0; border-right: 1px solid var(--rule); color: var(--ink-muted); white-space: nowrap; }
.crumb-path > [aria-current] { color: var(--ink); }
.crumb-path a:hover, .crumb-path a:focus-visible { color: var(--ink); background: var(--active); }
.crumb .reading-time { margin-left: auto; border-left: 1px solid var(--rule); font: inherit; }
.crumb .reading-time { flex: none; white-space: nowrap; }
.reading-time-value { white-space: nowrap; }
.crumb .document-action { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 5.5rem; min-height: var(--strip-h); padding: .5rem 1rem; border: 0; border-inline: 1px solid var(--rule); background: var(--ink); color: var(--paper); font: inherit; letter-spacing: 0; }
.crumb .document-action { white-space: nowrap; }
.crumb .document-action:is(:hover, :focus-visible) { background: var(--ink-2); }
.nav-new { display: inline-flex; flex: none; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); border: 0; color: var(--ink-2); font: 1rem var(--font-text); }
.nav-new:is(:hover, :focus-visible, [aria-current]) { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.workshop-menu { position: relative; flex: none; }
.workshop-menu > summary { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0; color: var(--ink-2); font: 1rem var(--font-text); cursor: pointer; list-style: none; }
/* Center STIX's visible letterforms on the logo dots, with one shared baseline. */
.site-nav > a, .nav-new, .workshop-menu > summary { line-height: 1.25; padding-block: .125em 0; }
.workshop-menu > summary:is(:hover, :focus-visible), .workshop-menu[open] > summary { color: var(--ink); }
.workshop-menu > summary:is(:hover, :focus-visible) > span, .workshop-menu[open] > summary > span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }
.workshop-menu > summary::-webkit-details-marker { display: none; }
.workshop-menu > summary::after { content: "+"; font-size: 1rem; }
.workshop-menu[open] > summary::after { content: "−"; }
.workshop-nav { position: absolute; top: calc(100% + (var(--header-h) - 44px) / 2); left: 0; z-index: 60; display: grid; min-width: 15rem; max-width: calc(100vw - 1rem); max-height: calc(100dvh - var(--header-h) - 1rem); overflow-y: auto; padding: .375rem 0; background: var(--paper-raised); border: 1px solid var(--rule-strong); box-shadow: 0 8px 20px rgb(0 0 0 / .1); }
.workshop-nav a { display: flex; align-items: center; min-height: 44px; padding: .5rem 1rem; border: 0; font: .8125rem/1.4 var(--font-mono); letter-spacing: 0; }
.workshop-nav a:hover, .workshop-nav a:focus-visible { background: var(--active); }
.workshop-nav .workshop-export { border-top: 1px solid var(--rule); }
.layout { position: relative; grid-template-columns: var(--col-outline) minmax(0, 1fr); min-height: calc(100dvh - var(--header-h) - var(--strip-h)); }
/* Rows meet the divider's inner edge; the divider stays above their paint. */
.layout::before { content: ""; position: absolute; z-index: 3; left: calc(var(--col-outline) - 1px); inset-block: 0; border-left: 1px solid var(--outline-divider); pointer-events: none; }
.layout.layout-wide { grid-template-columns: minmax(0, 1fr); }
.layout.layout-wide::before { content: none; }
.layout > .text { position: relative; padding: 0 0 5rem; max-width: none; --ledger-end: max(var(--row-start), calc(100cqw - var(--row-start) - var(--measure))); }
.layout > .text::before { content: ""; position: absolute; inset-block: 0; left: var(--gutter-num); border-left: 1px solid var(--rule); pointer-events: none; }
.layout > .text::after { content: ""; position: absolute; inset-block: 0; right: var(--gutter-num); border-left: 1px solid var(--rule-faint); pointer-events: none; }
.layout > .text:has(> .workshop), .layout > .text:has(> .editor) { --ledger-end: 2.5rem; }
.layout > .text:has(> .workshop)::after, .layout > .text:has(> .editor)::after { content: none; }
.layout > .text:has(.editor)::before { content: none; }
.outline-links { display: none; }
.outline { top: calc(var(--header-h) + var(--strip-h)); max-height: calc(100dvh - var(--header-h) - var(--strip-h)); padding: 0 1px 2.5rem 0; border: 0; font-size: .9375rem; scrollbar-width: none; }
.outline-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; min-height: 48px; padding: 0 .5rem 0 1.25rem; border-bottom: 1px solid var(--rule); background: var(--paper); color: var(--ink-muted); font: 500 .6875rem var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.outline-actions { display: flex; margin-left: auto; }
.outline-actions button { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink-muted); cursor: pointer; }
.outline-actions button svg { width: 18px; height: 18px; }
.outline-actions button:not([aria-disabled="true"]):is(:hover, :focus-visible) { background: var(--active); color: var(--ink); }
.outline-actions button[aria-disabled="true"] { opacity: .4; cursor: default; }
.outline > ol { margin: 0; }
.outline li { grid-template-columns: minmax(5.25rem, max-content) minmax(0, 1fr) auto auto; align-items: stretch; isolation: isolate; font-size: .9375rem !important; margin: 0; }
/* Paint only this entry's row, including its status columns, never its children. */
.outline li::before { content: ""; grid-area: 1 / 1 / 2 / -1; z-index: -1; border-bottom: 1px solid var(--rule-faint); pointer-events: none; }
.outline li > :is(.num, a, .status) { grid-row: 1; }
.outline li > :is(.num, a) { display: flex; align-items: center; border-bottom: 1px solid transparent; min-height: 44px; padding-block: .625rem; }
.outline li > .num { grid-column: 1; padding-left: 1.75rem; padding-right: .4rem; font: 500 .6875rem/1.9 var(--font-mono); letter-spacing: .1em; text-align: left; white-space: nowrap; }
.outline li:not(:has(> .num)) > a { grid-column: 1 / 3; padding-left: 5.25rem; }
.outline li > a { padding-right: .75rem; color: var(--ink-2); font-size: inherit; line-height: 1.45; }
.outline li > .num + a { padding-left: 0; }
.outline li.part + .part, .outline li.chapter + .chapter, .outline li.appendix { margin-top: 1.25rem; }
.outline li:is([aria-current="page"], [aria-current="location"])::before { background: var(--active); box-shadow: inset 3px 0 0 var(--ink); }
.outline li:is([aria-current="page"], [aria-current="location"]) > :is(.num, a) { color: var(--ink); }
.outline li:is([aria-current="page"], [aria-current="location"]) > .num { font-weight: 500; }
.outline li:is([aria-current="page"], [aria-current="location"]) > a { font-weight: 400; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
/* The control shares the title's grid row, so an open subtree never moves it.
   Its 44px target extends through the non-interactive number band. */
.outline .twist { position: relative; inset: auto; grid-area: 1 / 1; align-self: stretch; width: 44px; height: auto; min-height: 44px; padding: 0; z-index: 1; }
.outline .twist::before, .outline .twist::after { content: ""; position: absolute; left: 13px; top: calc(50% - .5px); background: currentColor; transform: translate(-50%, -50%); }
.outline .twist::before, .outline li[data-collapsed] > .twist::before { content: ""; width: 9px; height: 1px; }
.outline .twist::after { width: 1px; height: 9px; display: none; }
.outline li[data-collapsed] > .twist::after { display: block; }
.outline .status { align-self: center; margin: 0 .375rem 0 0; border-radius: 0; width: 6px; height: 6px; }

/* Leaves are ruled rows. Nested documents never acquire a second gutter. */
.doc, .doc.workshop, .doc > .doc { display: block; scroll-margin-top: 0; }
.doc > * { position: relative; margin-top: 0; padding: 1.375rem var(--ledger-end) 1.5rem var(--row-start); border-bottom: 1px solid var(--rule-faint); }
.doc > .doc { margin-top: 2.5rem; padding: 0; border-bottom: 0; }
.doc + .doc { margin-top: 2.5rem; padding-top: 0; border-top: 0; }
.doc > .doc-head, .doc > .page-head { display: grid; grid-template-columns: var(--gutter-num) minmax(0, 1fr); align-items: center; padding: 1.375rem var(--ledger-end) 1.375rem 0; border-bottom-color: var(--rule-strong); }
.doc-head > .num, .page-head > .num { padding: 0 .875rem 0 .5rem; font: 500 1.0625rem/1.25 var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.doc-head > :is(.doc-title, .doc-tools), .page-head > h1 { padding-left: var(--ledger-inset); }
.doc-title { font-family: var(--font-text); letter-spacing: -.01em; }
.layout > .text > .doc:is(.section, .subsection) > .doc-head > .doc-title { font-size: var(--fs-title-section); }
/* The visible action line matches the reference; its 44px hit area extends into row padding. */
.doc-tools { --action-inset: calc((var(--tap) - 1.078125rem) / 2); margin-top: calc(.875rem - var(--action-inset)); margin-bottom: calc(-1 * var(--action-inset)); gap: 1.125rem; }
.doc-tools :is(.permalink, .cite-btn, .share-btn, .bookmark-btn) { font: .71875rem/1.5 var(--font-mono); color: var(--ink); box-shadow: none; text-decoration: none; min-height: var(--tap); }
.doc-tools :is(.cite-btn, .share-btn, .bookmark-btn) { text-transform: uppercase; }
.doc-tools .bookmark-btn[hidden] { display: none; }
.doc-tools .bookmark-btn { min-width: 10ch; text-align: left; }
.doc-tools .share-btn { min-width: 7ch; text-align: left; }
.doc-tools .bookmark-btn[aria-pressed="true"] { color: var(--ink-muted); }
.doc-tools .bookmark-btn[data-state] { color: var(--ink); }
.doc-tools .bookmark-btn:is(:hover, :focus-visible) { color: var(--ink); }
.doc-tools .bookmark-btn:disabled, .bookmark-remove:disabled { color: var(--ink-muted); cursor: default; }
.doc-tools .bookmark-status { flex-basis: 100%; margin: .25rem 0 0; color: var(--ink-muted); font: .75rem/1.5 var(--font-mono); overflow-wrap: anywhere; }
.doc-tools .bookmark-status:empty { display: none; }
.doc-tools .permalink { color: var(--ink-muted); }
.doc > p { margin-top: 0; font-size: var(--fs-body); line-height: 1.62; }
/* Image dimensions come from the renderer; the enclosing ledger row supplies its spacing. */
.doc > p > img { margin-top: 0; }
.doc > .doc-summary, .doc > .page-lede { font-size: 1.0625rem; color: var(--ink-2); }
.doc > :is(p, .card, .math-display, .diagram, .book-figure, pre, blockquote, ul, ol) { min-width: 0; }
.doc > :is(ul, ol) { list-style-position: inside; }
/* A prose-sized strut shares the first line's baseline with the smaller share mark. */
.doc > p > .para-link { position: absolute; left: .5rem; top: 1.375rem; width: calc(var(--gutter-num) - 1rem); min-height: 44px; padding: 0 .5rem; margin: 0; text-align: right; font: .75rem/1.8 var(--font-mono); }
.doc > p > .para-link::before { content: "\200b"; font: var(--fs-body)/1.62 var(--font-text); }
.doc > .card { padding: 1.375rem var(--ledger-end) 1.5rem var(--row-start); border-top: 0; border-left: 0; }
.card-label { font: 500 .6875rem/1.5 var(--font-mono); letter-spacing: .1em; }
.doc > .card .card-label, .todolist > .card .card-label { position: absolute; left: 0; top: 1.5625rem; width: calc(var(--gutter-num) - .875rem); text-align: right; }
.card.term { background: transparent; border-color: var(--rule-faint); }
.card-title { display: block; font: 600 1.03125rem/1.35 var(--font-text); letter-spacing: 0; text-transform: none; }
.card.term .card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.card.term > p:first-of-type { margin-top: .75rem; }
.card-title::before { content: none; }
.card.term p, .card.example p, .card.todo p { font-size: 1.09375rem; line-height: 1.58; color: var(--ink); }
.card.example p, .card.todo p { color: var(--ink-2); }
/* Text can introduce or follow an image, with the same quiet gap in either direction. */
.card.example > p + p:has(> img:only-child),
.card.example > p:has(> img:only-child) + p { margin-top: 1.125rem; }
.card.example > p > img:only-child { margin-top: 0; }
/* Images and diagrams share the same centered, plain-text caption. The enclosing card keeps
   its EXAMPLE label and may have prose before or after the figure. */
.book-figure { min-width: 0; margin-top: 1.125rem; }
.doc > .book-figure { margin-top: 0; }
.figure-paragraph-anchor { display: block; height: 0; overflow: hidden; }
.book-figure > :is(img, pre.mermaid, .diagram, .diagram-error) { margin-top: 0; }
.book-figure > figcaption { margin-top: .625rem; color: var(--ink-2); font: 400 .9375rem/1.5 var(--font-text); text-align: center; overflow-wrap: anywhere; }
.figure-number { color: inherit; border-bottom: 0; white-space: nowrap; }
.card.example > .book-figure + p { margin-top: 1.125rem; }
.card.example > .card-label + .book-figure { margin-top: var(--s2); }
.card.todo { background: transparent; border: 0; border-bottom: 1px solid var(--rule-faint); }
.card.todo .card-label { color: var(--ink-muted); }
@media (min-width: 48rem) {
  /* The gutter label participates in the prose's first baseline, including its margins. */
  .doc > .card:is(.example, .todo), .todolist > .card.todo { display: grid; grid-template-columns: var(--gutter-num) minmax(0, 1fr); column-gap: var(--ledger-inset); align-items: first baseline; padding-left: 0; }
  .doc > .card:is(.example, .todo) > .card-label, .todolist > .card.todo > .card-label { position: static; width: auto; padding-right: .875rem; grid-column: 1; grid-row: 1; }
  .doc > .card:is(.example, .todo) > :not(.card-label), .todolist > .card.todo > :not(.card-label) { grid-column: 2; }
  /* Without opening prose, keep EXAMPLE at the top of the image. */
  .doc > .card.example:has(> p:first-of-type > img:only-child, > .card-label + .book-figure) > .card-label { align-self: start; margin-top: var(--s2); }
}
.math-inline { padding: .08em .34em; border-radius: 2px; background: var(--chip-fill); box-shadow: inset 0 0 0 1px var(--chip-edge); }
.math-display { font-size: 1.4375rem; }
.doc > .math-display { margin-top: 0; }
.doc > .math-display[data-tag] { grid-template-columns: minmax(0, 1fr) 3.75rem; }
.math-display::after { font: .75rem var(--font-mono); }
.doc > .diagram { margin-top: 0; }
.doc > .footnotes { margin-top: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.footnotes::before { content: attr(aria-label); display: block; padding: 1.25rem var(--ledger-end) .5rem var(--row-start); border-bottom: 1px solid var(--rule-faint); font: 500 .6875rem var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); }
.footnotes ol { padding: 0; list-style: none; }
.footnotes li { position: relative; padding: 1.125rem var(--ledger-end) 1.125rem var(--row-start); margin: 0; border-bottom: 1px solid var(--rule-faint); font-size: .9375rem; line-height: 1.55; color: var(--ink-2); overflow-wrap: anywhere; }
.footnotes li::before { content: counter(list-item); position: absolute; top: 1.3125rem; left: 0; width: calc(var(--gutter-num) - .875rem); text-align: right; font: 500 .6875rem/1.5 var(--font-mono); letter-spacing: .1em; color: var(--ink-muted); }
.footnotes li:last-child { border-bottom: 0; }
.footnotes li::marker { font-family: var(--font-mono); font-size: .75rem; }
.doc > .doc-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 0; padding-top: 0; padding-bottom: 0; border-top: 1px solid var(--rule-strong); border-bottom: 0; }
.doc-nav a { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 3px; min-height: 76px; padding: .75rem 1.25rem .75rem 0; overflow-wrap: anywhere; }
.doc-nav > :first-child { border-right: 1px solid var(--rule-faint); }
.doc-nav a[rel="next"] { align-items: flex-end; text-align: right; padding: .75rem 0 .75rem 1.25rem; }
.doc-nav-address { font: 500 .6875rem/1.5 var(--font-mono); letter-spacing: .1em; color: var(--ink-muted); }
.doc-nav-title { font: 400 1rem/1.45 var(--font-text); }
.doc-nav a[rel="prev"]::before, .doc-nav a[rel="next"]::after { content: none; }
.xref[data-target-type="section"] { border-bottom-color: var(--ink); }
.xref[data-target-type="term"] { border-bottom-color: var(--rule-link); }
.xref.broken { border-bottom-style: solid; }
.popover, .cite-box, .menu { border-color: var(--rule-strong); box-shadow: 0 5px 18px rgb(0 0 0 / .08); }
.popover { box-shadow: none; }
:root[data-theme="dark"] .popover { border-color: #7a828b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .popover { border-color: #7a828b; } }
.popover .pop-head { border-bottom: 1px solid var(--rule); padding-bottom: .75rem; margin-bottom: .875rem; font-size: .625rem; }
.popover .pop-title { font-size: 1.03125rem; text-decoration: underline; text-underline-offset: 3px; }
.popover .pop-body { font-size: .96875rem; }
.popover .pop-more { font-size: .6875rem; }
.cite-box .cite-kind { font-size: .6875rem; }
.version-banner { margin: 0; border-radius: 0; }
.doc > :is(.termlist, .biblist, .results, .todolist) { padding: 0; border: 0; }
.termlist > .card.term, .biblist > .bib-entry, .results > .result, .todolist > .card {
  position: relative; padding: 1.375rem var(--ledger-end) 1.5rem var(--row-start); margin: 0; border-top: 0; border-bottom: 1px solid var(--rule-faint); text-indent: 0;
}
.termlist .card-label { display: none; }
.termlist .card.term .card-title { font-size: 1.03125rem; line-height: 1.35; }
.term-index { margin: 0; gap: .25rem; }
.doc > .alpha-mark { margin: 0; font: 500 1rem var(--font-mono); border-bottom-color: var(--rule); }
.result .result-num { font-size: .75rem; }
.result .result-title { font-size: 1.03125rem; text-decoration: underline; text-underline-offset: 3px; }
.bib-entry { font-size: 1.0625rem; }
.bib-cited-in { font-size: .8125rem; }
/* Reader bookmarks follow the same ruled rows and text axis as the book. */
.doc.bookmarks-page > .bookmark-list { margin: 0; padding: 0; border: 0; list-style: none; }
.bookmark-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.5rem; margin: 0; padding: 1.125rem var(--ledger-end) 1.125rem var(--row-start); border-bottom: 1px solid var(--rule-faint); }
.bookmark-link { display: flex; flex-direction: column; justify-content: center; gap: .25rem; min-width: 0; min-height: 44px; border: 0; color: var(--ink); overflow-wrap: anywhere; }
.bookmark-label { color: var(--ink-muted); font: 500 .6875rem/1.5 var(--font-mono); letter-spacing: .06em; }
.bookmark-title { font: 400 1.125rem/1.45 var(--font-text); }
.bookmark-link:is(:hover, :focus-visible) .bookmark-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }
.bookmark-remove { min-width: 44px; min-height: 44px; padding: .25rem 0; border: 0; background: none; color: var(--ink-muted); font: .6875rem/1.5 var(--font-mono); text-transform: uppercase; cursor: pointer; }
.bookmark-remove:is(:hover, :focus-visible) { color: var(--ink); }
.doc.bookmarks-page > .bookmark-status { color: var(--ink-muted); font: .8125rem/1.5 var(--font-mono); }
.doc.bookmarks-page > .bookmark-status:empty { padding: 0; border: 0; }
/* Markdown tables keep their native semantics and scroll independently of the page. */
.markdown-table-scroll { max-width: 100%; min-width: 0; overflow: auto; overscroll-behavior-inline: contain; padding-block: .75rem; }
.doc > .markdown-table-scroll { margin: 0 var(--ledger-end) 0 var(--row-start); padding: 1.375rem 0 1.5rem; }
.markdown-table-scroll table { min-width: 100%; border-collapse: collapse; font-size: 1rem; line-height: 1.5; }
.markdown-table-scroll :is(th, td) { min-width: 8rem; padding: .75rem 1rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.markdown-table-scroll [align="center"] { text-align: center; }
.markdown-table-scroll [align="right"] { text-align: right; }
.markdown-table-scroll th { background: var(--definition); border-top: 1px solid var(--rule-strong); font: 500 .75rem/1.6 var(--font-mono); }
/* The workshop shares the shell, but tools and native tables use its available width. */
.doc.workshop > :not(.page-head) { padding: 1.25rem var(--ledger-end) 1.5rem var(--row-start); margin: 0; }
.doc.workshop > .todolist { padding: 0; margin: 0; border: 0; }
.todo-where { color: var(--ink-muted); box-shadow: inset 0 -1px 0 var(--rule-link); font: 400 .8125rem/1.45 var(--font-text); }
.doc.workshop > .page-lede { max-width: none; }
.doc.workshop > .table-scroll { padding: 0; margin: 0 var(--ledger-end) 0 var(--row-start); max-width: calc(100% - var(--row-start) - var(--ledger-end)); border-bottom: 0; }
.doc.workshop > .table-scroll-hint { padding-top: .5rem; padding-bottom: .75rem; font-size: .75rem; }
.doc.workshop .revisions, .doc.workshop .rows { border-top: 1px solid var(--rule-strong); }
.rows th, .revisions th { font: 500 .625rem/1.6 var(--font-mono); letter-spacing: .07em; padding-block: .75rem; }
.rows td, .revisions td { padding-top: .875rem; padding-bottom: .875rem; }
.doc.workshop > .dash { padding: 0; margin: 1.25rem var(--ledger-end) 1.5rem var(--row-start); border: 0; gap: 0; }
.dash-card { box-shadow: none; border: 1px solid var(--rule); border-left: 0; padding: 1.125rem; }
.dash-card:first-child { border-left: 1px solid var(--rule); }
.dash-card .card-label { font: 500 .625rem/1.5 var(--font-mono); letter-spacing: .08em; }
.dash-figure { font-size: 1.75rem; }
.dash-card .dash-note { font: .8125rem/1.5 var(--font-text); }
.doc.workshop > .section-label { padding-bottom: .75rem; font: 500 .6875rem/1.5 var(--font-mono); }
/* History comparisons share the page's numeral gutter and content edge. Keep the
   rule above changed-line fills so it continues through the whole comparison. */
.doc.workshop > .diff { padding: 1.25rem 0 1.5rem; border: 0; border-bottom: 1px solid var(--rule-faint); background: var(--paper); }
.doc.workshop > .diff::before { content: ""; position: absolute; inset-block: 0; left: var(--gutter-num); z-index: 1; border-left: 1px solid var(--rule); pointer-events: none; }
.doc.workshop > .diff > div { padding-inline: var(--row-start) var(--ledger-end); }
.doc.workshop > .diff > div::before { width: var(--gutter-num); padding-right: .875rem; border-right: 0; }
.doc.workshop > .add-form { display: flex; margin: 0 var(--ledger-end) 1.5rem var(--row-start); padding: 1.125rem; background: var(--definition); border: 1px solid var(--rule); }
.doc.workshop > .editor, .layout > .text > .editor { padding: 1.375rem var(--ledger-end) 2rem var(--ledger-inset); border: 0; }
.editor-head input { font: 600 1.5rem/1.3 var(--font-text); }
.editor { gap: 1.25rem; }
.editor textarea { font-size: .875rem; line-height: 1.75; padding: 1.25rem; background: var(--paper); }
.editor-panes { gap: 1.25rem; align-items: start; }
.editor-bar { z-index: 10; padding-top: .75rem; padding-bottom: .75rem; gap: .625rem; font-size: .8125rem; }
.editor-bar :is(input, select, button), .primary { font-size: .8125rem; border-radius: 0; }
.editor-bar input[name="message"] { min-width: min(12rem, 100%); }
.editor-bar #editor-status { flex-basis: 100%; padding-top: .25rem; font-size: .6875rem; }
.editor-bar button[type="button"] { border-color: var(--rule-strong); }
.pane.preview { max-height: 70vh; }
.pane.preview > .text { --gutter-num: 0rem; --ledger-inset: 1rem; --row-start: 1rem; --ledger-end: 1rem; padding: 1.25rem; }
.pane.preview :is(.card.example, .card.todo) { padding: 1.375rem 0 1.5rem; border: 0; border-bottom: 1px solid var(--rule-faint); }
.pane.preview .doc > .card:is(.example, .todo) { display: block; }
.pane.preview .doc > .card .card-label { position: static; display: block; text-align: left; width: auto; margin-bottom: .5rem; }
.pane.preview .doc > * { padding-block: 1rem; }
.pane.preview .doc > .math-display[data-tag] { grid-template-columns: minmax(0, 1fr) 3rem; }
.context-details { color: var(--ink-muted); font-size: .8125rem; }
.context-details summary { min-height: 44px; align-content: center; }
.banner { font-size: .875rem; }
.banner button { font: .71875rem var(--font-mono); }
.menu .item { min-height: 44px; }
.cover { min-height: 100svh; padding-top: 5rem; }
.cover .dyad { border: 1px solid var(--rule); padding: 1rem; width: 11rem; height: 11rem; margin-bottom: 2rem; }
.cover-title { letter-spacing: -.025em; }
.cover-status { width: auto; padding-top: 0; border: 0; font: .8125rem var(--font-mono); letter-spacing: 0; }
.cover-action { font: .8125rem var(--font-mono); min-height: 44px; align-content: center; }

/* Structure creation stays on the open ledger, with the numbering consequences beside its controls. */
.new-section-form { display: grid; gap: 1.75rem; }
.new-section-form :is(.new-fields, .new-placement, .new-preview, .new-field) { min-width: 0; }
.new-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); gap: 1.5rem 2rem; }
.new-placement { display: grid; gap: 1.75rem; }
.new-field { display: flex; flex-direction: column; gap: .625rem; }
.new-field > :is(span, label), .new-preview > h2 { color: var(--ink-muted); font: 500 .6875rem/1.5 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.new-section-form :is(input:not([type="hidden"]), select) { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: var(--tap); padding: .5625rem .75rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 0; font: 1rem/1.5 var(--font-text); }
.new-section-form :is(input:not([type="hidden"]), select):focus-visible { border-color: var(--ink); }
.new-section-form [aria-invalid="true"] { border-color: var(--sig-negative); }
.new-field small { color: var(--ink-muted); font: .8125rem/1.5 var(--font-text); overflow-wrap: anywhere; }
.new-number-control { display: flex; align-items: stretch; gap: .5rem; min-width: 0; }
.new-section-form .new-number-control input { flex: 1 1 0; font-family: var(--font-mono); }
.new-section-form button { min-width: var(--tap); min-height: var(--tap); padding: .625rem 1rem; border-radius: 0; font: .75rem/1.5 var(--font-mono); cursor: pointer; }
.new-number-control button, .new-refresh { flex: none; background: var(--paper); border: 1px solid var(--rule); white-space: nowrap; }
.new-number-control button:hover, .new-refresh:hover { border-color: var(--ink); }
.new-section-form button:disabled { color: var(--ink-faint); cursor: not-allowed; }
.new-number-control [data-new-end] { display: none; }
html[data-enhanced] .new-number-control [data-new-end] { display: inline-flex; align-items: center; justify-content: center; }
html[data-enhanced] .new-section-form .new-refresh { display: none; }
.new-preview { padding-top: 1.5rem; border-top: 1px solid var(--rule-strong); }
.new-preview > h2 { margin-bottom: 1rem; }
.new-preview > p { color: var(--ink-2); font: 1rem/1.5 var(--font-text); overflow-wrap: anywhere; }
.new-preview > .new-number-label { margin-bottom: .5rem; color: var(--ink); font-size: 1.25rem; }
.new-number-label [data-new-title]:not(:empty) { margin-left: .5rem; }
.new-number-changes { display: grid; margin-top: 1rem; border-top: 1px solid var(--rule-faint); }
.new-number-changes > li { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(0, 4fr); align-items: baseline; gap: 1rem; padding-block: .625rem; border-bottom: 1px solid var(--rule-faint); }
.new-change-number { color: var(--ink-muted); font: .75rem/1.5 var(--font-mono); }
.new-change-title { color: var(--ink-2); font: 1rem/1.5 var(--font-text); }
.new-number-changes span { min-width: 0; overflow-wrap: anywhere; }
.new-section-form .new-error { color: var(--sig-negative); font: .875rem/1.5 var(--font-text); overflow-wrap: anywhere; }
.new-section-form .new-error[hidden] { display: none; }
.new-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.new-actions a { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); border: 0; color: var(--ink-muted); font: .75rem var(--font-mono); }
.new-actions a:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
@media (min-width: 48rem) and (max-width: 74.99rem) {
  :root { --col-outline: 17rem; --gutter-num: 4.75rem; --ledger-inset: 1.25rem; --ledger-end: var(--row-start); }
  .site-nav { gap: 1rem; }
  .site-search { display: block; flex-basis: 10rem; }
  .site-header { gap: 1rem; }
}
@media (max-width: 47.99rem) {
  :root { --fs-body: 1.0625rem; --fs-h1: 1.625rem; --fs-title-book: 2.375rem; --fs-title-part: 2.125rem; --fs-title-chapter: 1.875rem; --fs-title-section: 1.625rem; --fs-title-subsection: 1.4375rem; --gutter-num: 0rem; --ledger-inset: 1.25rem; --row-start: 1.25rem; --ledger-end: 1.25rem; --header-h: 3.5rem; --strip-h: 2.75rem; }
  .site-header { gap: .5rem; padding-inline: .75rem; min-height: var(--header-h); }
  /* One gap for every face that carries the switch: the author's face tightens its gaps to fit
     New and Workshop, and that must not move the switch between Edit, Preview and Reader. It
     sits before the rules for a header with no Contents drawer, which keeps its own grid gap. */
  .site-header:has(.view-switch) { column-gap: .25rem; }
  .site-nav, .site-search { display: none; }
  .site-header .theme-controls { margin-left: auto; }
  .new-fields { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .doc.workshop > .new-section-form { padding-inline: var(--ledger-inset); }
  .new-section-form, .new-placement { gap: 1.5rem; }
  .new-number-changes > li { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .75rem; }
  /* Standalone Workshop pages have no Contents drawer: keep destinations in the header. */
  :root:has(> body.without-outline) { --header-h: 6.25rem; }
  body.author:not(.without-outline) .site-header { column-gap: .25rem; }
  body.author .outline-toggle { padding-inline: .125rem; }
  .nav-new { font: 500 .6875rem var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
  .without-outline .site-header { display: grid; grid-template-columns: 44px 44px minmax(0, 1fr) 44px; grid-template-rows: minmax(0, 1fr) 2.75rem; gap: 0 .5rem; }
  .without-outline .site-mark { grid-area: 1 / 1; }
  .without-outline .nav-new { grid-area: 1 / 2; }
  .without-outline .workshop-menu { grid-area: 1 / 3; }
  .without-outline .site-header .theme-controls { grid-area: 1 / 4; justify-self: end; margin-left: 0; }
  .without-outline .site-nav { display: flex; grid-area: 2 / 1 / 3 / -1; justify-content: space-between; gap: .875rem; font-size: .9375rem; }
  .without-outline .site-nav .mobile-search-link { display: inline-flex; }
  .outline-toggle { display: inline-flex; font: 500 .6875rem var(--font-mono); text-transform: uppercase; letter-spacing: .08em; box-shadow: none; }
  .crumb { font-size: .625rem; letter-spacing: 0; }
  .crumb-path { letter-spacing: .06em; }
  .crumb-path > :is(a, span) { padding-inline: .75rem; }
  .crumb .document-action { padding-inline: .625rem; }
  .crumb .reading-time { padding: .5rem .625rem; white-space: normal; font-size: .5625rem; max-width: 10rem; text-align: right; }
  .workshop-menu { position: static; }
  .workshop-menu > summary { font: 500 .6875rem var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
  .nav-new, .workshop-menu > summary { padding-block: 0; }
  .workshop-nav { top: 100%; left: .75rem; right: .75rem; min-width: 0; max-width: none; }
  .crumb-state { padding-inline: .75rem; }
  .layout { display: block; }
  .layout::before, .layout > .text::before, .layout > .text::after { content: none; }
  .layout > .text { padding: 0 0 3rem; max-width: none; --ledger-end: 1.25rem; }
  .layout > .outline { top: calc(var(--header-h) + var(--strip-h)); padding: 0 0 3rem; z-index: 40; max-height: calc(100dvh - var(--header-h) - var(--strip-h)); border: 0; }
  html[data-enhanced] .layout > .outline:not([data-open]) { visibility: hidden; }
  html:not([data-enhanced]) .outline-toggle { display: none; }
  html:not([data-enhanced]) .layout > .outline { position: static; transform: none; max-height: none; width: auto; padding-bottom: 1rem; border-bottom: 1px solid var(--rule-strong); }
  .outline li { grid-template-columns: minmax(5.75rem, max-content) minmax(0, 1fr) auto auto; }
  .outline li:not(:has(> .num)) > a { padding-left: 5.75rem; }
  .outline-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--rule-strong); padding: .5rem 1rem; }
  .outline-links a { grid-column: auto; display: flex; align-items: center; min-height: 44px; padding: .5rem; font: .75rem var(--font-mono); }
  .outline .twist::before, .outline .twist::after { left: 20px; }
  .outline li > .num { padding-left: 2.625rem; }
  .doc > .doc-head, .doc > .page-head { display: flex; flex-direction: column; align-items: stretch; padding-left: var(--row-start); padding-top: 1.25rem; }
  .doc-head > :is(.doc-title,.doc-tools), .page-head > h1 { padding-left: 0; }
  .doc-head > .num, .page-head > .num { padding: 0; text-align: left; font-size: .8125rem; margin-bottom: .5rem; }
  .doc-tools { gap: .875rem; margin-top: .5rem; }
  .doc-tools :is(.permalink,.cite-btn,.share-btn,.bookmark-btn) { min-height: 44px; font-size: .6875rem; }
  .bookmark-entry { gap: .75rem; }
  .bookmark-title { font-size: 1.0625rem; }
  .doc > .doc { margin-top: 1.5rem; }
  .doc > * { padding-block: 1.125rem; }
  .doc > .card .card-label, .todolist > .card .card-label { position: static; display: block; width: auto; margin-bottom: .625rem; text-align: left; font-size: .625rem; }
  .doc > p > .para-link { position: static; width: auto; padding: .9375rem .75rem; font-size: .75rem; }
  .doc > p > .para-link::before { content: none; }
  .doc > .math-display[data-tag] { grid-template-columns: minmax(0, 1fr) 3rem; }
  .math-display { font-size: 1.2rem; }
  .doc-nav a { min-height: 76px; }
  .footnotes li { padding-left: calc(var(--row-start) + 1.5rem); }
  .footnotes li::before { left: var(--row-start); width: 1rem; }
  .doc.workshop > .editor, .layout > .text > .editor { padding-inline: 1rem; }
  /* The reading ledger has no mobile gutter; a compact local column still identifies diff lines. */
  .doc.workshop > .diff::before { left: calc(var(--row-start) + 2rem); }
  .doc.workshop > .diff > div { padding-left: calc(var(--row-start) + 3rem); }
  .doc.workshop > .diff > div::before { left: var(--row-start); width: 2rem; padding-right: .5rem; }
  .editor-head { gap: .5rem; }
  .editor-head input { font-size: 1.375rem; }
  .editor textarea { padding: .875rem; font-size: .8125rem; min-height: 24rem; }
  .editor-bar { position: static; }
  .editor-bar input[name="message"] { flex-basis: 100%; }
  .doc.workshop > .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-card:nth-child(odd) { border-left: 1px solid var(--rule); }
  .dash-card { padding: .875rem; }
  .popover, .popover[data-anchored] { position: fixed; position-area: none; inset: auto 0 0 0; width: 100%; max-width: none; max-height: 65dvh; overflow-y: auto; padding: 1.25rem; border: 0; border-top: 1px solid var(--rule-strong); }
  dialog.cite-box { border-top-color: var(--rule-strong); }
  .cover-controls { inset: .5rem .75rem auto auto; }
  .cover .dyad { width: 8rem; height: 8rem; }
}
/* Desktop keeps the labelled mode control; phones use one switch in the Contents row. */
@media (min-width: 64rem) {
  .site-header:has(.view-switch) > .header-menu { display: flex; align-items: center; gap: inherit; flex: 0 0 32rem; }
}
@media (min-width: 64rem) and (max-width: 74.99rem) {
  .site-header:has(.view-switch) { gap: .75rem; }
  .site-header:has(.view-switch) .site-search { display: none; }
}
@media (min-width: 48rem) and (max-width: 63.99rem) {
  :root:has(.site-header > .view-switch) { --header-h: 6.25rem; }
  .site-header:has(.view-switch) { flex-wrap: wrap; align-content: center; row-gap: 0; }
  .site-header:has(.view-switch) .site-search { display: none; }
  .site-header:has(.view-switch) .theme-controls { margin-left: auto; }
  .site-header > .view-switch { order: 1; flex-basis: 100%; margin: 0 0 .25rem; }
}
@media (max-width: 47.99rem) {
  .site-header > .view-switch { flex: 0 0 var(--tap); gap: 0; margin-left: auto; }
  .view-switch > a { width: var(--tap); gap: 0; }
  /* Retain the current mode and destination name for assistive technology. */
  .view-switch > [aria-current], .view-switch > a > span:not(.view-switch-track) {
    position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .site-header:has(.view-switch) .theme-controls { margin-left: 0; }
  .without-outline .site-header:has(.view-switch) { grid-template-columns: 44px 44px minmax(0, 1fr) 44px 44px; }
  .without-outline .site-header > .view-switch { grid-area: 1 / 4; margin: 0; }
  .without-outline .site-header:has(.view-switch) .theme-controls { grid-area: 1 / 5; }
}
@media (max-width: 22rem) {
  .site-header:has(.view-switch), body.author .site-header:has(.view-switch) { padding-inline: .375rem; column-gap: .125rem; }
  .site-header:has(.view-switch) :is(.site-mark, .theme-toggle) { width: 32px; }
  .site-header:has(.view-switch) .nav-new { min-width: 32px; }
  .site-header:has(.view-switch) .workshop-menu > summary { gap: .25rem; }
  .without-outline .site-header:has(.view-switch) { grid-template-columns: 32px 32px minmax(0, 1fr) 44px 32px; }
}
/* Section editing reserves a bottom row for actions; only the active pane scrolls.
   Without enhancement the native page, including mobile Contents, stays in normal flow. */
.editor-context { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); margin: 0; border-block: 1px solid var(--rule-faint); }
.editor-context > div { min-width: 0; padding: .375rem .75rem; }
.editor-context > div:first-child { padding-left: 0; }
.editor-context > div + div { border-left: 1px solid var(--rule-faint); }
.editor-context dt { font: 500 .5625rem/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.editor-context dd { margin: .125rem 0 0; font: .8125rem/1.4 var(--font-text); overflow-wrap: anywhere; }
.editor-context dd a { display: inline-block; margin-right: .375rem; }

@media screen {
  html[data-enhanced]:has(> body.editor-page) { height: 100%; overflow: hidden; }
  html[data-enhanced] body.editor-page { position: fixed; inset-inline: 0; top: var(--editor-viewport-top, 0px); display: flex; flex-direction: column; height: var(--editor-viewport-height, 100dvh); overflow: hidden; }
  html[data-enhanced] .editor-page > :is(.site-header, .crumb) { flex: none; width: 100%; }
  html[data-enhanced] .editor-page > .layout { flex: 1; width: 100%; min-height: 0; overflow: clip; }
  html[data-enhanced] .editor-page .layout > .text { height: 100%; min-height: 0; padding: 0; overflow: clip; }
  html[data-enhanced] .editor-page .layout > .outline { position: relative; top: auto; height: 100%; max-height: 100%; }
  html[data-enhanced] .editor-page .layout > .text > .editor { display: flex; flex-direction: column; height: 100%; min-height: 0; gap: .5rem; padding: .5rem var(--ledger-end) 0 var(--ledger-inset); }
  html[data-enhanced] .editor-page .editor-head { flex: none; }
  html[data-enhanced] .editor-page .editor-head input { min-height: var(--tap); }
  html[data-enhanced] .editor-page .editor-context { flex: 0 1 auto; min-height: 1.875rem; max-height: 5.5rem; overflow: auto; }
  html[data-enhanced] .editor-page .editor > .banner { flex: 0 1 auto; min-height: 0; max-height: 6rem; overflow: auto; padding: .375rem .5rem; gap: .375rem; }
  html[data-enhanced] .editor-page .editor-panes { flex: 1 0 3rem; min-height: 3rem; grid-template-rows: minmax(0, 1fr); align-items: stretch; gap: 0; }
  html[data-enhanced] .editor-page .editor-panes > .pane { height: 100%; min-height: 0; }
  html[data-enhanced] .editor-page #content { height: 100%; min-height: 0; resize: none; overscroll-behavior: contain; }
  html[data-enhanced] .editor-page .pane.preview { display: block; height: 100%; min-height: 0; max-height: none; overscroll-behavior: contain; }
  html[data-enhanced] .editor-page .pane.preview[hidden] { display: none; }
  html[data-enhanced] .editor-page .editor-bar { flex: none; position: static; margin: 0; gap: .5rem; padding: .5rem 0 max(.375rem, env(safe-area-inset-bottom)); }
  html[data-enhanced] .editor-page .editor-bar input[name="message"] { min-width: 0; }
  html[data-enhanced] .editor-page .editor-bar #editor-status { margin: 0; padding-top: 0; max-height: 3em; overflow: auto; font-size: .625rem; line-height: 1.4; }
}
@media screen and (max-width: 47.99rem) {
  html[data-enhanced] .editor-page .layout > .outline { position: fixed; inset: calc(var(--editor-viewport-top, 0px) + var(--anchor-offset, calc(var(--header-h) + var(--strip-h)))) 0 auto; height: calc(var(--editor-viewport-height, 100dvh) - var(--anchor-offset, calc(var(--header-h) + var(--strip-h)))); max-height: none; }
  html[data-enhanced] .editor-page .layout > .text > .editor { padding-inline: 1rem; gap: .375rem; }
  html[data-enhanced] .editor-page .editor-head input { font-size: 1.125rem; }
  html[data-enhanced] .editor-page #content { font-size: 1rem; padding: .75rem; }
  html[data-enhanced] .editor-page .editor-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: .375rem; }
  html[data-enhanced] .editor-page .editor-bar :is(input, select) { font-size: 1rem; min-width: 0; width: 100%; }
  html[data-enhanced] .editor-page .editor-bar input[name="message"] { grid-column: 2 / -1; }
  html[data-enhanced] .editor-page .editor-bar button[type="submit"] { grid-column: 1 / -1; padding-inline: .375rem; }
  html[data-enhanced] .editor-page #editor-status { grid-column: 1 / -1; }
}
/* Applied AI edits: the manuscript stays readable, with words and complete rich blocks compared. */
.ai-review-notice { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; min-width: 0; border-block: 1px solid color-mix(in srgb, var(--sig-negative) 25%, var(--paper)); border-inline-start: 3px solid var(--sig-negative); background: var(--sig-negative-wash); color: var(--sig-negative); font: 500 .8125rem/1.5 var(--font-mono); }
.editor > .ai-review-notice { padding: .5rem .75rem; }
.ai-review-notice[hidden] { display: none; }
.ai-review-notice > span { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.ai-review-context { min-width: 0; overflow-wrap: anywhere; color: var(--ink-2); }
.ai-review-context:empty { display: none; }
.ai-review-panel { display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 0; background: var(--paper); }
.ai-review-panel[hidden] { display: none; }
.ai-review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem .75rem; min-width: 0; margin-left: auto; }
.ai-review-actions :is(button, a), .ai-review-notice :is(button, a) { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); padding: .5rem .875rem; font: .75rem/1.5 var(--font-mono); border: 1px solid var(--rule); border-radius: 0; background: var(--paper); color: var(--ink); cursor: pointer; }
.ai-review-actions [hidden] { display: none; }
.ai-review-panel > :is(.ai-review-context, [data-ai-review-body]) { flex: none; min-width: 0; }
.ai-review-panel > .ai-review-context { margin-block: .75rem; }
.ai-review-feedback { color: var(--ink-muted); font: .8125rem/1.5 var(--font-text); overflow-wrap: anywhere; }
.ai-review-feedback:empty { display: none; }
.ai-review-notice > .ai-review-feedback { flex: 1 0 100%; margin: 0; }
.ai-review-notice [data-ai-review-open], .ai-review-actions [data-ai-review-undo] { color: var(--sig-negative); border-color: var(--sig-negative); }
.ai-review-actions [data-ai-review-keep] { color: var(--sig-positive); border-color: var(--sig-positive); }
.ai-review-actions [data-ai-review-close] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ai-review-notice [data-ai-review-open]:is(:hover, :focus-visible), .ai-review-actions [data-ai-review-undo]:enabled:is(:hover, :focus-visible) { background: var(--sig-negative-wash); }
.ai-review-actions [data-ai-review-keep]:enabled:is(:hover, :focus-visible) { background: var(--sig-positive-wash); }
.ai-review-actions [data-ai-review-close]:enabled:is(:hover, :focus-visible) { background: var(--ink-2); border-color: var(--ink-2); }
.ai-review-actions button:disabled { color: var(--ink-faint); border-color: var(--rule); background: var(--paper); cursor: not-allowed; }
.ai-review-diff {
  --ai-review-add: color-mix(in srgb, #00d43b 16%, var(--paper));
  --ai-review-del: color-mix(in srgb, #ff4242 16%, var(--paper));
  width: 100%; min-width: 0; color: var(--ink); font: var(--fs-body)/var(--lh-text) var(--font-text); overflow-wrap: anywhere;
}
.ai-review-diff > :is(.ai-review-block, .ai-review-change) { margin-block: 1.5rem; }
.ai-review-diff .ai-review-title { margin: 1.25rem 0 1.75rem; font: 600 var(--fs-h2)/1.25 var(--font-text); }
.ai-review-diff ins { color: var(--ink); background: var(--ai-review-add); text-decoration: none; }
.ai-review-diff del { color: var(--ink); background: var(--ai-review-del); text-decoration: none; }
.ai-review-diff del + ins { margin-left: .12em; }
.ai-review-diff .ai-review-change-label, .ai-review-definition-label { margin: 0 0 .625rem; color: var(--ink-muted); font: 500 .625rem/1.6 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.ai-review-prose > p { margin: 0; }
.ai-review-prose > .ai-review-change-label { margin-top: .5rem; }
.ai-review-rich { border-block: 1px solid var(--rule-faint); padding-block: 1.25rem; }
.ai-review-rich-side { min-width: 0; padding-left: 1rem; border-left: 2px solid var(--rule); }
.ai-review-rich-side + .ai-review-rich-side { margin-top: 1.5rem; }
.ai-review-before { border-left-color: var(--sig-negative); }
.ai-review-after { border-left-color: var(--sig-positive); }
.ai-review-before > .ai-review-change-label, .ai-review-after > .ai-review-change-label { color: var(--ink); }
.ai-review-block { min-width: 0; }
.ai-review-block > :is(p, ul, ol, blockquote, figure, pre, .math, .card, .markdown-table-scroll) + :is(p, ul, ol, blockquote, figure, pre, .math, .card, .markdown-table-scroll) { margin-top: 1rem; }
.ai-review-block :is(.card.example, .card.todo, .card.term) { display: block; padding: 1rem 0; margin: 0; border-inline: 0; }
.ai-review-block .card :is(.card-label, .card-title) { position: static; display: block; width: auto; text-align: left; }
.ai-review-block .card .card-label { margin-bottom: .625rem; }
.ai-review-block .card p + p { margin-top: 1rem; }
.ai-review-block .book-figure { margin-inline: 0; width: 100%; }
.ai-review-block .book-figure img { display: block; max-width: 100%; height: auto; }
.ai-review-block .ai-review-xref { border: 0; color: inherit; }
.ai-review-block :is(.ai-review-cite, .ai-review-fn-ref) a { border: 0; color: inherit; }
.ai-review-references { margin-top: .75rem; padding: 0; list-style: none; color: var(--ink-muted); font: .8125rem/1.5 var(--font-text); }
.ai-review-definition { margin: 0; }
.ai-review-source-changes { margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid var(--rule-faint); }
.ai-review-source-line { display: grid; grid-template-columns: 1rem minmax(0, 1fr); gap: .375rem; margin-top: .25rem; font: .6875rem/1.6 var(--font-mono); }
.ai-review-source-line > span { user-select: none; }
.ai-review-source-line code, .ai-review-definition code { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; background: none; border: 0; padding: 0; }
.ai-review-definition { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-muted); font: .75rem/1.6 var(--font-mono); }
.ai-review-source-del { color: var(--ink); background: var(--ai-review-del); text-decoration: none; }
.ai-review-source-add { color: var(--ink); background: var(--ai-review-add); text-decoration: none; }
html[data-enhanced] .editor-page .editor > .ai-review-notice { flex: 0 1 auto; min-height: var(--tap); max-height: min(12rem, 35dvh); overflow: auto; }
html[data-enhanced] .editor-page .ai-review-panel { flex: 1 1 auto; height: 100%; min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 0 1.25rem 1.25rem; }
@media (max-width: 47.99rem) {
  .ai-review-notice { gap: .5rem; }
  .ai-review-notice > span { flex-basis: 100%; }
  .ai-review-notice .ai-review-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem; width: 100%; }
  .ai-review-actions :is(button, a) { padding-inline: .375rem; }
  .ai-review-actions [data-ai-review-close] { grid-column: 1 / -1; }
  .ai-review-rich-side { padding-left: .75rem; }
  .ai-review-diff .ai-review-title { font-size: 1.375rem; }
  html[data-enhanced] .editor-page .ai-review-panel { padding: 0 .875rem .875rem; }
}
@media print { .crumb, .theme-controls, .cover-controls { display: none !important; } .layout::before, .layout > .text::before, .layout > .text::after { content: none; } }


/* 17 ── print — the reading views only ────────────────────────────────── */
@media print {
  :root {
    --paper: #fff; --paper-sunk: #fff; --paper-raised: #fff;
    --ink: #000; --ink-2: #1a1a1a; --ink-muted: #4a4a4a; --ink-faint: #767676;
    --rule: #b3b3b3; --rule-faint: #d6d6d6; --rule-strong: #000;
    --measure: 100%;
    --fs-body: 11.5pt;
    --fs-h1: 20pt;
    --fs-title-book: 28pt;
    --fs-title-part: 24pt;
    --fs-title-chapter: 20pt;
    --fs-title-section: 16pt;
    --fs-title-subsection: 14pt;
    --gutter-num: 3.5rem;
  }
  @page { margin: 20mm 18mm 22mm; }

  body { background: #fff; }
  .skip-link, .site-header, .outline, .margin, .doc-tools, .doc-nav, .para-link, .context-details,
  .popover, .cite-box, .version-banner, .outline-toggle, .card.todo,
  .editor, .editor-bar, .menu, .banner, .revisions, .publish, .term-index { display: none !important; }

  .layout { display: block; }
  .text, body.reader .layout > .text { padding: 0; }
  .doc { display: block; }
  .doc-head { display: flex; flex-direction: column; align-items: stretch; margin-bottom: 12pt; }
  .doc-head > .num { display: block; order: -1; padding: 0; text-align: left; font-size: 11pt; color: #000; }
  .doc > * { break-inside: avoid-page; }
  .doc-title, .card-label { break-after: avoid-page; }
  .card.term { border-top: 0.75pt solid #000; border-bottom: 0.5pt solid #666; }
  .math-display[data-tag] { grid-template-columns: minmax(0, 1fr) 3rem; }
  .math-display > .katex-display, .math-display > .math-scroll { overflow: visible; white-space: normal; }
  .footnotes { font-size: 9.5pt; }
  a { border-bottom: 0; color: #000; }
  .xref[data-target-type="section"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #4a4a4a; }
  .permalink::after { content: " " attr(href); }
}

/* Language controls share the existing header row in every book view. */
.header-tools { display: flex; flex: none; align-items: center; gap: .25rem; }
.language-selector { position: relative; font: .8125rem/1.4 var(--font-mono); }
.language-selector > summary { display: grid; place-items: center; min-width: 2.5rem; min-height: var(--tap); cursor: pointer; list-style: none; color: var(--ink-muted); }
.language-selector > summary::-webkit-details-marker { display: none; }
.language-selector > nav { position: absolute; right: 0; top: 100%; z-index: 120; min-width: 10rem; padding: .375rem; border: 1px solid var(--rule-link); background: var(--paper); box-shadow: 0 .3rem 1rem #0002; }
.language-selector nav > * { display: block; padding: .625rem; border: 0; white-space: nowrap; }
.language-selector nav > [aria-current] { background: var(--paper-sunk); color: var(--ink); }
.language-selector nav > [aria-disabled] { color: var(--ink-muted); white-space: normal; }
.translation-source { flex: 0 1 auto; min-height: 2rem; max-height: 42vh; overflow: auto; border-block: 1px solid var(--rule-faint); font-size: .875rem; }
.translation-source > summary { cursor: pointer; padding: .5rem 0; font-family: var(--font-mono); }
.translation-source-body { padding: .5rem; }
.source-original, .source-diff { white-space: pre-wrap; overflow-wrap: anywhere; }
.source-diff > span { display: block; }
.translation-add { background: #aaffbb; color: #17191c; }
.translation-remove { background: #ffb6bd; color: #17191c; }
.translation-warning { color: var(--ink); border-left: .2rem solid #e66b65; padding-left: .75rem; }
.glossary-fields { margin-block: 1rem; overflow-wrap: anywhere; }
.glossary-fields dt { margin-top: .75rem; font: .75rem var(--font-mono); color: var(--ink-muted); }
.glossary-fields dd { margin: .25rem 0 0; white-space: pre-wrap; }
.glossary-form fieldset { min-width: 0; display: grid; gap: .75rem; padding: .75rem; border: 1px solid var(--rule-faint); }
.glossary-form :is(input, textarea) { max-width: 100%; width: 100%; box-sizing: border-box; }
.glossary-entry, .edition-metadata { margin: 1rem 0; padding: 1rem; border: 1px solid var(--rule-faint); }
.glossary-entry summary, .edition-metadata summary { cursor: pointer; }
.glossary-entry form, .edition-metadata form { display: grid; gap: .75rem; }
.glossary-entry label, .edition-metadata label { display: grid; gap: .25rem; }
.translation-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; font: .8125rem/1.5 var(--font-mono); }
.translation-tabs a { padding-block: .25rem; }
.translation-tabs a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px var(--ink); }
.translation-tabs a:last-child:not(:first-child) { margin-left: auto; }
.translation-workshop :is(.translation-list, .glossary-list) { min-width: 0; }
.translation-rows { margin: 0; }
.translation-rows th:first-child { width: 50%; }
.translation-rows th:nth-child(2) { width: 18%; }
.translation-rows th:last-child { width: 32%; }
.translation-rows td:not(:first-child) { color: var(--ink-muted); font: .8125rem/1.6 var(--font-mono); }
.glossary-list > .glossary-entry { margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--rule); }
.glossary-entry > summary { padding-block: 1rem; overflow-wrap: anywhere; }
.glossary-entry[open] { padding-bottom: 1.5rem; }
.glossary-revise { margin-top: 1rem; }
.glossary-revise > summary { font: .8125rem/1.5 var(--font-mono); }
.glossary-entry .glossary-form { max-width: 60rem; margin-top: 1.25rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1.5rem; }
.glossary-form > label { grid-column: 1 / -1; }
:is(.glossary-form, .edition-metadata) label { min-width: 0; font: .75rem/1.5 var(--font-mono); color: var(--ink-muted); }
:is(.glossary-form, .edition-metadata) :is(input, textarea) { max-width: 100%; width: 100%; box-sizing: border-box; border: 1px solid var(--rule); border-radius: 0; padding: .625rem .75rem; background: var(--paper); color: var(--ink); font: 1rem/1.5 var(--font-text); }
.edition-metadata form { margin-top: 1rem; max-width: 60rem; }
.edition-metadata .primary { justify-self: start; }
.glossary-form textarea { resize: vertical; min-height: 4rem; }
.glossary-form fieldset { padding: 1rem; gap: 1rem; align-content: start; }
.glossary-form legend { padding-inline: .5rem; font: .8125rem/1.5 var(--font-mono); }
.glossary-entry .primary { justify-self: start; margin-block: .5rem; }
@media (max-width: 600px) {
  .glossary-entry .glossary-form { grid-template-columns: minmax(0, 1fr); }
  .translation-rows, .translation-rows tbody, .translation-rows tr, .translation-rows td { display: block; width: auto; }
  .translation-rows thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .translation-rows tr { padding-block: 1rem; border-bottom: 1px solid var(--rule-faint); }
  .translation-rows td { border: 0; padding: .2rem 0; }
  .translation-rows td:first-child { padding-bottom: .5rem; }
  .translation-rows td[data-label]::before { content: attr(data-label) ': '; color: var(--ink-muted); }
  .translation-tabs a:last-child:not(:first-child) { margin-left: 0; }
}
.preview-source { padding: .5rem var(--ledger-end) .5rem var(--ledger-inset); }
.editor-bar [data-requires-saved] { min-height: var(--tap); padding: .5rem .75rem; border: 1px solid var(--rule-link); background: transparent; color: var(--ink); font: .75rem var(--font-mono); cursor: pointer; }
@media(max-width:47.99rem) {
  .site-header:has(.language-selector) .workshop-menu > summary { min-width: 32px; justify-content: center; gap: 0; }
  .site-header:has(.language-selector) .workshop-menu > summary > span { display: none; }
  .site-header:has(.language-selector) { flex-wrap: nowrap; }
  .site-header .header-tools { margin-left: auto; }
  .site-header:has(.view-switch) .header-tools { margin-left: 0; }
  .without-outline .site-header .header-tools { grid-area: 1 / -2; justify-self: end; }
  .without-outline .site-header { grid-template-columns: 44px 44px minmax(0,1fr) 84px; }
  .without-outline .site-header:has(.view-switch) { grid-template-columns: 44px 44px minmax(0,1fr) 44px 84px; }
  .editor-bar [data-requires-saved] { font-size: .6875rem; padding-inline: .5rem; }
}
