/* Finished HTML kit: the house layout for a single-page reading edition.
   Retune the edition through the tokens in :root; the rules below read only tokens.
   Breakpoints are literal because CSS cannot read a variable inside @media:
   901px docks the Contents panel (DOCK in the page script must match), 720px is narrow. */

:root {
  color-scheme: light;

  /* Palette, light theme.  The dark theme redefines the same names, in the same order, below. */
  --parchment: #f6f1e7;
  --parchment-mid: #eee7d6;
  --parchment-dark: #ddd3bd;
  --ink: #211c15;
  --ink-mid: #44392d;
  --ink-light: #665746;
  --rust: #842727;
  --rust-light: #a13a32;
  --gold: #7b6326;
  --rule: #c5b48f;
  --note-bg: #eee5cf;
  --note-border: #c0a070;
  --shadow: rgba(30, 25, 18, 0.16);
  --paper-highlight: rgba(255, 255, 255, 0.82);
  --paper-texture: rgba(83, 64, 32, 0.018);
  --panel-highlight: rgba(255, 255, 255, 0.28);
  --link-hover-bg: rgba(132, 39, 39, 0.07);
  --backdrop-bg: rgba(22, 18, 14, 0.42);
  --on-accent: white;
  --title-bg: #f5f0e6;
  --title-ink: #1e1913;
  --title-kicker: #9a5c25;
  --title-rule: #b8a678;
  --cover-border: rgb(0, 0, 0);
  --header-shadow: rgba(0, 0, 0, 0.2);
  --toggle-hover-bg: rgba(255, 255, 255, 0.08);
  /* The masthead and footer are dark furniture in both themes. */
  --header-text: #f8f1df;
  --header-bg: rgba(32, 27, 20, 0.97);
  --toggle-hover-color: #e3c46b;
  --nav-accent: #d7b85b;
  --nav-meta: rgba(248, 241, 223, 0.82);
  --footer-text: #eee3ca;
  --footer-bg: #241f18;
  --focus-ring: #d19135;
  --print-ink: #000;
  --print-paper: #fff;
  --print-rule: #999;
  --img-dark-filter: brightness(0.85);

  /* Fonts. */
  --font-body: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Noto Serif CJK TC", Georgia, serif;
  --font-display: "Palatino Linotype", "Book Antiqua", "Noto Serif CJK TC", Georgia, serif;
  --font-title: "Bodoni MT", Didot, "Times New Roman", serif;

  /* Type scale. */
  --text-size: clamp(1.06rem, 0.98rem + 0.24vw, 1.24rem);
  --leading: 1.58;
  --title-size: clamp(3.25rem, 6vw, 6.75rem);
  --title-size-narrow: clamp(2.65rem, 14vw, 4.2rem);
  --h2-size: clamp(1.7rem, 4vw, 2.6rem);
  --chapter-title-size: 2.2rem;
  --box-title-size: 1.35rem;
  --note-size: 0.85rem;
  --label-size: 0.72rem;
  --footer-size: 0.86rem;
  --para-indent: 2em;
  --para-indent-narrow: 1.25em;

  /* Layout.  Column = min(100% - 2 * gutter, measure); body text = column - reading inset, with or
     without page markers.  Shown markers sit in the inset on the right; otherwise it is split evenly. */
  --measure: 52rem;
  --gutter: 1rem;
  --reading-inset: 3.25rem;
  --source-rail: 3.25rem;
  --source-label: 2.75rem;
  --nav-width: 76rem;
  --panel-width: 16rem;
  --toc-label-width: 6.6rem;
  --header-height: 3.55rem;
  --section-bar-height: 2.15rem;
  --cover-width: min(47rem, 76vw);
  --cover-max: 70%;
  --cover-width-narrow: min(100%, 30rem);
  --cover-frame: 5px;
  --figure-max-height: 72vh;

  /* Rhythm: one gap above and below every main-section rule, measured to the text's line box. */
  --section-gap: clamp(3.5rem, 8vw, 7rem);
  --divider-width: 1px;
  --chapter-gap: 3.5rem;
  --chapter-rule: 1px solid var(--rule);
  --box-pad: 2.5rem;
  --box-pad-narrow: 1.5rem;
  --end-space: 5rem;
}

@media (max-width: 900px) {
  :root { --reading-inset: 0rem; }
}

/* Dark theme: System follows the OS unless the reader chose Off; On always wins.
   The two blocks below must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --parchment: #1b1712;
    --parchment-mid: #241f18;
    --parchment-dark: #2c251c;
    --ink: #e8dfc9;
    --ink-mid: #c9bc9c;
    --ink-light: #a89877;
    --rust: #e0785f;
    --rust-light: #ef9478;
    --gold: #d4af5a;
    --rule: #4a4030;
    --note-bg: #2a2318;
    --note-border: #6b5636;
    --shadow: rgba(0, 0, 0, 0.5);
    --paper-highlight: rgba(255, 240, 210, 0.045);
    --paper-texture: rgba(0, 0, 0, 0.32);
    --panel-highlight: rgba(255, 255, 255, 0.06);
    --link-hover-bg: rgba(224, 120, 95, 0.18);
    --backdrop-bg: rgba(0, 0, 0, 0.6);
    --on-accent: #1b1712;
    --title-bg: #17130f;
    --title-ink: #f2e9d6;
    --title-kicker: #dba765;
    --title-rule: #6b5636;
    --cover-border: rgba(232, 223, 201, 0.4);
    --header-shadow: rgba(0, 0, 0, 0.5);
    --toggle-hover-bg: rgba(255, 255, 255, 0.12);
  }

  :root:not([data-theme="light"]) img { filter: var(--img-dark-filter); }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --parchment: #1b1712;
  --parchment-mid: #241f18;
  --parchment-dark: #2c251c;
  --ink: #e8dfc9;
  --ink-mid: #c9bc9c;
  --ink-light: #a89877;
  --rust: #e0785f;
  --rust-light: #ef9478;
  --gold: #d4af5a;
  --rule: #4a4030;
  --note-bg: #2a2318;
  --note-border: #6b5636;
  --shadow: rgba(0, 0, 0, 0.5);
  --paper-highlight: rgba(255, 240, 210, 0.045);
  --paper-texture: rgba(0, 0, 0, 0.32);
  --panel-highlight: rgba(255, 255, 255, 0.06);
  --link-hover-bg: rgba(224, 120, 95, 0.18);
  --backdrop-bg: rgba(0, 0, 0, 0.6);
  --on-accent: #1b1712;
  --title-bg: #17130f;
  --title-ink: #f2e9d6;
  --title-kicker: #dba765;
  --title-rule: #6b5636;
  --cover-border: rgba(232, 223, 201, 0.4);
  --header-shadow: rgba(0, 0, 0, 0.5);
  --toggle-hover-bg: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] img { filter: var(--img-dark-filter); }

/* Reading inset: on the right when page markers are shown (they sit in it), else even on both sides. */
body {
  --inset-start: calc(var(--reading-inset) / 2);
  --inset-end: calc(var(--reading-inset) / 2);
}

