/* Psychopathia Machinalis — Book reader (chapter edition and landing).
 *
 * Source for the content-hashed /book/reader.<hash>.css that
 * scripts/build_book_routes.py emits. Loaded after /css/site-nav.css and
 * before /css/site-theme.css, which owns the --pm-* tokens and wins at equal
 * specificity; every rule here is scoped under .book-route-body so the
 * cascade is decided by specificity, not by luck.
 *
 * Voice: Charter carries the book (titles, running heads, contents, prose);
 * Poppins is reserved for controls, labels and metadata. Brass is a hairline
 * and a numeral, never a fill. Ink navy is the frame.
 */

@font-face { font-family: "Charter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/Charter/charter_regular.woff2") format("woff2"); }
@font-face { font-family: "Charter"; font-style: italic; font-weight: 400; font-display: swap; src: url("/assets/fonts/Charter/charter_italic.woff2") format("woff2"); }
@font-face { font-family: "Charter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/Charter/charter_bold.woff2") format("woff2"); }
@font-face { font-family: "Charter"; font-style: italic; font-weight: 700; font-display: swap; src: url("/assets/fonts/Charter/charter_bold_italic.woff2") format("woff2"); }

/* ------------------------------------------------------------------ */
/* 1. Book-scoped tokens (derived from the house --pm-* palette)        */
/* ------------------------------------------------------------------ */
.book-route-body {
  --bk-nav-h: var(--pm-nav-h, 64px); /* exported by css/site-theme.css; the bar is border-box */
  --bk-serif: "Charter", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --bk-sans: var(--pm-font, "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  --bk-mono: "Fira Code", "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --bk-measure: 42rem;
  --bk-rail-w: 17.5rem;
  --bk-gutter: clamp(1.25rem, 4vw, 3.5rem);
  /* House layout tokens (css/site-theme.css), with fallbacks. */
  --bk-page: var(--pm-page, 70rem);
  --bk-page-gutter: var(--pm-gutter, clamp(1.25rem, 4vw, 2.5rem));
  --bk-prose: var(--pm-measure, 46rem);
  --bk-ink: var(--pm-ink, #0f1c2e);
  --bk-text: var(--pm-text, #1c2a3a);
  --bk-text-2: var(--pm-text-2, #3f4f61);
  --bk-muted: var(--pm-text-muted, #55657a);
  --bk-brass: var(--pm-brass, #b8862b);
  --bk-brass-text: var(--pm-brass-text, #7d5a17);
  --bk-brass-line: var(--pm-brass-line, rgba(184, 134, 43, 0.45));
  --bk-canvas: var(--pm-canvas, #f4f6f9);
  --bk-paper: #fffdfa;
  --bk-paper-dim: #f7f4ee;
  --bk-line: var(--pm-border, #e2e8ef);
  --bk-line-strong: var(--pm-border-strong, #c9d3dd);
  --bk-on-ink: var(--pm-on-ink, #f3f6fa);
  --bk-on-ink-2: var(--pm-on-ink-2, rgba(243, 246, 250, 0.76));
  --bk-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --bk-shadow-plate: 0 1px 2px rgba(15, 28, 46, 0.06), 0 24px 48px -28px rgba(15, 28, 46, 0.45);
  --bk-focus: 0 0 0 3px rgba(184, 134, 43, 0.45);
}
html.dark .book-route-body {
  --bk-paper: #121c2b;
  --bk-paper-dim: #17233a;
  --bk-shadow-plate: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 48px -24px rgba(0, 0, 0, 0.8);
}

/* ------------------------------------------------------------------ */
/* 2. Shell                                                             */
/* ------------------------------------------------------------------ */
.book-route-body.has-site-nav { padding-top: var(--bk-nav-h); }
.book-route-body { margin: 0; background: var(--bk-canvas); color: var(--bk-text); font-family: var(--bk-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.book-route-body *:focus-visible { outline: 2px solid var(--bk-brass); outline-offset: 2px; }

/* Skip link: above the fixed nav, inset as a deliberate chip. */
.book-route-body .skip-link { position: fixed; top: .75rem; left: 1rem; z-index: 2000; padding: .65rem 1.1rem; border-radius: 999px; background: var(--bk-ink); color: var(--bk-on-ink); font-family: var(--bk-sans); font-size: .85rem; font-weight: 600; text-decoration: none; box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .6); transform: translateY(-300%); transition: transform .15s var(--bk-ease); }
.book-route-body .skip-link:focus, .book-route-body .skip-link:focus-visible { transform: translateY(0); outline: 3px solid var(--bk-brass); outline-offset: 2px; }

/* Reading progress: a brass hairline pinned under the nav. */
.book-progress { position: fixed; top: var(--bk-nav-h); left: 0; right: 0; z-index: 1000; height: 2px; background: transparent; pointer-events: none; }
.book-progress__bar { display: block; height: 100%; width: 100%; background: var(--bk-brass); transform: scaleX(0); transform-origin: 0 50%; transition: transform .12s linear; }

/* Running head: appears once the chapter title has scrolled off. */
.book-runhead { position: fixed; top: var(--bk-nav-h); left: 0; right: 0; z-index: 900; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; box-sizing: border-box; min-height: 44px; padding: .35rem var(--bk-gutter); border-bottom: 1px solid var(--bk-line); background: color-mix(in srgb, var(--bk-paper) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .2s var(--bk-ease), transform .2s var(--bk-ease); }
.book-route-body.is-past-title .book-runhead { opacity: 1; transform: none; pointer-events: auto; }
.book-runhead__title { display: flex; align-items: baseline; gap: .75rem; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--bk-serif); font-size: .95rem; color: var(--bk-text); }
.book-runhead__book { color: var(--bk-muted); font-style: italic; }
.book-runhead__chapter { overflow: hidden; text-overflow: ellipsis; }
.book-runhead__nav { display: flex; gap: .25rem; }
.book-runhead__nav a { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 999px; color: var(--bk-text-2); text-decoration: none; transition: background .15s var(--bk-ease), color .15s var(--bk-ease); }
.book-runhead__nav a:hover { color: var(--bk-text); background: var(--bk-paper-dim); }
.book-runhead__nav svg { width: 18px; height: 18px; }

.book-shell { display: grid; grid-template-columns: var(--bk-rail-w) minmax(0, 1fr); min-height: calc(100vh - var(--bk-nav-h)); }

/* ------------------------------------------------------------------ */
/* 3. Contents rail                                                     */
/* ------------------------------------------------------------------ */
.book-rail { position: sticky; top: var(--bk-nav-h); align-self: start; box-sizing: border-box; max-height: calc(100vh - var(--bk-nav-h)); overflow: auto; overscroll-behavior: contain; padding: 1.5rem 1rem 2.5rem 1.25rem; border-right: 1px solid var(--bk-line); background: var(--bk-canvas); scrollbar-width: thin; }
.book-rail > .book-rail__summary { display: none; }
.book-rail__head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; padding: 0 .75rem .9rem; }
.book-rail__home { color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; }
.book-rail__home:hover { color: var(--bk-text); }
.book-rail__part { margin: 1.1rem 0 .25rem; padding: 0 .75rem; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.book-rail__part:first-child { margin-top: 0; }
.book-route-toc { list-style: none; margin: 0; padding: 0; }
.book-route-toc li { margin: 0; padding: 0; }
/* Sub-entries (Appendix A axes, the everyday-terms index) indent under their
   parent; the selector outweighs the generic link padding declared below it,
   which used to cancel the indent and set the current-page bar on the text. */
.book-route-toc .book-route-toc-child > a { padding-left: 1.5rem; font-size: .8rem; }
.book-route-toc a { position: relative; display: block; box-sizing: border-box; padding: .5rem .75rem; border-radius: 8px; color: var(--bk-text-2); font-family: var(--bk-sans); font-size: .84rem; line-height: 1.4; text-decoration: none; transition: background .15s var(--bk-ease), color .15s var(--bk-ease); }
.book-route-toc a:hover, .book-route-toc a:focus-visible { color: var(--bk-text); background: var(--bk-paper); }
.book-route-toc a[aria-current="page"] { color: var(--bk-text); background: var(--bk-paper); font-weight: 600; }
.book-route-toc a[aria-current="page"]::before { content: ""; position: absolute; top: .5rem; bottom: .5rem; left: 0; width: 2px; border-radius: 2px; background: var(--bk-brass); }
.book-route-toc .book-route-toc-child > a[aria-current="page"]::before { left: .75rem; }
/* Section anchors of the current chapter, revealed beneath it. */
.book-rail__sections { list-style: none; margin: .1rem 0 .4rem; padding: 0 0 0 1.25rem; border-left: 1px solid var(--bk-line); }
.book-rail__sections li { margin: 0; }
.book-rail__sections a { padding: .32rem .75rem; color: var(--bk-muted); font-size: .78rem; line-height: 1.35; }
.book-rail__sections a:hover { color: var(--bk-text); background: transparent; }
.book-rail__sections a.is-active { color: var(--bk-brass-text); }
.book-rail__sections a.is-active::before { content: ""; position: absolute; top: .55rem; bottom: .55rem; left: -1px; width: 1px; background: var(--bk-brass); }
.book-rail__foot { margin-top: 1.25rem; padding: 1rem .75rem 0; border-top: 1px solid var(--bk-line); }
.book-complete-link { display: block; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .76rem; font-weight: 500; line-height: 1.45; text-decoration: none; }
.book-complete-link:hover { color: var(--bk-text); }
.book-complete-link small { display: block; margin-top: .15rem; color: var(--bk-text-2); font-size: .72rem; font-weight: 400; }

/* Reference: direct routes to the diagnostic entries (by stable pattern id),
   the quick reference and the everyday-terms index, outside the reading order. */
.book-reference { margin: 0 0 .9rem; padding: 0 0 .9rem; border-bottom: 1px solid var(--bk-line); font-family: var(--bk-sans); }
.book-reference > summary { display: flex; align-items: center; gap: .45rem; min-height: 32px; padding: 0 .75rem; color: var(--bk-muted); font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; list-style: none; }
.book-reference > summary::-webkit-details-marker { display: none; }
.book-reference > summary::marker { content: ""; }
.book-reference > summary::after { content: "\203A"; font-size: .95rem; letter-spacing: 0; transition: transform .15s var(--bk-ease); }
.book-reference[open] > summary::after { transform: rotate(90deg); }
.book-reference > summary:hover { color: var(--bk-text); }
.book-reference__links, .book-reference__axes { margin: 0; padding: 0; list-style: none; }
.book-reference__links a { display: block; padding: .4rem .75rem; border-radius: 8px; color: var(--bk-text-2); font-size: .82rem; line-height: 1.4; text-decoration: none; }
.book-reference__links a:hover { color: var(--bk-text); background: var(--bk-paper); }
.book-reference__axes { margin-top: .35rem; }
.book-reference__axes > li { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: .5rem; align-items: start; padding: .2rem .75rem; }
.book-reference__axis { padding-top: .2rem; color: var(--bk-muted); font-size: .7rem; font-weight: 600; line-height: 1.6; text-decoration: none; white-space: nowrap; }
.book-reference__axis:hover { color: var(--bk-text); }
.book-reference__ids { display: flex; flex-wrap: wrap; gap: .25rem; }
.book-reference__ids a { display: inline-flex; align-items: center; justify-content: center; min-width: 2.15rem; min-height: 24px; box-sizing: border-box; padding: 0 .3rem; border: 1px solid var(--bk-line-strong); border-radius: 4px; color: var(--bk-text-2); font-size: .7rem; font-variant-numeric: tabular-nums; text-decoration: none; }
.book-reference__ids a:hover { border-color: var(--bk-brass); color: var(--bk-text); background: var(--bk-paper); }
.book-landing .book-reference { margin: 2.25rem 0 0; padding: 0; border: 0; }
.book-landing .book-reference > summary { min-height: 44px; padding: 0 0 .5rem; border-bottom: 1px solid var(--bk-line); color: var(--bk-brass-text); font-size: .68rem; letter-spacing: .16em; }
.book-landing .book-reference__links { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin: .6rem 0 .4rem; }
.book-landing .book-reference__links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0; color: var(--bk-text); font-family: var(--bk-serif); font-size: 1.05rem; }
.book-landing .book-reference__links a:hover { color: var(--bk-brass-text); background: transparent; }
/* One axis per row: a row label, then a fixed twelve-column chip grid (the
   largest axis holds twelve entries), so chips line up from axis to axis
   instead of wrapping raggedly in two columns. Six columns on narrow screens
   (no axis then leaves a single chip alone on a row). */
.book-landing .book-reference__axes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.book-landing .book-reference__axes > li { grid-template-columns: 5rem minmax(0, 1fr); gap: 1rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--bk-line); }
.book-landing .book-reference__axis { padding-top: 0; font-size: .74rem; }
.book-landing .book-reference__ids { display: grid; grid-template-columns: repeat(12, 2.6rem); gap: .35rem; }
.book-landing .book-reference__ids a { min-width: 0; min-height: 34px; font-size: .76rem; }
@media (max-width: 760px) {
  .book-landing .book-reference__axes > li { grid-template-columns: 3.5rem minmax(0, 1fr); gap: .5rem; align-items: start; }
  .book-landing .book-reference__axis { display: flex; align-items: center; min-height: 44px; }
  .book-landing .book-reference__ids { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .3rem; }
  .book-landing .book-reference__ids a { min-height: 44px; }
}
@media (max-width: 900px) {
  .book-landing .book-reference__ids a { min-height: 44px; }
}

/* ------------------------------------------------------------------ */
/* 4. Reading column                                                    */
/* ------------------------------------------------------------------ */
.book-route-main { min-width: 0; box-sizing: border-box; padding: 0 var(--bk-gutter) 5rem; background: var(--bk-paper); }
.book-page { width: 100%; max-width: var(--bk-measure); margin: 0 auto; }

/* Reader bar: quiet, aligned to the reading column. */
.book-route-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .1rem; max-width: var(--bk-measure); min-height: 60px; margin: 0 auto; padding: .5rem 0; border-bottom: 1px solid var(--bk-line); }
.book-route-toolbar__crumb { display: flex; align-items: baseline; gap: .5rem; margin-right: auto; min-width: 0; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.book-route-toolbar__crumb a { color: inherit; text-decoration: none; }
.book-route-toolbar__crumb a:hover { color: var(--bk-text); }
.book-route-toolbar__crumb .sep { color: var(--bk-brass); }
.book-route-toolbar button, .book-rail__summary { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .6rem; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--bk-text-2); font-family: var(--bk-sans); font-size: .78rem; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; transition: background .15s var(--bk-ease), color .15s var(--bk-ease), border-color .15s var(--bk-ease); }
.book-route-toolbar button:hover, .book-route-toolbar button:focus-visible, .book-rail__summary:hover { color: var(--bk-text); background: var(--bk-paper-dim); }
.book-route-toolbar button svg, .book-rail__summary svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.book-route-toolbar button[aria-pressed="true"] svg, .book-route-toolbar button.is-saved svg { fill: var(--bk-brass); stroke: var(--bk-brass); }
.book-route-toolbar kbd { display: none; margin-left: .15rem; padding: .1rem .35rem; border: 1px solid var(--bk-line-strong); border-radius: 4px; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .62rem; font-weight: 600; letter-spacing: .04em; }
@media (min-width: 1300px) { .book-route-toolbar kbd { display: inline-block; } }
.book-route-toolbar .book-icon-only .label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Continue-reading card: filled by the runtime when a resume point exists. */
.book-continue { display: none; align-items: center; gap: 1rem; max-width: var(--bk-measure); margin: 1.25rem auto 0; padding: .9rem 1.1rem; border: 1px solid var(--bk-brass-line); border-radius: 12px; background: var(--bk-paper-dim); color: var(--bk-text); text-decoration: none; font-family: var(--bk-serif); }
.book-continue[href] { display: flex; }
.book-continue strong { font-weight: 700; }
.book-continue span { color: var(--bk-muted); font-family: var(--bk-sans); font-size: .78rem; }
.book-continue .arrow { margin-left: auto; color: var(--bk-brass); }

/* ------------------------------------------------------------------ */
/* 5. Manuscript typography                                             */
/* ------------------------------------------------------------------ */
.book-route-article { font-family: var(--bk-serif); font-size: 1.125rem; line-height: 1.7; color: var(--bk-text); font-kerning: normal; font-variant-ligatures: common-ligatures; hyphens: manual; overflow-wrap: break-word; }
.book-route-article > :first-child { margin-top: 0; }

/* Chapter opening */
.book-route-article :is(h1.part-heading, h1:first-child) { margin: clamp(1.75rem, 4vw, 2.5rem) 0 1.5rem; padding: 0; font-family: var(--bk-serif); font-size: clamp(2.2rem, 4.6vw, 3.4rem); font-weight: 700; letter-spacing: -.015em; line-height: 1.08; color: var(--bk-text); text-wrap: balance; scroll-margin-top: calc(var(--bk-nav-h) + 1rem); }
.book-route-article :is(h1.part-heading, h1:first-child)::before, .book-route-article :is(h1.part-heading, h1:first-child)::after { content: none; }
/* Detached sections (the Appendix A axes, the matrix, the everyday-terms index)
   open on an unclassed h1: same title treatment as a chapter. A later h1 in a
   detached section (the matrix's "Using This Reference") reads as a section head. */
.book-route-article h1:not(:first-child, .part-heading) { position: relative; margin: 3.25rem 0 1.1rem; padding-top: 1.25rem; font-family: var(--bk-serif); font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; color: var(--bk-text); scroll-margin-top: calc(var(--bk-nav-h) + 3.5rem); }
.book-chapter-label { display: block; margin-bottom: 1.1rem; padding-top: 1.1rem; border-top: 2px solid var(--bk-brass); color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .74rem; font-weight: 700; letter-spacing: .16em; line-height: 1.4; text-transform: uppercase; }
.book-label-colon { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.book-chapter-name { display: block; }
.book-chapter-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin: -.5rem 0 2rem; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .76rem; font-weight: 500; letter-spacing: .04em; }
.book-chapter-meta .dot { color: var(--bk-brass); }

/* Plate */
.book-route-article figure.chapter-plate { width: 100%; margin: 0 0 2.5rem; padding: 0; }
.book-route-article figure.chapter-plate img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border: 1px solid var(--bk-line-strong); border-radius: 4px; box-shadow: var(--bk-shadow-plate); background: var(--bk-paper-dim); }

/* Epigraph */
.book-route-article blockquote.book-epigraph { max-width: 34rem; margin: 0 auto 3rem; padding: 0; border: 0; text-align: center; }
.book-route-article blockquote.book-epigraph p { margin: 0 0 .75rem; color: var(--bk-text-2); font-size: 1.05rem; line-height: 1.6; }
.book-route-article blockquote.book-epigraph p em { font-style: italic; }
.book-route-article blockquote.book-epigraph .book-epigraph__source { color: var(--bk-muted); font-family: var(--bk-sans); font-size: .74rem; font-style: normal; letter-spacing: .06em; }
.book-route-article blockquote.book-epigraph .book-epigraph__source em { font-style: italic; letter-spacing: 0; }
.book-route-article blockquote.book-epigraph::after { content: ""; display: block; width: 2.5rem; height: 1px; margin: 1.75rem auto 0; background: var(--bk-brass); }

/* Opening paragraph */
.book-route-article p.book-opening::first-letter { float: left; margin: .12em .12em 0 0; padding: 0; font-family: var(--bk-serif); font-size: 3.6em; font-weight: 700; line-height: .8; color: var(--bk-brass-text); }

/* Headings */
.book-route-article h2 { position: relative; margin: 3.25rem 0 1.1rem; padding-top: 1.25rem; font-family: var(--bk-serif); font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; color: var(--bk-text); text-wrap: balance; scroll-margin-top: calc(var(--bk-nav-h) + 3.5rem); }
.book-route-article h2::before { content: ""; position: absolute; top: 0; left: 0; width: 2.25rem; height: 2px; background: var(--bk-brass); }
.book-route-article h3 { margin: 2.4rem 0 .8rem; font-family: var(--bk-serif); font-size: 1.32rem; font-weight: 700; line-height: 1.3; color: var(--bk-text); text-wrap: balance; scroll-margin-top: calc(var(--bk-nav-h) + 3.5rem); }
.book-route-article h4 { margin: 2rem 0 .6rem; font-family: var(--bk-sans); font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--bk-brass-text); scroll-margin-top: calc(var(--bk-nav-h) + 3.5rem); }
.book-route-article h5, .book-route-article h6 { margin: 1.6rem 0 .5rem; font-family: var(--bk-serif); font-size: 1.05rem; font-weight: 700; }
.book-route-article h2 + h3 { margin-top: 1.4rem; }

/* Copy-link anchors, revealed on hover or focus. */
.book-route-article .book-anchor { display: inline-block; margin-left: .45em; color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .62em; font-weight: 600; letter-spacing: .04em; text-decoration: none; vertical-align: .18em; opacity: 0; transition: opacity .15s var(--bk-ease); }
.book-route-article h2:hover .book-anchor, .book-route-article h3:hover .book-anchor, .book-route-article .book-anchor:focus-visible, .book-route-article .book-anchor.is-copied { opacity: 1; }

/* Figure lightbox */
.book-lightbox { position: fixed; inset: 0; width: min(96vw, 1400px); max-width: none; max-height: 94vh; box-sizing: border-box; margin: auto; padding: 1rem; border: 0; border-radius: 12px; background: var(--bk-paper); color: var(--bk-text); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .7); }
.book-lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: .75rem; animation: book-dialog-in .18s var(--bk-ease); }
.book-lightbox::backdrop { background: rgba(8, 14, 24, .78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.book-lightbox img { display: block; max-width: 100%; max-height: calc(94vh - 5.5rem); margin: 0 auto; object-fit: contain; border-radius: 4px; }
.book-lightbox__caption { max-width: 60rem; margin: 0 auto; padding: 0 3rem; color: var(--bk-text-2); font-family: var(--bk-serif); font-size: .95rem; line-height: 1.5; text-align: center; }
.book-lightbox .book-dialog-close { top: .75rem; right: .75rem; }
.book-route-article figure img[role="button"] { cursor: zoom-in; }
.book-route-article figure img[role="button"]:focus-visible { outline: 3px solid var(--bk-brass); outline-offset: 3px; }

/* Text */
.book-route-article p { margin: 0 0 1.15em; text-wrap: pretty; }
.book-route-article strong { font-weight: 700; color: var(--bk-text); }
.book-route-article em { font-style: italic; }
.book-route-article a { color: var(--pm-primary, #21354d); text-decoration: underline; text-decoration-color: var(--bk-brass-line); text-decoration-thickness: .06em; text-underline-offset: .16em; transition: text-decoration-color .15s var(--bk-ease); }
.book-route-article a:hover { color: var(--bk-text); text-decoration-color: var(--bk-brass); }
html.dark .book-route-article a { color: #c9d6e6; }
.book-route-article a.uri, .book-route-article code { font-family: var(--bk-mono); font-size: .84em; overflow-wrap: anywhere; }
.book-route-article code { padding: .1em .35em; border-radius: 4px; background: var(--bk-paper-dim); }
.book-route-article pre { margin: 1.5rem 0; padding: 1rem 1.15rem; overflow: auto; border: 1px solid var(--bk-line); border-radius: 8px; background: var(--bk-paper-dim); font-family: var(--bk-mono); font-size: .84rem; line-height: 1.55; }
.book-route-article pre code { padding: 0; background: transparent; font-size: inherit; }
.book-route-article pre[tabindex]:focus-visible { outline: 2px solid var(--bk-brass); outline-offset: 3px; }
.book-route-article sup { font-size: .72em; line-height: 0; vertical-align: super; }

/* Lists */
.book-route-article ul, .book-route-article ol { margin: 0 0 1.25em; padding-left: 1.4em; }
.book-route-article li { margin: 0 0 .45em; padding-left: .15em; }
.book-route-article li > p { margin-bottom: .6em; }
.book-route-article ul { list-style: none; }
.book-route-article ul > li { position: relative; }
.book-route-article ul > li::before { content: ""; position: absolute; top: .72em; left: -1.05em; width: .38em; height: .38em; border-radius: 50%; background: var(--bk-brass); }
.book-route-article ul ul > li::before { background: transparent; border: 1px solid var(--bk-brass); box-sizing: border-box; }
.book-route-article ol { list-style: decimal; }
.book-route-article ol > li::marker { color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .82em; font-weight: 700; font-variant-numeric: tabular-nums; }
.book-route-article ul.task-list { padding-left: 0; }
.book-route-article ul.task-list > li { display: grid; grid-template-columns: 1.35em 1fr; gap: .6em; align-items: start; padding-left: 0; }
.book-route-article ul.task-list > li::before { content: none; }
.book-route-article ul.task-list input[type="checkbox"] { width: 1.05em; height: 1.05em; margin: .3em 0 0; accent-color: var(--bk-brass); }
.book-route-article ul.task-list label { display: contents; }

/* Blockquotes (non-epigraph) */
.book-route-article blockquote { margin: 1.75rem 0; padding: .1rem 0 .1rem 1.4rem; border-left: 2px solid var(--bk-brass); color: var(--bk-text-2); }
.book-route-article blockquote p { margin-bottom: .8em; }
.book-route-article blockquote p:last-child { margin-bottom: 0; }

/* Chapter contract: the chapter's claim, evidence status and intended use,
   set apart from the epigraph above it and from quoted material. */
.book-route-article blockquote.chapter-contract { margin: 0 0 2.75rem; padding: 1.05rem 1.25rem 1.15rem; border: 1px solid var(--bk-line); border-radius: 6px; background: var(--bk-paper-dim); color: var(--bk-text-2); font-family: var(--bk-sans); font-size: .84rem; line-height: 1.65; }
.book-route-article blockquote.chapter-contract > p:first-child > strong:first-child { display: block; margin: 0 0 .45rem; color: var(--bk-brass-text); font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.book-route-article .chapter-contract em.contract-label { color: var(--bk-text); font-style: normal; font-weight: 600; }

/* Entry contract (Appendix A): generated, compact, scannable. */
.book-route-article .entry-contract { margin: 1.25rem 0 1.9rem; padding: .95rem 1.15rem 1rem; border: 1px solid var(--bk-line); border-radius: 6px; background: var(--bk-paper-dim); color: var(--bk-text-2); font-size: .9rem; line-height: 1.55; }
.book-route-article .entry-contract > p:first-child { margin: 0 0 .5rem; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .72rem; }
.book-route-article .entry-contract > p:first-child > strong { margin-right: .35rem; color: var(--bk-brass-text); font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.book-route-article .entry-contract ul { margin: 0; padding: 0; list-style: none; }
.book-route-article .entry-contract li { margin: .4rem 0 0; padding: 0; }
.book-route-article .entry-contract li::before { content: none; }
.book-route-article .entry-contract li > em:first-child { color: var(--bk-text); font-family: var(--bk-sans); font-size: .76rem; font-style: normal; font-weight: 600; }

/* Index of everyday terms: a dense, two-column finding list. */
.book-route-article ul.everyday-index { columns: 2 17rem; column-gap: 2.5rem; margin: 1.25rem 0 0; padding: 0; list-style: none; font-size: .9rem; line-height: 1.45; }
.book-route-article ul.everyday-index > li { margin: 0 0 .45rem; padding: 0; break-inside: avoid; }
.book-route-article ul.everyday-index > li::before { content: none; }

/* Figures */
.book-route-article figure { margin: 2.25rem 0; padding: 0; text-align: left; }
.book-route-article figure img { display: block; width: 100%; height: auto; border: 1px solid var(--bk-line-strong); border-radius: 4px; background: var(--bk-paper-dim); box-shadow: var(--bk-shadow-plate); }
.book-route-article figure.condition-illustration img { cursor: zoom-in; }
.book-route-article figcaption { margin: .8rem 0 0; color: var(--bk-text-2); font-family: var(--bk-serif); font-size: .92rem; line-height: 1.55; text-align: left; }
.book-route-article figcaption .book-fig-label { display: inline-block; margin-right: .55rem; color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; vertical-align: .05em; }

/* Tables */
.book-route-article .table-scroll-wrapper { margin: 2rem 0; overflow-x: auto; border-top: 2px solid var(--bk-ink); border-bottom: 1px solid var(--bk-ink); -webkit-overflow-scrolling: touch; }
/* Inset ring: the scroll-driven edge mask below clips anything drawn outside
   the wrapper's border box, which hid an outset ring on overflowing tables. */
.book-route-article .table-scroll-wrapper:focus-visible { outline: 2px solid var(--bk-brass); outline-offset: -2px; }
html.dark .book-route-article .table-scroll-wrapper { border-color: var(--bk-line-strong); }
.book-route-article table { width: 100%; border-collapse: collapse; margin: 0; font-family: var(--bk-serif); font-size: .95rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.book-route-article thead th { padding: .7rem .75rem .55rem; border-bottom: 1px solid var(--bk-line-strong); color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; text-align: left; vertical-align: bottom; background: transparent; }
.book-route-article tbody td, .book-route-article tbody th { padding: .6rem .75rem; border-top: 1px solid var(--bk-line); text-align: left; vertical-align: top; background: transparent; color: var(--bk-text); }
.book-route-article tbody tr:first-child td, .book-route-article tbody tr:first-child th { border-top: 0; }
.book-route-article tbody th[scope="row"] { font-weight: 700; }
.book-route-article tbody tr:hover td, .book-route-article tbody tr:hover th { background: color-mix(in srgb, var(--bk-brass) 6%, transparent); }
.book-route-article th:first-child, .book-route-article td:first-child { padding-left: .25rem; }
.book-route-article th:last-child, .book-route-article td:last-child { padding-right: .25rem; }
/* Tables on narrow screens (2026-11): a column-count minimum, so a phone
   scrolls a readable table inside its wrapper instead of crushing the last
   column out of view or breaking identifiers mid-word; a narrow shadow marks
   the right edge while columns remain off screen (the scroll-edge cue below:
   it clears at the end and never shows on a table that fits). Two-column
   tables always fit. */
.book-route-article .table-scroll-wrapper > table:has(tr > :nth-child(3)) { min-width: 28rem; }
.book-route-article .table-scroll-wrapper > table:has(tr > :nth-child(4)) { min-width: 34rem; }
.book-route-article .table-scroll-wrapper > table:has(tr > :nth-child(5)) { min-width: 40rem; }
.book-route-article .table-scroll-wrapper > table:has(tr > :nth-child(6)) { min-width: 46rem; }
.book-route-article .table-scroll-wrapper caption { text-align: left; white-space: normal; }
@media (max-width: 760px) {
  .book-route-article .table-scroll-wrapper > table:has(tr > :nth-child(3)) :is(th, td) { overflow-wrap: normal; word-break: normal; }
}
/* Scroll-edge cue (2026-11-19): the classic scroll shadow. A 0.75rem shadow
   is painted on the wrapper's own background at its right edge (scroll), and
   a paper-coloured cover rides at the end of the content (local), so the
   shadow shows only while columns remain off screen and never on a table
   that fits. It sits under the cells, which are transparent here, so no
   text is dimmed (the earlier mask faded the last 2rem of the visible
   column). Plain backgrounds: every engine draws it, and no animation is
   involved, so reduced motion has nothing to override. */
.book-route-article .table-scroll-wrapper {
  --bk-edge-shadow: rgba(15, 28, 46, 0.16);
  background-image:
    linear-gradient(to left, var(--bk-paper) 0.75rem, color-mix(in srgb, var(--bk-paper) 0%, transparent)),
    linear-gradient(to left, var(--bk-edge-shadow), transparent);
  /* The shadow stops 2px short of the foot: the local cover is painted only
     as far as the content, which can end a fraction of a pixel above the
     wrapper's edge, and the shadow's last row showed under a table that fits. */
  background-position: right top, right top;
  background-size: 1.5rem 100%, 0.75rem calc(100% - 2px);
  background-repeat: no-repeat;
  background-attachment: local, scroll;
}
html.dark .book-route-body .book-route-article .table-scroll-wrapper { --bk-edge-shadow: rgba(0, 0, 0, 0.3); }

/* Definition lists and rules */
.book-route-article dl { margin: 0 0 1.25em; }
.book-route-article dt { font-weight: 700; }
.book-route-article dd { margin: 0 0 .8em 1.4em; }
.book-route-article hr { width: 6rem; height: 1px; margin: 3rem auto; border: 0; background: var(--bk-brass); }

/* References and appendix pages */
/* Hanging indent for the entries only: the reading-time line and the opening
   note keep their own setting (the indent pushed the drop initial off the edge). */
.book-references .book-route-article p:not(.book-chapter-meta, .book-opening) { padding-left: 1.6em; text-indent: -1.6em; font-size: 1rem; line-height: 1.55; }
.book-references .book-route-article p a.uri { text-indent: 0; }
.book-route-article .footnotes { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--bk-line); font-size: .92rem; color: var(--bk-text-2); }

/* Previous / next */
.book-route-prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 0; max-width: var(--bk-measure); margin: 4.5rem auto 0; padding: 0; border-top: 1px solid var(--bk-line); border-bottom: 1px solid var(--bk-line); }
.book-route-prevnext a { display: block; box-sizing: border-box; padding: 1.25rem 1rem 1.35rem 0; color: var(--bk-text); font-family: var(--bk-serif); font-size: 1.05rem; font-weight: 700; line-height: 1.3; text-decoration: none; transition: color .15s var(--bk-ease); }
.book-route-prevnext a + a { padding-right: 0; padding-left: 1rem; border-left: 1px solid var(--bk-line); }
.book-route-prevnext a:hover { color: var(--bk-brass-text); }
.book-route-prevnext a span { display: block; margin-bottom: .45rem; color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.book-route-prevnext .book-next { text-align: right; }
.book-route-prevnext .book-next:first-child { grid-column: 1 / -1; padding-left: 0; border-left: 0; }
.book-route-prevnext .book-prev:last-child { grid-column: 1 / -1; padding-right: 0; }

/* Chapter-end invitation: private notes and the newsletter */
.book-galley-note { max-width: var(--bk-measure); margin: 3.5rem auto 0; padding-top: 1.1rem; border-top: 1px solid var(--bk-line); color: var(--bk-muted); font-family: var(--bk-serif); font-size: .95rem; font-style: italic; line-height: 1.6; }
.book-galley-note p { margin: 0 0 .5rem; }
.book-galley-note a { color: var(--bk-brass-text); text-decoration: underline; text-decoration-color: var(--bk-brass-line); text-underline-offset: 3px; }
.book-galley-note a:hover { text-decoration-color: currentColor; }
.book-galley-note__key { font-style: normal; white-space: nowrap; }

/* Colophon */
.book-colophon { max-width: var(--bk-measure); margin: 3rem auto 0; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .78rem; line-height: 1.6; }
.book-colophon p { margin: 0 0 .5rem; }
.book-colophon .book-cite { margin-top: 1rem; padding: 1rem 1.1rem; border-left: 2px solid var(--bk-brass); background: var(--bk-paper-dim); color: var(--bk-text-2); font-family: var(--bk-serif); font-size: .9rem; }
.book-colophon .book-cite strong { display: block; margin-bottom: .35rem; color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.book-colophon .book-cite button { margin-top: .6rem; padding: .35rem .8rem; border: 1px solid var(--bk-line-strong); border-radius: 999px; background: var(--bk-paper); color: var(--bk-text-2); font-family: var(--bk-sans); font-size: .74rem; font-weight: 600; cursor: pointer; }
.book-colophon .book-cite button:hover { color: var(--bk-text); border-color: var(--bk-brass); }

/* ------------------------------------------------------------------ */
/* 6. Dialogs: search and saved chapters                                */
/* ------------------------------------------------------------------ */
.book-search-dialog { position: fixed; inset: 0; width: min(44rem, calc(100% - 2rem)); max-width: none; max-height: min(78vh, 46rem); box-sizing: border-box; margin: auto; padding: 0; border: 1px solid var(--bk-line); border-radius: 16px; color: var(--bk-text); background: var(--bk-paper); box-shadow: 0 30px 80px -30px rgba(15, 28, 46, .6); font-family: var(--bk-sans); overflow: hidden; }
.book-search-dialog[open] { display: flex; flex-direction: column; animation: book-dialog-in .18s var(--bk-ease); }
.book-search-dialog::backdrop { background: rgba(15, 28, 46, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
@keyframes book-dialog-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.book-dialog__head { position: relative; padding: 1.5rem 4rem 0 1.75rem; }
.book-dialog__body { padding: 0 1.75rem 1.5rem; overflow: auto; overscroll-behavior: contain; }
.book-search-dialog h2 { margin: 0 0 .9rem; font-family: var(--bk-serif); font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
.book-search-dialog label { display: block; margin-bottom: .45rem; color: var(--bk-brass-text); font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.book-dialog-close { position: absolute; top: 1.15rem; right: 1.15rem; z-index: 1; margin: 0; }
.book-dialog-close button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--bk-line); border-radius: 999px; background: var(--bk-paper); color: var(--bk-text-2); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.book-dialog-close button:hover { color: var(--bk-text); border-color: var(--bk-brass); }
.book-search-dialog input { width: 100%; box-sizing: border-box; margin: 0 0 .5rem; padding: .8rem 1rem; border: 1px solid var(--bk-line-strong); border-radius: 10px; color: var(--bk-text); background: var(--bk-paper-dim); font: inherit; font-size: 1rem; }
.book-search-dialog input:focus-visible { outline: 2px solid var(--bk-brass); outline-offset: 0; border-color: var(--bk-brass); }
#book-search-status { margin: .35rem 0 .5rem; color: var(--bk-muted); font-size: .8rem; }
#book-search-results, #bookmarks-list { margin: 0; padding: 0; list-style: none; }
.book-search-result { display: block; padding: .85rem 0; border-top: 1px solid var(--bk-line); color: var(--bk-text-2); text-decoration: none; border-radius: 4px; }
.book-search-result:hover, .book-search-result:focus-visible { color: var(--bk-text); outline: none; background: color-mix(in srgb, var(--bk-brass) 7%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--bk-brass) 7%, transparent); }
.book-search-result strong { display: block; margin-bottom: .25rem; color: var(--bk-text); font-family: var(--bk-serif); font-size: 1rem; font-weight: 700; }
.book-search-result strong small { color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.book-search-result span { display: block; color: var(--bk-text-2); font-family: var(--bk-serif); font-size: .92rem; line-height: 1.5; }
.book-search-result mark { padding: 0 .1em; background: color-mix(in srgb, var(--bk-brass) 28%, transparent); color: inherit; border-radius: 2px; }
.book-dialog__empty { margin: 1rem 0 .5rem; color: var(--bk-muted); font-family: var(--bk-serif); font-size: 1rem; line-height: 1.55; }
.book-dialog__empty kbd { padding: .05rem .3rem; border: 1px solid var(--bk-line-strong); border-radius: 4px; font-family: var(--bk-sans); font-size: .72rem; }
.book-saved-row { display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: center; border-top: 1px solid var(--bk-line); padding: .8rem 0; }
.book-saved-row a { color: var(--bk-text); font-family: var(--bk-serif); font-size: 1rem; font-weight: 700; text-decoration: none; }
.book-saved-row a:hover { color: var(--bk-brass-text); }
.book-saved-row a small { display: block; margin-top: .15rem; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .7rem; font-weight: 500; letter-spacing: .04em; }
.book-saved-row button { min-height: 36px; padding: 0 .8rem; border: 1px solid var(--bk-line); border-radius: 999px; background: var(--bk-paper); color: var(--bk-text-2); font: inherit; font-size: .76rem; cursor: pointer; }
.book-saved-row button:hover { color: var(--bk-text); border-color: var(--bk-brass); }

/* ------------------------------------------------------------------ */
/* 7. Landing page                                                      */
/* ------------------------------------------------------------------ */
.book-landing-main { width: 100%; max-width: none; margin: 0; padding: 0; }
.book-landing-hero { position: relative; margin: 0; padding: clamp(3rem, 7vw, 6rem) var(--bk-page-gutter) clamp(3rem, 6vw, 5rem); color: var(--bk-on-ink); background: radial-gradient(70% 90% at 100% 0%, rgba(212, 169, 85, .16), transparent 60%), radial-gradient(50% 60% at 0% 100%, rgba(70, 97, 125, .35), transparent 65%), linear-gradient(160deg, #0d1726 0%, #152438 100%); text-align: left; overflow: hidden; }
.book-landing-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--bk-brass-line), transparent); }
.book-landing-hero p { text-align: left; hyphens: none; }
/* Landing shell (2026-11 layout pass): hero, edition facts, contents,
   reference and colophon share one centred block, var(--bk-page) wide inside
   var(--bk-page-gutter), so the page has one left edge. The cover column is
   sized so the copy fills its own column instead of leaving a wide gap. */
.book-frontispiece { display: grid; grid-template-columns: minmax(0, 1fr) clamp(260px, 27vw, 23rem); gap: clamp(2.5rem, 5vw, 4.5rem); align-items: center; max-width: var(--bk-page); margin: 0 auto; }
.book-frontispiece > * { min-width: 0; }
.book-landing-copy { position: relative; }
.book-landing-copy .title-label { margin: 0 0 1.4rem; color: var(--bk-brass); font-family: var(--bk-sans); font-size: .72rem; font-weight: 700; letter-spacing: .18em; line-height: 1.5; text-transform: uppercase; opacity: 1; }
.book-landing-copy .title-label::before { content: none; }
.book-landing-hero h1 { margin: 0; padding: 0; color: #fff; font-family: var(--bk-serif); font-size: clamp(2.7rem, 5.6vw, 4.6rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.02; text-align: left; text-wrap: balance; }
.book-landing-hero h1::before { content: none; }
.book-landing-hero h1 em { font-style: italic; font-weight: 700; color: #fff; }
.book-landing-subtitle { max-width: 28rem; margin: 1.25rem 0 0; color: var(--bk-on-ink-2); font-family: var(--bk-serif); font-size: clamp(1.15rem, 1.7vw, 1.4rem); font-style: italic; line-height: 1.45; }
.book-landing-author { margin: 1.5rem 0 0; color: var(--bk-brass); font-family: var(--bk-sans); font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.book-landing-blurb { max-width: 36rem; margin: 1.4rem 0 0; color: var(--bk-on-ink-2); font-family: var(--bk-serif); font-size: 1.05rem; line-height: 1.6; }
.book-reader-choice { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 2rem 0 0; }
.book-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; box-sizing: border-box; padding: .6rem 1.25rem; border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px; color: var(--bk-on-ink); background: transparent; font-family: var(--bk-sans); font-size: .86rem; font-weight: 600; text-decoration: none; transition: background .18s var(--bk-ease), border-color .18s var(--bk-ease), transform .18s var(--bk-ease), color .18s var(--bk-ease); }
.book-btn:hover { border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .06); color: #fff; transform: translateY(-1px); }
.book-btn--primary { border-color: var(--bk-brass); background: var(--bk-brass); color: #12100a; }
.book-btn--primary:hover { background: #d6a94a; border-color: #d6a94a; color: #12100a; }
.book-btn .pm-btn__arrow, .book-btn .arrow { font-size: 1.05em; line-height: 1; }
.book-landing-hero .book-continue { margin: 1.25rem 0 0; max-width: 36rem; border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .05); color: var(--bk-on-ink); }
.book-landing-hero .book-continue span { color: var(--bk-on-ink-2); }
.book-landing-newsletter { max-width: 36rem; margin: 1.4rem 0 0; color: var(--bk-on-ink-2); font-family: var(--bk-serif); font-size: .92rem; font-style: italic; line-height: 1.55; }
.book-landing-newsletter a { color: var(--bk-on-ink); text-decoration: underline; text-decoration-color: var(--bk-brass); text-underline-offset: 3px; }
.book-landing-newsletter a:hover { color: #fff; }
.book-frontispiece-art { position: relative; width: 100%; justify-self: stretch; }
.book-frontispiece-art::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: -14px; height: 14px; background: radial-gradient(50% 100% at 50% 0%, rgba(0, 0, 0, .55), transparent 70%); pointer-events: none; }
.book-frontispiece-art img { display: block; width: 100%; height: auto; margin: 0; border: 1px solid rgba(255, 255, 255, .12); border-radius: 3px 8px 8px 3px; box-shadow: -1px 0 0 rgba(255, 255, 255, .06) inset, 0 30px 60px -20px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4); }

/* Edition facts */
.book-edition { border-bottom: 1px solid var(--bk-line); background: var(--bk-canvas); }
.book-edition__inner { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; box-sizing: content-box; max-width: var(--bk-page); margin: 0 auto; padding: 1.75rem var(--bk-page-gutter); }
.book-edition__fact { min-width: 0; padding-left: 1rem; border-left: 1px solid var(--bk-brass-line); }
.book-edition__fact strong { display: block; font-family: var(--bk-serif); font-size: 1.35rem; font-weight: 700; line-height: 1.2; color: var(--bk-text); font-variant-numeric: tabular-nums; }
.book-edition__fact span { display: block; margin-top: .25rem; color: var(--bk-muted); font-family: var(--bk-sans); font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }

/* Contents */
.book-contents { box-sizing: content-box; max-width: var(--bk-page); margin: 0 auto; padding: clamp(2.5rem, 5vw, 4.5rem) var(--bk-page-gutter) clamp(3.5rem, 7vw, 6rem); }
.book-contents__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 2rem; margin: 0 0 1.75rem; padding: 0 0 1.1rem; border-bottom: 2px solid var(--bk-ink); }
html.dark .book-contents__head { border-color: var(--bk-line-strong); }
.book-landing #book-contents-heading { margin: 0; padding: 0; border: 0; color: var(--bk-text); font-family: var(--bk-serif); font-size: clamp(1.7rem, 2.6vw, 2.2rem); font-weight: 700; letter-spacing: -.015em; text-align: left; scroll-margin-top: calc(var(--bk-nav-h) + 1rem); }
.book-contents__hint { color: var(--bk-muted); font-family: var(--bk-sans); font-size: .76rem; font-weight: 500; letter-spacing: .04em; }
.book-landing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 4rem; margin: 0; padding: 0; list-style: none; }
.book-landing-part { margin: 0; padding: 0; }
/* Left column: front matter then chapters. Right column: closing then back matter. */
.book-landing-part:nth-child(1) { grid-column: 1; grid-row: 1; }
.book-landing-part:nth-child(2) { grid-column: 1; grid-row: 2; }
.book-landing-part:nth-child(3) { grid-column: 2; grid-row: 1; }
.book-landing-part:nth-child(4) { grid-column: 2; grid-row: 2; }
.book-landing-part > h3 { margin: 1.5rem 0 .35rem; padding: 0 0 .5rem; border-bottom: 1px solid var(--bk-line); color: var(--bk-brass-text); font-family: var(--bk-sans); font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.book-landing-part > ol { margin: 0; padding: 0; list-style: none; }
.book-landing-part > ol > li { margin: 0; padding: 0; border-bottom: 1px solid var(--bk-line); }
.book-landing-grid a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: baseline; min-height: 56px; box-sizing: border-box; padding: .85rem .25rem .85rem 0; color: var(--bk-text); background: transparent; text-decoration: none; transition: background .15s var(--bk-ease); }
.book-landing-grid a:hover { background: color-mix(in srgb, var(--bk-brass) 6%, transparent); }
.book-landing-grid a:hover .book-content-title { color: var(--bk-brass-text); }
.book-content-title { font-family: var(--bk-serif); font-size: 1.05rem; font-weight: 400; line-height: 1.4; transition: color .15s var(--bk-ease); }
.book-content-meta { color: var(--bk-muted); font-family: var(--bk-sans); font-size: .68rem; font-weight: 500; letter-spacing: .06em; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Sub-entries (the Appendix A axes) take a compact row where the chapter
   titles fit on one line; that brings the two contents columns to a common
   length (below 1180px the chapter titles wrap and the full rows match). */
@media (min-width: 1180px), (max-width: 1000px) {
  .book-landing-grid .book-landing-child a { min-height: 44px; padding-top: .6rem; padding-bottom: .6rem; }
}
/* Two columns close on one shared rule, so whatever difference in length is
   left (under 50px at any width) ends on a common line, not two ragged ones. */
@media (min-width: 1001px) {
  .book-landing-grid { border-bottom: 1px solid var(--bk-line); }
  .book-landing-part:nth-child(2n) > ol > li:last-child { border-bottom: 0; }
}
.book-landing-child .book-content-title { margin-left: 1rem; padding-left: .9rem; border-left: 1px solid var(--bk-line-strong); color: var(--bk-text-2); font-size: .95rem; }

/* Reader controls sit in the contents header on the landing page. */
.book-landing .book-route-toolbar { min-height: 0; margin: 0; padding: 0; border: 0; }
/* Colophon and the cite box: on the shell's left edge, at the prose measure. */
.book-landing .book-colophon { max-width: var(--bk-prose); margin: 3.5rem 0 0; }

/* ------------------------------------------------------------------ */
/* 8. Responsive                                                        */
/* ------------------------------------------------------------------ */
@media (max-width: 1180px) {
  .book-route-body { --bk-rail-w: 15.5rem; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .book-reader-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 30rem; }
}
@media (max-width: 1000px) {
  .book-edition__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-landing-grid { grid-template-columns: 1fr; }
  .book-landing-part:nth-child(n) { grid-column: 1; grid-row: auto; }
}
@media (min-width: 901px) {
  .book-runhead { left: var(--bk-rail-w); }
}
@media (max-width: 900px) {
  .book-shell { display: block; }
  .book-rail { position: relative; top: auto; max-height: none; overflow: visible; padding: 0 var(--bk-gutter); border-right: 0; border-bottom: 1px solid var(--bk-line); }
  .book-rail > .book-rail__summary { display: inline-flex; margin: .4rem 0; padding-left: .6rem; list-style: none; }
  .book-rail__summary::-webkit-details-marker { display: none; }
  .book-rail__summary::marker { content: ""; }
  .book-rail__inner { padding: .25rem 0 1.25rem; }
  .book-rail__head { padding-left: 0; }
  .book-route-toc { columns: 1; }
  .book-route-toc a { min-height: 44px; display: flex; align-items: center; }
  .book-route-toolbar { min-height: 56px; }
  .book-route-toolbar__crumb { display: none; }
  .book-runhead { padding-left: 1.25rem; padding-right: 1.25rem; }
}
@media (max-width: 760px) {
  .book-route-body { --bk-gutter: 1.25rem; }
  .book-landing-hero { padding-top: 2.5rem; padding-bottom: 2.75rem; }
  .book-frontispiece { grid-template-columns: 1fr; gap: 2.5rem; }
  .book-frontispiece-art { width: min(100%, 360px); max-width: 100%; justify-self: center; order: 2; }
  .book-landing-copy { order: 1; }
  .book-reader-choice { margin-top: 1.5rem; }
  .book-reader-choice a { width: 100%; }
  .book-edition__inner { grid-template-columns: 1fr 1fr; gap: 1.25rem; padding-top: 1.25rem; padding-bottom: 1.25rem; }
  .book-landing-grid a { min-height: 52px; }
  .book-route-article { font-size: 1.05rem; line-height: 1.65; }
  .book-route-article :is(h1.part-heading, h1:first-child) { margin-top: 2rem; font-size: 2.2rem; }
  .book-route-article h2 { font-size: 1.5rem; }
  .book-route-prevnext { grid-template-columns: 1fr; }
  .book-route-prevnext a + a { padding-left: 0; border-left: 0; border-top: 1px solid var(--bk-line); }
  .book-route-prevnext .book-next { text-align: left; }
  .book-runhead__nav { display: none; }
  .book-route-toolbar .label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .book-route-toolbar button { width: 44px; padding: 0; justify-content: center; }
  .book-route-toolbar .book-rail__summary { width: auto; padding: 0 .8rem; }
  /* The fixed "Send a note" tab (31px tall, 16px above the viewport edge) covers
     the centred footer links on narrow screens; let the footer scroll clear of it. */
  .book-route-body .site-footer { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  /* Edition facts stay two by two on the smallest phones (B3). */
  .book-edition__inner { column-gap: 1rem; }
  .book-edition__fact { padding-left: .75rem; }
  .book-edition__fact strong { font-size: 1.12rem; }
  .book-edition__fact span { font-size: .66rem; letter-spacing: .08em; }
}

/* ------------------------------------------------------------------ */
/* 8b. Layout pass, 2026-11                                             */
/* ------------------------------------------------------------------ */
/* Landing actions on phones: the primary action keeps the full width; the
   single-page edition takes the next row and the two downloads share the
   last, so four stacked pills become three rows and nothing is orphaned. */
@media (max-width: 760px) {
  .book-reader-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .book-reader-choice a { width: auto; min-width: 0; padding-inline: .75rem; }
  .book-reader-choice a:nth-child(-n + 2) { grid-column: 1 / -1; }
}

/* Contract boxes on phones: a little less inset, so their text keeps the
   ~310px minimum line on a 390px screen. */
@media (max-width: 600px) {
  .book-route-article blockquote.chapter-contract, .book-route-article .entry-contract { padding-right: 1rem; padding-left: 1rem; }
}

/* Chapter pages, wide screens: the rail and the reading column travel as one
   centred pair. The canvas behind the rail runs out to the left edge and the
   paper behind the column runs out to the right, so the split still reads as
   rail | page while the composition is centred at 1280 to 1920. */
@media (min-width: 901px) {
  /* The shell carries the column's right padding, so it sits half a gutter
     right of centre: then the space left of the rail equals the space right
     of the column. */
  .book-route-body { --bk-shell: calc(var(--bk-rail-w) + var(--bk-measure) + 2 * var(--bk-gutter)); --bk-shell-left: max(0px, (100% - var(--bk-shell) + var(--bk-gutter)) / 2); }
  /* background-image only: the body keeps its canvas background-color, which
     Marginalia reads to choose its light or dark theme. */
  .book-route-body:not(.book-landing) { background-image: linear-gradient(90deg, var(--bk-canvas) 50%, var(--bk-paper) 50%); }
  .book-shell { max-width: var(--bk-shell); margin: 0 0 0 var(--bk-shell-left); }
  .book-runhead { left: calc(var(--bk-shell-left) + var(--bk-rail-w)); }
}

/* Chapter pages, drawer layout: Contents and the reader controls share one
   row. The toolbar leaves the flow and sits at the right end of the rail's
   summary row; the open drawer still pushes the chapter down beneath it. */
@media (max-width: 900px) {
  /* The row and the open drawer start and end where the reading column does. */
  .book-shell { position: relative; --bk-col-edge: max(var(--bk-gutter), (100% - var(--bk-measure)) / 2); }
  .book-rail { padding-right: var(--bk-col-edge); padding-left: var(--bk-col-edge); }
  /* The icon sits on the column edge; the pill's padding reaches into the gutter. */
  .book-rail > .book-rail__summary { margin-left: -.6rem; padding-right: .5rem; }
  /* With the toolbar out of the flow, the heading's top margin would collapse
     through <main> and show the canvas above the page; keep it inside. */
  .book-route-main { display: flow-root; }
  .book-shell .book-route-toolbar { position: absolute; top: 0; right: var(--bk-col-edge); flex-wrap: nowrap; gap: 0; max-width: none; height: calc(44px + .8rem); min-height: 0; margin: 0; padding: 0; border: 0; }
}

/* Reader notes. Marginalia (assets/vendor/marginalia) draws its "Send a note"
   tab inside a shadow root, fixed 16px from the bottom right, where it sat on
   the reading column on every screen too narrow to keep it in the margin
   (phones, tablets, and desktops up to about 1230px). There it now rests in a
   reserved strip along the bottom of the viewport, so it never covers text.
   The strip exists only while Marginalia's host is mounted on the page. */
@media (max-width: 1230px) {
  .book-route-body:has(> div[data-marginalia-ignore][translate="no"])::after { content: ""; position: fixed; right: 0; bottom: 0; left: 0; z-index: 890; box-sizing: border-box; height: calc(63px + env(safe-area-inset-bottom)); border-top: 1px solid var(--bk-line); background: color-mix(in srgb, var(--bk-paper) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .book-route-body:has(> div[data-marginalia-ignore][translate="no"]) .site-footer { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
  /* Keyboard focus never comes to rest under the strip. */
  html:has(> .book-route-body > div[data-marginalia-ignore][translate="no"]) { scroll-padding-bottom: calc(63px + 1rem + env(safe-area-inset-bottom)); }
}
@media (min-width: 901px) and (max-width: 1230px) {
  .book-route-body:has(> div[data-marginalia-ignore][translate="no"])::after { left: calc(var(--bk-shell-left) + var(--bk-rail-w)); }
}
@media (prefers-reduced-motion: reduce) {
  .book-route-body *, .book-route-body *::before, .book-route-body *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ */
/* 9. Print                                                             */
/* ------------------------------------------------------------------ */
@media print {
  .book-route-body, .book-route-body:not(.book-landing) { background: #fff; color: #111; }
  .site-nav, .book-progress, .book-runhead, .book-rail, .book-route-toolbar, .book-route-prevnext, .book-continue, .book-galley-note, .book-landing-newsletter, .book-search-dialog, .site-footer, .book-colophon button { display: none !important; }
  .book-shell { display: block; max-width: none; }
  .book-route-body::after { content: none !important; }
  .book-route-main { padding: 0; background: #fff; }
  .book-page, .book-route-article { max-width: none; }
  .book-route-article { font-size: 11pt; line-height: 1.5; color: #111; }
  .book-route-article :is(h1.part-heading, h1:first-child) { font-size: 24pt; margin-top: 0; }
  .book-route-article h2 { font-size: 15pt; break-after: avoid; }
  .book-route-article h3 { font-size: 12.5pt; break-after: avoid; }
  .book-route-article figure, .book-route-article blockquote, .book-route-article .table-scroll-wrapper, .book-route-article pre { break-inside: avoid; }
  .book-route-article figure img { box-shadow: none; }
  .book-route-article a { color: #111; text-decoration: none; }
  .book-route-article a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }
  .book-landing-hero { color: #111; background: #fff; padding: 0; }
  .book-landing-topline, .book-reader-choice, .book-frontispiece-art, .book-edition { display: none; }
  .book-frontispiece { display: block; margin: 0; }
  .book-landing-hero h1, .book-landing-hero h1 em, .book-landing-hero p { color: #111; }
  .book-contents { margin: 0; padding: 2rem 0; }
  .book-landing-grid { display: block; }
  .book-landing-grid li { break-inside: avoid; }
}
/* Finis: the leaf the book closes on. Appended to both the chapter edition's
 * reader.<hash>.css and the complete edition's complete.<hash>.css, so it uses
 * the house --pm-* tokens (css/site-theme.css) rather than either edition's
 * own. The book used to stop on its last reference with the window's bottom
 * edge for a margin; it now ends on the robot, the title, a brass rule and the
 * edition, set as quietly as the title page that opens it, with a way back to
 * the beginning. */
.book-finis { box-sizing: border-box; max-width: 42rem; margin: 5rem auto 0; padding: 4.5rem 1.25rem 1.5rem; border-top: 1px solid var(--pm-border, #e2e8ef); text-align: center; }
.book-finis__mark { display: block; width: 56px; height: 56px; margin: 0 auto 1.5rem; }
.book-finis .book-finis__title { margin: 0; color: var(--pm-text, #1c2a3a); font-family: "Charter", Georgia, serif; font-size: clamp(1.8rem, 4.5vw, 2.35rem); font-weight: 700; letter-spacing: -.015em; line-height: 1.08; text-align: center; text-indent: 0; text-wrap: balance; }
.book-finis .book-finis__title em { font-style: italic; }
.book-finis .book-finis__subtitle { margin: .55rem 0 0; color: var(--pm-text-2, #3f4f61); font-family: "Charter", Georgia, serif; font-size: 1.1rem; font-style: italic; line-height: 1.4; text-align: center; text-indent: 0; }
.book-finis__ornament { margin: 1.75rem auto; color: var(--pm-brass, #b8862b); line-height: 0; }
.book-finis__ornament svg { width: 96px; height: 12px; fill: currentColor; }
.book-finis .book-finis__line, .book-finis .book-finis__links { margin: 0; color: var(--pm-text-muted, #55657a); font-family: var(--pm-font, "Poppins", sans-serif); font-size: .7rem; font-weight: 600; letter-spacing: .16em; line-height: 1.7; text-align: center; text-indent: 0; text-transform: uppercase; }
.book-finis__sep { padding: 0 .6em; color: var(--pm-brass, #b8862b); }
.book-finis .book-finis__links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: 2rem; }
.book-finis .book-finis__links a { padding: .6rem .3rem; border-bottom: 1px solid transparent; color: var(--pm-text-2, #3f4f61); text-decoration: none; transition: color .15s ease, border-color .15s ease; }
.book-finis .book-finis__links a:hover { border-bottom-color: currentColor; color: var(--pm-brass-text, #7d5a17); }
/* Chapter edition: the page-turn bar follows the leaf closely. */
.book-finis + .book-route-prevnext { margin-top: 2.5rem; }
/* On a phone each phrase takes its own line rather than stranding a middle
   dot at the end of one. */
@media (max-width: 480px) {
  .book-finis { margin-top: 3.5rem; padding: 3.5rem 1rem 1rem; }
  .book-finis .book-finis__sep { display: none; }
  .book-finis .book-finis__line > span:not(.book-finis__sep) { display: block; }
  .book-finis .book-finis__links { flex-direction: column; margin-top: 1.5rem; }
}
@media print {
  .book-finis { padding-bottom: 2rem; border-top: 0; break-before: page; }
  .book-finis .book-finis__links { display: none; }
}