body:has(.source-page-origin):not(.markers-hidden) {
  --inset-start: 0rem;
  --inset-end: max(var(--reading-inset), var(--source-rail));
}

/* ---- Base ---- */

* { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--header-h-actual, var(--header-height)) + var(--section-bar-height) + 0.75rem);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 10%, var(--paper-highlight), transparent 34rem),
    repeating-linear-gradient(0deg, var(--paper-texture) 0, var(--paper-texture) 1px, transparent 1px, transparent 4px),
    var(--parchment);
  font-family: var(--font-body);
  font-size: var(--text-size);
  line-height: var(--leading);
  text-rendering: optimizeLegibility;
}

a {
  color: var(--rust);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:hover { color: var(--rust-light); }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.65rem 1rem;
  color: var(--on-accent);
  background: var(--rust);
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

/* ---- Masthead ---- */

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  color: var(--header-text);
  background: var(--header-bg);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 0.25rem 1rem var(--header-shadow);
}

.site-nav {
  width: min(100% - 2rem, var(--nav-width));
  min-height: var(--header-height);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  font-family: var(--font-display);
  font-size: var(--label-size);
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.site-nav a {
  color: inherit;
  text-decoration: none;
}

.nav-leading {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.contents-toggle,
.contents-close,
.contents-backdrop {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.contents-toggle {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--header-text);
  background: transparent;
  border-radius: 0.25rem;
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1;
}

.contents-toggle:hover,
.contents-toggle[aria-expanded="true"] {
  color: var(--toggle-hover-color);
  background: var(--toggle-hover-bg);
}

.nav-brand {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.55rem;
  row-gap: 0.08rem;
  font-size: 0.86rem;
  line-height: 1.3;
}

.nav-title,
.nav-meta-group,
.top-link { white-space: nowrap; }

.nav-meta-group {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
}

.nav-separator {
  color: var(--nav-accent);
  font-size: 0.68rem;
}

.nav-meta {
  color: var(--nav-meta);
  font-size: 0.54rem;
  letter-spacing: 0.045em;
}

/* ---- Floating section bar: sticks under the masthead, names the current section ---- */

.section-bar {
  position: sticky;
  z-index: 25;
  top: var(--header-h-actual, var(--header-height));
  display: flex;
  align-items: center;
  min-height: var(--section-bar-height);
  color: var(--ink-light);
  background: var(--parchment-mid);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 0.15rem 0.4rem var(--shadow);
  font-family: var(--font-display);
  font-size: var(--label-size);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.35rem);
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms, padding-left 180ms ease;
}

.section-bar.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 160ms ease, transform 160ms ease, padding-left 180ms ease;
}

.section-bar-inner {
  width: min(100% - 2 * var(--gutter), var(--measure));
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--inset-start) var(--inset-end);
  display: flex;
  align-items: center;
}

main {
  min-height: 100vh;
  overflow-x: clip;
  transition: margin-left 180ms ease;
}

/* ---- Title page: fills the viewport below the masthead ---- */

.title-page {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  padding: clamp(3rem, 6vw, 5rem) 1.5rem var(--section-gap);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: space-between;
  background: var(--title-bg);
  text-align: center;
  text-indent: 0;
  --credit-gap: clamp(1.75rem, 4vh, 2.75rem);
}

.title-page h1 {
  margin: 0;
  color: var(--title-ink);
  font-family: var(--font-title);
  font-size: var(--title-size);
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 0.82; /* raise only for a title whose accented capital would touch the line above */
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.kicker {
  margin: clamp(1.45rem, 2.8vw, 2.2rem) 0 0;
  color: var(--title-kicker);
  font-family: var(--font-title);
  font-size: clamp(0.74rem, 1.2vw, 1rem);
  letter-spacing: 0.34em;
  line-height: 1.3;
  text-transform: uppercase;
}

.title-rule {
  width: 8rem;
  margin: clamp(2.5rem, 5vw, 4rem) 0 clamp(2.75rem, 5vw, 3.75rem);
  border-top: 1px solid var(--title-rule);
}

.cover-figure {
  width: var(--cover-width);
  max-width: var(--cover-max);
  margin: 0;
  border: var(--cover-frame) solid var(--cover-border);
}

.cover-figure img {
  display: block;
  width: 100%;
  height: auto;
  filter: sepia(0.1) contrast(1.03);
}

/* Credits: the author line sits under the rule, the other credits in .title-credits, the stamp after them. */
.title-page > .credit { margin-bottom: var(--credit-gap); }

.cover-figure + .title-credits { margin-top: var(--credit-gap); }

.title-credits {
  display: grid;
  gap: var(--credit-gap);
  align-content: start;
}

.credit {
  margin: 0;
  color: var(--title-ink);
  font-family: var(--font-display);
  line-height: 1.3;
  text-wrap: balance;
}

.credit-role {
  color: var(--title-kicker);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.credit strong {
  margin-left: 0.35em;
  font-size: clamp(1.3rem, 2.2vw, 1.75rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Additional title-page text (version line, ornament): the role label's font, size, colour and letter spacing.
   Chinese or similar characters take the font stack, size and colour only: add .title-extra-cjk. */
.title-extra {
  margin: 0;
  color: var(--title-kicker);
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  line-height: 1.3;
  text-transform: uppercase;
}

.title-extra-cjk {
  letter-spacing: normal;
  text-transform: none;
}

.edition {
  margin: 0.25rem 0 0;
  color: var(--rust);
  font-weight: 700;
}

.edition span { color: var(--ink); }

.library-edition {
  margin: 2.5rem 0 0;
  color: var(--ink-light);
  font-family: var(--font-display);
  font-size: var(--label-size);
  font-weight: 500;
  letter-spacing: 0.22em;
  line-height: 1.2;
  text-box: trim-end text;
  text-transform: uppercase;
}

.eyebrow {
  margin: 1rem 0 0.25rem;
  color: var(--rust);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---- Main sections: each opens with the spacing-line-spacing divider ---- */

.document-section {
  position: relative;
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin-inline: auto;
  padding: var(--section-gap) var(--inset-end) var(--section-gap) var(--inset-start);
  border-top: var(--divider-width) solid var(--rule);
}

/* A section's padding is the gap the reader sees: its first and last lines are trimmed to the
   glyphs, and its first and last in-flow children lose their outer margins.  The trim sits on the
   text block itself; Chromium can skip a section-level trim when a marker is its first or last child. */
.document-section > :first-child:not(.source-page-origin),
.document-section > .source-page-origin:first-child + * { margin-top: 0; }

:is(.document-section, .chapter, .source-note) > :not(.source-page-origin):is(:last-child, :has(+ .source-page-origin:last-child)) {
  margin-bottom: 0;
}

.document-section > h2,
.chapter-title { text-box: trim-start text; }

:where(.document-section, .chapter) > :where(:not(.source-page-origin, .chapter, .note-box, .source-note, .table-scroll):is(:last-child, :has(+ .source-page-origin:last-child))) {
  text-box: trim-end text;
}

/* The trim is progressive enhancement.  Without text-box, these em offsets (measured for the house
   fonts) stand in for it: the heading glyphs' overhang above the line box, and the leading of a line. */
@supports not (text-box: trim-both text) {
  .document-section > h2,
  .source-note > h2 { padding-top: 0.09em; }

  .chapter-title { padding-top: 0.2em; }

  .document-section > :not(.source-page-origin, h2, .note-box, .table-scroll):is(:first-child, .source-page-origin:first-child + *) {
    margin-top: -0.14em;
  }

  :is(.document-section, .chapter, .source-note) > :not(.source-page-origin, .chapter, .note-box, .source-note, .table-scroll, table.contents):is(:last-child, :has(+ .source-page-origin:last-child)) {
    margin-bottom: -0.14em;
  }
}

.document-section > h2 {
  margin: 0 0 1.5rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--h2-size);
  line-height: 1.2;
  text-align: center;
}

:is(.document-section, .chapter) > p {
  margin: 0.8rem 0;
  /* Left-aligned, never justify (Captain order 2026-10-12): without
     hyphenation, justified lines before a long word stretch their word gaps. */
  text-align: left;
  text-indent: var(--para-indent);
  text-wrap: pretty;
}

/* Chromium can stretch a pretty-wrapped last line that ends in an absolute marker. */
.document-section p:has(> .source-page-origin:last-child) { text-wrap: wrap; }

/* ---- Small chapters: a lighter rule and gap between them, never the main divider ---- */

/* The rule spans the whole column; the negative margins and matching padding leave the text in place. */
.chapter ~ .chapter {
  margin: var(--chapter-gap) calc(-1 * var(--inset-end)) 0 calc(-1 * var(--inset-start));
  padding: var(--chapter-gap) var(--inset-end) 0 var(--inset-start);
  border-top: var(--chapter-rule);
}

.chapter-title {
  margin: 0 0 2rem;
  color: var(--rust);
  font-family: var(--font-display);
  font-size: var(--chapter-title-size);
  line-height: 1;
  text-align: center;
}

.chapter-title .eyebrow { margin: 0 0.9rem 0 0; }

/* ---- Colophon: two-column label/value grid; the top rule comes from .document-section ---- */

.colophon { font-size: 0.9rem; }

.colophon dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  column-gap: 1.25rem;
  row-gap: 0.5rem;
}

.colophon dt {
  color: var(--ink-light);
  font-weight: 600;
}

.colophon dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The grid rows have no trim of their own; trim the first and last row to their line boxes. */
.colophon :is(dt, dd):first-of-type { text-box: trim-start text; }
.colophon dd:last-of-type { text-box: trim-end text; }

@media (max-width: 560px) {
  .colophon dl {
    display: block;
  }
  .colophon dt {
    margin-top: 0.7rem;
  }
  .colophon dt:first-child {
    margin-top: 0;
  }
}

/* ---- Printed Table of Contents: the standard two-column table ---- */

/* The page's own heading element: centred, display font, regular weight. */
#table-of-contents-title {
  margin: 0 auto 1.25rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
}

table.contents {
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.contents td {
  padding: 0.2rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

table.contents a {
  color: var(--rust);
  text-decoration: none;
}

table.contents a:hover { text-decoration: underline; }

/* The table's last row text sits 0.34rem (measured) above the line-box bottom a prose line is trimmed
   to; take it back so the divider after the table matches every other boundary.  The :is() copies the
   specificity of the rule above that zeroes a last child's margin, which this must outrank. */
.document-section > table.contents:is(:last-child, :has(+ .source-page-origin:last-child)) { margin-bottom: -0.34rem; }

/* A part or any group heading: bold cells, the part gap above. */
table.contents tr.toc-part td { padding-top: 1.8em; }
table.contents td:first-child { white-space: nowrap; }

/* A counted illustration, figure or map: its own marker, in the right column. */
table.contents tr.contents-figure td { padding-top: 0.2rem; }
table.contents tr.contents-figure a { color: inherit; }
table.contents tr.contents-figure a::before {
  content: "\2022";
  margin-right: 0.5em;
}

/* ---- Contents panel: group links ---- */

.major-links > a {
  display: block;
  color: var(--ink);
  background: var(--parchment-mid);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  text-transform: uppercase;
}

.major-links > a:hover {
  border-color: var(--gold);
  color: var(--rust);
}

/* ---- Note boxes (optional; switched from the Contents panel) ---- */

.note-box {
  margin: 1.5rem 0 1.5rem 1.6rem;
  padding: 0.7rem 0.9rem;
  color: var(--ink-mid);
  background: var(--note-bg);
  border-left: 3px solid var(--note-border);
  font-size: var(--note-size);
  line-height: var(--leading);
  text-align: left;
  text-indent: 0;
}

.note-box p { margin: 0 0 0.45rem; }
.note-box > :last-child { margin-bottom: 0; }

.note-ref {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--rust);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.footnote-call {
  margin-left: 0.08em;
  color: var(--rust);
  font-size: 0.66em;
  line-height: 0;
  text-decoration: none;
  vertical-align: super;
}

.footnote-call:is(:hover, :focus-visible) { text-decoration: underline; }

body.notes-hidden .note-box,
.note-box.is-hidden { display: none; }

/* ---- Source-page markers in the right rail (optional; PDF sources only) ---- */

/* One format on one line (Captain order 2026-10-17, from the Prototype): every marker is a
   --source-label box whose two lines are left-aligned, so both start on one vertical line, 0.40625rem
   inside the column's right edge: 45.5px past the end of the body text at the default tokens (the rail
   is 3.25rem, so the label starts in its last 6.5px and hangs into the page margin).  The line is
   measured from the column, never from the block a marker sits in; text-indent: 0 keeps a paragraph's
   indent out of the label.  The page edge is the one thing that moves it.  Where the margin beside the
   column is only the gutter (below 1163px with the Contents panel docked, 907px without, at the default
   tokens), a label hung that far out would be cut off by main's clip, so the line slides left, for
   every marker at once, only as far as keeps the box inside the page edge (down to --source-rail -
   --source-label + --gutter = 24px past the text).  --source-gutter is that margin as the layout makes
   it: the column is min(100% - 2 * gutter, measure), centred in main, which the docked panel narrows by
   its own width.  (100vw counts a classic scrollbar, which overstates the margin by half its width.  The
   box's room beyond the widest label, 7.5px for a three-digit page, takes up a 15px one: that label then
   ends flush with the page edge, and the box's overshoot is clipped by main.) */
body { --docked-panel: 0rem; }

@media (min-width: 901px) {
  body.contents-open { --docked-panel: var(--panel-width); }
}

.source-page-origin {
  --source-gutter: max(var(--gutter), calc((100vw - var(--docked-panel) - var(--measure)) / 2));
  --source-label-x: min(-0.40625rem, calc(var(--source-gutter) - var(--source-label)));
  position: absolute;
  left: calc(100% + var(--source-label-x));
  width: var(--source-label);
  margin: 0.15rem 0 0;
  color: var(--ink-light);
  font-family: var(--font-display);
  font-size: 0.44rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-align: left;
  text-indent: 0;
  text-transform: uppercase;
  scroll-margin-top: 6rem;
}

.source-page-origin span {
  display: block;
  white-space: nowrap;
}

/* The title page is a full-width box: the column's right edge is its own right edge less the same gutter. */
.title-page > .source-page-origin {
  left: calc(100% - max(1rem, calc(50% - var(--measure) / 2)) + var(--source-label-x));
  margin: 0;
}

/* Markers off: the inset re-centres the text; its width does not change. */
body.markers-hidden .source-page-origin { display: none; }

/* ---- Figures and tables (optional) ---- */

.source-figure {
  margin: 1.75rem auto;
  text-align: center;
}

.source-figure + .source-figure { margin-top: 3.5rem; }

.source-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: var(--figure-max-height);
  margin-inline: auto;
  object-fit: contain;
}

.source-figure.framed img { border: var(--cover-frame) solid var(--cover-border); }

.source-figure figcaption {
  margin-top: 0.65rem;
  color: var(--ink-light);
  font-size: 0.83rem;
  font-style: italic;
}

.figure-full {
  display: block;
  cursor: zoom-in;
}

.figure-full img { transition: filter 140ms ease; }
.figure-full:is(:hover, :focus-visible) img { filter: brightness(1.04); }

/* ---- Picture viewer (Captain, 2026-11-27): every picture in the text opens at full size and resolution in a pop-up box ---- */
.picture-viewer {
  width: min(96vw, 1600px);
  max-width: 96vw;
  height: 92vh;
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--parchment);
  color: var(--ink);
  box-shadow: 0 12px 40px var(--shadow);
  overflow: hidden;
}
.picture-viewer[open] { display: flex; flex-direction: column; }
.picture-viewer::backdrop { background: rgba(10, 8, 6, 0.72); }
.picture-viewer-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0.9rem;
  background: var(--header-bg);
  color: var(--header-text);
}
.picture-viewer-title { flex: 1; font-variant-caps: small-caps; letter-spacing: 0.04em; }
.picture-viewer-open { color: var(--nav-accent, var(--header-text)); font-size: 0.85rem; }
.picture-viewer-close {
  border: 0;
  background: transparent;
  color: var(--header-text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}
.picture-viewer-close:is(:hover, :focus-visible) { color: var(--toggle-hover-color); }
.picture-viewer-scroll { flex: 1; overflow: auto; display: grid; place-items: center; }
/* the full-resolution picture, at its own pixels; never dimmed by the dark theme */
:root .picture-viewer img.picture-viewer-image { display: block; max-width: none; height: auto; filter: none; margin: auto; }

.table-scroll {
  margin: 1.6rem 0;
  overflow-x: auto;
}

.source-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.source-table caption {
  margin-bottom: 0.55rem;
  padding-bottom: 0.4rem;
  color: var(--rust);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: left;
}

.source-table th,
.source-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  text-indent: 0;
  vertical-align: top;
}

.source-table thead th {
  color: var(--rust);
  background: var(--note-bg);
  border-bottom: 2px solid var(--note-border);
  font-family: var(--font-display);
  font-size: var(--label-size);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.source-table tbody tr:last-child > * { border-bottom: 0; }
.source-table tbody tr:nth-child(even) { background: var(--parchment-mid); }

.source-table tbody th[scope="row"] {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

/* ---- Reference: the last section; the archival-edition box follows it, with no divider between ---- */

.document-section.citations > p {
  margin: 1.1rem 0;
  padding-left: 2em;
  text-indent: -2em;
  text-align: left;
  text-wrap: pretty;
}

/* The box is Reference's closing element, so Reference has no space below it. */
.citations { padding-bottom: 0; }

.permalink { overflow-wrap: anywhere; }

/* The About box closes the page: two lines under Reference's last line, the full column wide, and
   --end-space above the footer.  There is no rule above it.
   Captain order, 2026-11-27: two lines of the Reference entries' line height (same font size), plus the
   0.14em of leading the last entry's text trim removes, so it reads like an untrimmed page.  Was 1.5rem. */
.source-note {
  position: relative;
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin: calc(2 * var(--leading) * 1em + 0.14em) auto var(--end-space);
  padding: var(--box-pad);
  background: var(--note-bg);
  border: 1px solid var(--rule);
  box-shadow: 0 0.8rem 2rem var(--shadow);
  text-box: trim-both text;
}

.source-note > h2 {
  margin: 0 0 1.5rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--box-title-size);
  line-height: 1.2;
  text-align: left;
}

/* ---- Footer: dark bar in both themes ---- */

.site-footer {
  padding: 2.5rem 1rem;
  color: var(--footer-text);
  background: var(--footer-bg);
  border-top: 3px solid var(--gold);
  font-size: var(--footer-size);
  text-align: center;
  text-indent: 0;
}

.site-footer p { margin: 0.2rem; }
.site-footer a { color: var(--toggle-hover-color); }

/* ---- Contents panel: docked on wide screens, an overlay on narrow ones ---- */

.contents-panel {
  position: fixed;
  z-index: 40;
  top: var(--header-h-actual, var(--header-height));
  bottom: 0;
  left: 0;
  width: min(var(--panel-width), calc(100vw - 3rem));
  padding: 1.25rem 1rem 2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, var(--paper-texture) 0, var(--paper-texture) 1px, transparent 1px, transparent 4px),
    var(--parchment);
  border-right: 1px solid var(--rule);
  box-shadow: 0.5rem 0 1.4rem var(--shadow);
  font-size: 1rem;
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform 180ms ease, visibility 0s linear 180ms;
}

.contents-open .contents-panel {
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}

.contents-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.contents-panel-head .eyebrow { margin-top: 0; }

.contents-panel-head h2 {
  margin: 0;
  font-size: 1.65rem;
}

.contents-close {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--ink-light);
  background: transparent;
  border-radius: 0.25rem;
  font-size: 1.6rem;
  line-height: 1;
}

.contents-close:hover {
  color: var(--rust);
  background: var(--link-hover-bg);
}

.contents-backdrop {
  position: fixed;
  z-index: 35;
  inset: var(--header-h-actual, var(--header-height)) 0 0;
  display: none;
  padding: 0;
  background: var(--backdrop-bg);
}

/* Display switches: one recessed control surface per group. */
.display-controls {
  margin: 1rem 0 1.25rem;
  padding: 0.55rem 0.7rem 0.6rem;
  background: var(--parchment-dark);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 2px 6px var(--shadow), inset 0 1px 0 var(--panel-highlight);
}

.display-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.28rem 0;
}

.display-toggle-master {
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--note-border);
}

.display-toggle-child { padding-left: 0.85rem; }

.display-toggle-label {
  color: var(--ink-mid);
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-transform: uppercase;
}

.display-toggle-child .display-toggle-label {
  color: var(--ink-light);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: none;
}

.display-toggle-switch,
.theme-switch-option {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-light);
  cursor: pointer;
}

.display-toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  padding: 0.15rem;
  border: 0;
  background: none;
}

/* A child switch while the master is off: readable, not operable. */
.display-toggle-switch:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.display-toggle-track {
  display: inline-block;
  position: relative;
  width: 1.85rem;
  height: 0.85rem;
  border: 1px solid var(--note-border);
  border-radius: 0.85rem;
  transition: background-color 0.15s ease;
}

.display-toggle-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.13rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--note-border);
  transform: translateY(-50%);
  transition: left 0.15s ease, background-color 0.15s ease;
}

.display-toggle-switch[aria-checked="true"] .display-toggle-track { background: var(--parchment); }

.display-toggle-switch[aria-checked="true"] .display-toggle-track::after {
  left: calc(100% - 0.68rem);
  background: var(--rust);
}

.display-toggle-state {
  min-width: 1.6rem;
  text-align: left;
}

/* Dark Mode: a three-way segmented control (System / Off / On). */
.theme-switch {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--note-border);
  border-radius: 0.85rem;
  overflow: hidden;
}

.theme-switch-option {
  padding: 0.2rem 0.5rem;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--note-border);
  line-height: 1.4;
}

.theme-switch-option:first-child { border-left: 0; }

.theme-switch-option[aria-checked="true"] {
  color: var(--parchment);
  background: var(--rust);
}

.display-toggle-switch:focus-visible,
.theme-switch-option:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

.toc-heading {
  margin: 0;
  color: var(--rust);
  font-family: var(--font-display);
  font-size: 0.86rem;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
}

.toc-heading a {
  color: inherit;
  text-decoration: none;
}

.major-links {
  margin: 1.25rem 0 1.75rem;
  display: grid;
  gap: 0.55rem;
}

.major-links > a {
  padding: 0.65rem 0.75rem;
  font-size: var(--label-size);
  letter-spacing: 0.04em;
  text-align: center;
}

.major-links > .toc-group { margin-bottom: 1.1rem; }
.toc-group .toc-heading { margin-block: 1em; }

.chapter-links {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  list-style: none;
}

.chapter-links a {
  display: block;
  padding: 0.35rem 0.25rem;
  color: var(--ink-mid);
  border-bottom: 1px dotted var(--rule);
  text-align: center;
  text-decoration: none;
}

/* The word before each number is for screen readers only. */
.chapter-links span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

@media (min-width: 901px) {
  .contents-open main,
  .contents-open .site-footer { margin-left: var(--panel-width); }
  .contents-open .section-bar { padding-left: var(--panel-width); }
  .site-footer { transition: margin-left 180ms ease; }
}

@media screen and (max-width: 900px) {
  body.contents-open { overflow: hidden; }
  .contents-open .contents-backdrop { display: block; }
}

/* ---- Narrow screens ---- */

@media (max-width: 720px) {
  html { scroll-padding-top: calc(8rem + var(--section-bar-height)); }
  .site-nav { gap: 0.75rem; }
  .nav-brand { padding-block: 0.38rem; }
  .nav-meta { font-size: 0.5rem; }
  .title-page {
    min-height: calc(100vh - 6.5rem);
    padding: 2.75rem 1rem var(--section-gap);
  }

  .title-page h1 {
    font-size: var(--title-size-narrow);
    line-height: 0.86;
  }

  .kicker {
    max-width: 23rem;
    letter-spacing: 0.24em;
  }

  .title-rule {
    width: 6rem;
    margin-block: 2.25rem 2.5rem;
  }

  .cover-figure { width: var(--cover-width-narrow); }

  :is(.document-section, .chapter) > p {
    text-align: left;
    text-indent: var(--para-indent-narrow);
  }

  .note-box { margin-left: 0.55rem; }
  .source-note { padding: var(--box-pad-narrow); }
  .source-page-origin { scroll-margin-top: 9rem; }
}

/* ---- Print: the page follows whatever the reader chose on screen ---- */

@media print {
  @page {
    size: letter;
    margin: 0.65in 0.7in;
  }

  body {
    color: var(--print-ink);
    background: var(--print-paper);
    font-size: 11pt;
  }

  main { overflow-x: visible; }

  .site-header,
  .section-bar,
  .skip-link,
  .contents-backdrop,
  .contents-toggle,
  .contents-close,
  .display-controls,
  .site-footer a[href="#top"] { display: none; }

  a {
    color: var(--print-ink);
    text-decoration: none;
  }

  .title-page {
    min-height: 8.4in;
    padding: 0.5in 0;
    background: var(--print-paper);
  }

  .cover-figure,
  .cover-figure img {
    width: auto;
    max-width: 100%;
    max-height: 4in;
  }

  .document-section {
    width: 100%;
    break-before: page;
  }

  .contents-panel {
    position: static;
    width: 100%;
    padding: 0.35in 0;
    overflow: visible;
    border-right: 0;
    box-shadow: none;
    transform: none;
    visibility: visible;
    break-before: page;
    break-after: page;
  }

  h2,
  h3,
  h4 { break-after: avoid; }

  .note-box,
  figure,
  tr { break-inside: avoid; }

  .table-scroll { overflow-x: visible; }
  .source-table tbody tr:nth-child(even) { background: transparent; }
  .source-table :is(th, td) { border-bottom: 1px solid var(--print-rule); }

  .source-note {
    background: none;
    border: 0;
    box-shadow: none;
  }

  .site-footer {
    margin-top: 0.3in;
    padding-top: 0.15in;
    color: var(--print-ink);
    background: none;
    border-top: 1px solid var(--print-rule);
  }

  /* An absolute box is lost where its container spans pages; a float fragments with the text. */
  .source-page-origin {
    position: static;
    float: right;
    width: auto;
    margin: 0 0 0.04in 0.14in;
  }

  .source-page-origin span { display: inline; }
  .source-page-origin span + span::before { content: " "; }
}

/* !important is unavoidable here: reduced motion must beat every transition, whatever its specificity.
   "none", not a 0.01ms duration: a tiny duration with the default transition-property "all"
   animates every property change on every element for one frame. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Captain's order: Map, Table, Illustration and Figure rows indented slightly, as sub-entries of their parent. */
table.contents tr.contents-figure td:last-child { padding-left: 1.6rem; }

/* ---- Table of Contents and Contents panel versions (TOC-LAYOUTS.md) ----
   Every rule below matches only a version's own classes; the default table and the default panel
   above do not use them.  A build keeps the blocks of the versions it uses and deletes the rest. */

/* Boxed group heading (every printed version): <h3 class="contents-page-part"><a href="#part">. */
.contents-page-part {
  margin: 0 0 0.75rem;
  text-align: left;
}

.contents-page-part a,
table.contents .contents-page-part a {
  display: block;
  padding: 0.6rem 0.85rem;
  color: var(--ink);
  background: var(--parchment-mid);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: normal; /* the table cells are nowrap: a long boxed title wraps inside its box (Captain, 2026-11-26) */
}

.contents-page-part a:hover,
table.contents .contents-page-part a:hover {
  border-color: var(--gold);
  color: var(--rust);
  text-decoration: none;
}

/* Printed version "table", with boxed group headings: <tr class="toc-box"><td colspan="2">.
   The table then spans the column, and the label column takes --toc-label-width. */
table.contents:has(tr.toc-box, tr.toc-two-row) {
  width: 100%;
  table-layout: fixed;
}

table.contents:has(tr.toc-box) td:first-child:not([colspan]) { width: var(--toc-label-width); }
table.contents tr.toc-box td { padding: 0; }
table.contents tr.toc-box-later td { padding-top: 2rem; }
table.contents tr.toc-box + tr td { padding-top: 0.2rem; }

/* Printed version "two-up": label-only chapters in two columns inside one full-width row,
   <tr class="toc-two-row"><td colspan="2"><div class="toc-two"><div class="toc-chap">. */
table.contents:has(tr.toc-two-row) td:first-child:not([colspan]) {
  width: auto;
  white-space: normal;
}

.toc-two {
  columns: 2;
  column-gap: 2rem;
}

.toc-chap { break-inside: avoid; }

.toc-chap > a,
.toc-work-entry a {
  display: block;
  padding: 0.2rem 0.6rem;
}

.toc-two .contents-figure { padding-left: 1.6rem; }

.toc-two .contents-figure a {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  color: inherit;
  text-decoration: none;
}

.toc-two .contents-figure a::before {
  content: "\2022";
  margin-right: 0.5em;
}

.toc-end-entry {
  display: inline-block;
  padding: 0 0.6rem;
}

@media (max-width: 26rem) {
  .toc-two { column-gap: 0; }
}

/* Printed version "lists": groups of plain lists, <div class="contents-page"> >
   <div class="contents-page-group"> > (boxed heading) + <ul class="contents-page-list">. */
.contents-page {
  display: grid;
  gap: 2rem;
  margin-top: 1.75rem;
}

.contents-page-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
  list-style: none;
}

.contents-page-list a {
  display: block;
  padding: 0.32rem 0.4rem;
  color: var(--ink-mid);
  border-radius: 3px;
  font-size: 0.94rem;
  line-height: 1.4;
  text-decoration: none;
}

.contents-page-list a:hover {
  color: var(--rust);
  background: var(--link-hover-bg);
}

/* Two columns filled downwards: set style="--rows: N" on the list, N = half the entries, rounded up. */
.contents-page-list-2col {
  grid-auto-flow: column;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), auto);
  column-gap: 2rem;
}

/* Label and title on one line: <li><a>Label:</a> <span class="toc-chapter-title">Title</span></li>. */
.toc-chapters li:not(.contents-page-illustration) {
  display: grid;
  grid-template-columns: max-content 1fr;
}

.toc-chapters li:not(.contents-page-illustration) > a {
  width: var(--toc-label-width);
  color: var(--rust);
  white-space: nowrap;
}

.toc-chapter-title {
  padding: 0.32rem 0.4rem;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.4;
}

/* A counted illustration, figure, map or table in a list. */
.contents-page-illustration > a::before {
  content: "\2022";
  margin-right: 0.5em;
}

/* Front and end matter entries (no label, outside the work's own groups): class on the <li>. */
.contents-page-matter > a {
  color: var(--rust);
  text-transform: uppercase;
}

.contents-page-list > .contents-page-illustration { margin-left: 1rem; }
.contents-page-list.toc-chapters > .contents-page-illustration { margin-left: calc(var(--toc-label-width) + 1rem); }
.contents-page-group:last-child .contents-page-list > li:last-child > a { padding-bottom: 0; }

@media (max-width: 720px) {
  .contents-page-list-2col {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
}

/* Entries outside the work's own groups (Captain, 2026-11-27): front matter above the first boxed heading, end
   matter and Reference under the boxed "Appendices".  Two paths, checked by check_page.py (group toc-outside):
   1. A natural indent point -- the "table" version's title column, where second-order text starts.  An unlabelled
      entry sits in the title cell; a labelled one keeps its label in the label column, its title following on the
      line.  The version's own markup already does this; nothing to add.
   2. No natural indent point ("two-up", "lists"): the entries step in 2.5rem from the work's own entries.
   In every version the rust part (an unlabelled entry's link, or a label) is in capitals; a label's title follows
   in the text colour and the page's case.  Sub-entries (figures) keep their own step beneath their parent. */
table.contents:has(tr.toc-box):not(:has(tr.toc-two-row)) tr:not(.toc-box, .toc-box ~ tr, .contents-figure) a,
table.contents:not(:has(tr.toc-two-row)) tr.toc-box:has(a[href="#appendices-part"]) ~ tr:not(.contents-figure) a,
.toc-work-entry a,
.toc-end-entry,
.contents-page-group:has(> .contents-page-part a[href="#appendices-part"]) .toc-chapters li:not(.contents-page-illustration) > a {
  text-transform: uppercase;
}

table.contents:has(tr.toc-two-row) tr:not(.toc-box, .toc-box ~ tr) td,
table.contents:has(tr.toc-two-row) tr.toc-box:has(a[href="#appendices-part"]) ~ tr td { padding-left: calc(0.6rem + 2.5rem); }
table.contents:has(tr.toc-two-row) tr.contents-figure:not(.toc-box ~ tr) td { padding-left: calc(1.6rem + 2.5rem); }

.contents-page-group:not(:has(> .contents-page-part)) > .contents-page-list,
.contents-page-group:has(> .contents-page-part a[href="#appendices-part"]) > .contents-page-list { padding-left: 2.5rem; }

/* Panel version "lines": one entry a line, <ul class="panel-toc"><li><a>. */
.panel-toc,
.panel-toc ul {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.05rem;
  list-style: none;
}

.panel-toc a {
  display: block;
  padding: 0.28rem 0.3rem;
  color: var(--ink-mid);
  border-radius: 3px;
  font-size: 0.82rem;
  line-height: 1.35;
  text-decoration: none;
}

.panel-toc a:hover {
  color: var(--rust);
  background: var(--link-hover-bg);
}

.toc-group .toc-heading { text-wrap: balance; }

/* Panel version "parts": an entry that holds a nested list is a boxed link, its list under it. */
.panel-toc:has(ul) { gap: 0.55rem; }
.panel-toc ul { margin-bottom: 1.1rem; }
.panel-toc > li:last-child > ul { margin-bottom: 0; }

.panel-toc > li:has(> ul) > a {
  margin-bottom: 0.55rem;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  background: var(--parchment-mid);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: var(--label-size);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.panel-toc > li:has(> ul) > a:hover {
  border-color: var(--gold);
  color: var(--rust);
  background: var(--parchment-mid);
}

/* ---- Part dividers: this section's top rule and the next section's make line, heading, line ---- */

/* The heading's last line sits 1px (measured) nearer the next rule than a prose line does. */
.part-divider {
  padding-bottom: calc(var(--section-gap) + 1px);
  text-align: center;
}

.part-divider > h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 400;
  line-height: 1.25;
  text-transform: uppercase;
}

/* ======== Mencius-Eno-v10: this build's own blocks (the kinds of block this source has) ========
   Layers, equal steps: 0 the translation; 1 commentary, introductions, glossed continuation (the note boxes' own left edge);
   2 verse, commentary quotation, glossary sub-items. */
:root { --layer: 1.6rem; }

@media (max-width: 720px) {
  :root { --layer: 0.55rem; }
}

/* Publication note (the source's own front page), as the Prototype sets it: centred lines. */
.front-matter { text-align: center; }
.front-matter > p { margin: 0.8rem 0; text-align: center; text-indent: 0; }
.front-matter > p:first-child { margin-top: 0; text-box: trim-start text; }
.permissions { color: var(--ink-mid); }
.resource-list { width: min(100%, 42rem); margin: 1.2rem auto 0; padding: 0; list-style: none; }
.resource-list li { margin-block: 0.5rem; }
.resource-list li:last-child { margin-bottom: 0; }
.front-matter > .resource-lead { margin-top: 2.5rem; }

/* Headings inside a section */
.document-section h3 {
  margin: 2.4rem 0 0.8rem;
  color: var(--rust);
  font-family: var(--font-display);
  font-size: 1.25rem;
  text-align: left;
}

.document-section h4 {
  margin: 2rem 0 0.75rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  text-align: left;
}

.document-section h3.segment-heading {
  margin: 2rem 0 0.75rem;
  color: var(--ink);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.document-section h3.index-letter { margin: 2.4rem 0 0.8rem; font-size: 1.25rem; text-align: center; }
.document-section > h2 .book-line { display: block; }
/* Captain, 2026-12-04: the Book name (the middle line, e.g. "DUKE WEN OF TENG") takes the palette's title amber, light and dark; "BOOK N" and "PART X" / "INTRODUCTION" keep the heading colour. */
.document-section > h2 .book-line:nth-child(2) { color: var(--title-kicker); }
span.run-in { text-decoration: underline; text-underline-offset: 0.2em; }

/* Passages: the translation at layer 0, its commentary at layer 1, verse at layer 2 */
.passage { margin: 2.4rem 0 0; }
.passage:first-child { margin-top: 0; }
.passage-id { margin-right: 0.15em; color: var(--rust); font-family: var(--font-display); letter-spacing: 0.04em; }
p.passage-text, p.passage-id-line { margin: 0.8rem 0; text-align: left; text-indent: 0; text-wrap: pretty; }
p.passage-id-line { margin-bottom: 0.4rem; }
p.commentary, p.part-intro {
  margin: 0.8rem 0 0.8rem var(--layer);
  font-size: 0.92em;
  text-align: left;
  text-indent: 0;
  text-wrap: pretty;
}
/* Captain Review 2: a subheader.  Margins copied from `.document-section h3` (margin: 2.4rem 0 0.8rem): a clear gap above, a small one below. */
p.source-label {
  margin: 2.4rem 0 0.8rem var(--layer);
  color: var(--ink-light);
  font-size: 0.85rem;
  font-style: italic;
  text-indent: 0;
}
/* opening a section right after its h2, the label sits where a first paragraph would (the h2's own margin) */
.document-section > h2 + p.source-label { margin-top: 0; }
blockquote.commentary-quote { margin: 1rem 0 1rem calc(2 * var(--layer)); color: var(--ink-mid); font-size: 0.88em; }
blockquote.commentary-quote p { margin: 0 0 0.5rem; text-indent: 0; }
blockquote.commentary-quote p:last-child { margin-bottom: 0; }
p.verse {
  margin: 1.1rem 0 1.1rem calc(2 * var(--layer));
  padding-left: 1.5em;
  font-size: 0.95em;
  text-align: left;
  text-indent: -1.5em;
}
@supports (text-indent: -1.5em each-line) {
  p.verse { text-indent: -1.5em each-line; }
}

/* Notes: one box for each source footnote and each group of margin glosses */
.footnote-back { font-weight: 600; text-decoration: none; white-space: nowrap; }
.footnote-mark { font-weight: 600; white-space: nowrap; }
.note-box + .note-box { margin-top: 0.9rem; }
.note-box:has(+ .note-box) { margin-bottom: 0.9rem; }

/* Glossary, index, lists */
p.glossary-entry { margin: 1rem 0; text-indent: 0; }
p.glossary-entry.indent-1 { margin-left: var(--layer); }
p.glossary-entry.indent-2 { margin-left: calc(2 * var(--layer)); }
p.index-entry { margin: 0.6rem 0; padding-left: 2em; text-indent: -2em; font-size: 0.95em; }
p.index-intro { margin-left: var(--layer); font-size: 0.92em; text-indent: 0; }
ul.glossed-items { columns: 2; column-gap: 2rem; margin: 1rem 0 1rem var(--layer); padding: 0; list-style: none; }
ul.glossed-items li { break-inside: avoid; font-weight: 700; }
ul.map-list { margin: 1rem 0 1rem var(--layer); padding: 0; list-style: none; }
ul.period-list { margin: 1rem 0 1rem calc(2 * var(--layer)); padding: 0; list-style: none; }
ul.period-list li.indent-1 { margin-left: var(--layer); }
ul.period-list .period-span { margin-left: 1.5rem; }
img.inline-glyph { width: auto; height: 1em; vertical-align: middle; }

@media (max-width: 560px) {
  ul.glossed-items { columns: 1; }
}

/* Pictures: every figure is framed as the maps are, and caption styled alike */
.source-figure { margin: 1.75rem auto; }
.source-figure img { max-width: 100%; }
.source-figure figcaption { color: var(--ink-light); }
.note-box .source-figure { margin: 0.6rem auto; }

/* A section that ends in a passage: the passage's last block gives up its bottom margin and its leading, so the
   divider after the section measures the same gap as every other boundary (the kit trims only direct children). */
.document-section > .passage:last-child > :last-child { margin-bottom: 0; }
.document-section > .passage:last-child > p:last-child { text-box: trim-end text; }

/* A verse or a quotation a note sets in sits inside the note's box (marker class footnote-inset from the Basic generator):
   the box's own type size and colour, set in from the box's left edge. */
.note-box p.verse.footnote-inset,
.note-box blockquote.footnote-inset { margin: 0.6rem 0 0.6rem var(--layer); font-size: inherit; color: inherit; }
.note-box blockquote.footnote-inset p { margin: 0 0 0.45rem; }

/* ---- Eno's commentary in its own note boxes (Captain, 2026-12-03; hand edit after delivery) ----
   The box is the kit's .note-box (the Teaching Translation gloss box's own pattern: aside.note-box, data-note-group, span.note-ref label).
   The commentary paragraphs keep their own class; inside the box they take the box's type size and paragraph spacing, copied from
   `.note-box p { margin: 0 0 0.45rem; }`, and a commentary quotation takes the same set-in as a quotation a note sets in
   (`.note-box blockquote.footnote-inset`).  A footnote box nested in a commentary box keeps the note-box rules. */
.note-box p.commentary { margin: 0 0 0.45rem; font-size: inherit; }
.note-box blockquote.commentary-quote { margin: 0.6rem 0 0.6rem var(--layer); font-size: inherit; color: inherit; }
.note-box blockquote.commentary-quote p { margin: 0 0 0.45rem; }
