/* Web edition presentation. Book typography comes from the EPUB stylesheet, loaded first.
   This file only adds site layout: hero, navigation, spacing, figures and motion. */

:root {
  --paper: #f7f3ec;
  --ink: #1c1a17;
  --soft: #4f4a43;
  --muted: #625c53;
  --rule: #e2dbce;
  --mat: #ece6db;
  --accent: #8f3f22;
  --series: #8f3f22; /* Chart line; validated for the light paper. */
  --on-accent: #ffffff;
  --night: #191715;
  --on-night: #f3ede3;
  --on-night-soft: #cbbfac;
  /* Radii: one small set, so equal parts share a corner. A part nested in a rounded box with padding takes
     the outer radius minus that padding (see site/features/README.md), so the corners stay concentric. */
  --radius-s: 0.5rem;     /* inputs, chips, thumbnails, small tips */
  --radius-m: 0.875rem;   /* cards, popovers, dialogs, menus, video */
  --radius-pill: 999px;   /* pill buttons and toggles */
  --measure: 38rem; /* About 34em of body text: 60-70 Hebrew characters a line. */
  --gutter: clamp(1.25rem, 5vw, 3rem);
  /* "Book Sans" is the book's bundled Noto Sans Hebrew (Hebrew letters only); Latin letters fall through to the system sans. */
  /* Motion: the one set of timings for every transition and animation (site/features/README.md). Transform and
     opacity only, 140-340 ms. Reduced motion sets the durations to 0, so everything is instant. */
  --dur-quick: 140ms;     /* hover and press feedback */
  --dur-base: 220ms;      /* menus, popovers, fades, the bar */
  --dur-slow: 340ms;      /* entrances, things that leave the screen */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);       /* most motion: fast start, soft landing */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);    /* moves between two places */
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);  /* a small overshoot, for pills and toggles */
  /* Older names, kept as aliases of the set above. */
  --dur-fast: var(--dur-quick);
  --dur: var(--dur-base);
  --ease: var(--ease-out);
  --sans: "Book Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-reduced-motion: reduce) { :root { --dur-quick: 0ms; --dur-base: 0ms; --dur-slow: 0ms; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141312; --ink: #ece6dc; --soft: #c2bbaf; --muted: #948d82; --rule: #2c2a27;
    --mat: #1d1c1a; --accent: #e3a07c; --on-accent: #1a120c; --series: #cf6f3f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141312; --ink: #ece6dc; --soft: #c2bbaf; --muted: #948d82; --rule: #2c2a27;
  --mat: #1d1c1a; --accent: #e3a07c; --on-accent: #1a120c; --series: #cf6f3f;
  color-scheme: dark;
}

/* Base. The root size grows with the window, so a desktop reads like a 150% zoom and a phone keeps 16px.
   Every rem in this file scales with it. Media queries in rem still use the browser default size. */
html { font-size: clamp(100%, 0.5rem + 1vw, 162.5%); scroll-padding-top: max(22vh, 7.75rem); /* Matches jumpOffset() in reader.js: the bar plus 4rem. */ -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.125rem;
  line-height: 1.75;
  overflow-x: clip;
}
[dir="ltr"], [dir="rtl"] { unicode-bidi: isolate; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 0.22em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; } /* The ring follows the element's own corners. */
img { max-width: 100%; }
p { text-indent: 0; } /* The book stylesheet indents paragraphs; site chrome must not inherit that. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 20; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; font-family: var(--sans); }
.skip-link:focus { top: 1rem; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; } /* Site rules such as figure img { display: block } must not undo hidden. */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: 2.9rem; box-sizing: border-box;
  padding: 0.7rem 1.4rem; border-radius: var(--radius-pill); border: 1px solid transparent;
  font-family: var(--sans); font-size: 1rem; font-weight: 600; line-height: 1.2; text-decoration: none;
  background: var(--accent); color: var(--on-accent);
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-meta { font-weight: 400; opacity: 0.75; font-size: 0.85em; }
.btn-light { background: var(--on-night); color: var(--night); }
.btn-outline { background: transparent; color: var(--on-night); border-color: color-mix(in srgb, var(--on-night) 45%, transparent); }
.btn-outline:hover { background: color-mix(in srgb, var(--on-night) 10%, transparent); }
.btn-small { min-height: 2.25rem; padding: 0.4rem 1rem; font-size: 0.9rem; }


/* Entrance motion, once per element. Only with the script and without reduced motion: the script adds html.motion,
   so without it every element shows in its final state. Transform and opacity only. */
@keyframes rise-in { from { opacity: 0; transform: translateY(0.4rem); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.97); } }
/* Press feedback on controls. */
:is(.btn, .icon-btn, .nav-text, .view-toggle button, .tabs [role="tab"], .back-chip, .resume a, .split-more):active { transform: scale(0.97); }
:is(.icon-btn, .nav-text, .view-toggle button, .tabs [role="tab"], .back-chip, .resume a, .split-more) { transition: transform var(--dur-quick) var(--ease-out), background-color var(--dur-quick) var(--ease-out); }
/* Navigation: transparent over the hero, translucent over the text. */
/* Over the hero the bar is transparent; a soft dark scrim behind it keeps its text readable on any photo. */
.nav::before { content: ""; position: absolute; inset: 0 0 -1.5rem; z-index: -1; background: linear-gradient(rgb(14 12 10 / 0.6), rgb(14 12 10 / 0)); transition: opacity var(--dur) var(--ease); pointer-events: none; }
.nav[data-solid]::before { opacity: 0; }
.nav { position: fixed; inset: 0 0 auto; z-index: 1000; isolation: isolate; color: var(--on-night); font-family: var(--sans); font-size: 0.95rem; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.nav-inner { display: flex; align-items: center; gap: 0.75rem; max-width: 72rem; margin: 0 auto; padding: 0.6rem var(--gutter); }
.nav-title { flex: 1 1 0; min-width: 0; overflow: hidden; font-weight: 600; text-decoration: none; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity var(--dur) var(--ease), visibility var(--dur); }
.nav-title-full { display: inline-block; }
.nav-title-short { display: none; }
.nav-title[data-short] .nav-title-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.nav-title[data-short] .nav-title-short { display: inline; }
.nav-actions { display: flex; align-items: center; gap: 0.25rem; flex: none; }
.nav-text { padding: 0.45rem 0.8rem; min-height: 2.5rem; border-radius: var(--radius-pill); }
.nav-text:hover, .nav .icon-btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.icon-btn { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; border-radius: var(--radius-pill); color: inherit; }
.icon-btn svg, .split-more svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav[data-solid] { background: color-mix(in srgb, var(--paper) 94%, transparent); color: var(--ink); box-shadow: 0 1px 0 color-mix(in srgb, var(--rule) 80%, transparent); } /* No backdrop blur: at 94% paper it showed little and repainted the bar's area each frame. */
.nav[data-solid] .nav-title { opacity: 1; visibility: visible; }
/* The bar's download button appears only after the hero's download button scrolls away. */
/* Hidden, it takes no room: width and the gap before it are 0, so search and chapters sit at the end edge.
   It grows in with the bar's 200 ms transition and pushes them to their places. */
.nav-download { width: 0; min-width: 0; margin-inline-start: -0.25rem; overflow: hidden; opacity: 0; visibility: hidden; transition: width var(--dur) var(--ease), margin var(--dur) var(--ease), opacity var(--dur) var(--ease), visibility var(--dur); }
.nav[data-download] .nav-download { width: 2.5rem; margin-inline-start: 0; opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .nav-download { transition: none; } }
.nav .nav-download { background: var(--accent); color: var(--on-accent); }
.nav .nav-download:hover { background: color-mix(in srgb, var(--accent) 85%, var(--ink)); }

/* Split button: the main action and a chevron that opens the e-reader menu. */
.split { display: inline-flex; align-items: stretch; }
.split .split-main { border-start-end-radius: 0; border-end-end-radius: 0; border-inline-end-width: 0; }
/* The divider is subtler than the outer border: thinner in tone and inset from the top and bottom edges. */
.split .split-more { position: relative; display: inline-grid; place-items: center; padding: 0 0.55rem; min-width: 2rem; border-start-start-radius: 0; border-end-start-radius: 0; border-inline-start-width: 0; }
.split .split-more::before { content: ""; position: absolute; inset-block: 26%; inset-inline-start: 0; width: 1px; background: currentColor; opacity: 0.3; }
.split .btn.split-more { gap: 0; padding-inline: 0.7rem; }
.split-more { border-radius: var(--radius-pill); }
.split-more svg { width: 1.1rem; height: 1.1rem; }

/* E-reader menu (a popover, so the browser handles light dismiss and Escape). */
.menu { position: fixed; inset: auto; margin: 0; box-sizing: border-box; width: min(20rem, calc(100vw - 2rem)); padding: 0.75rem; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 0.9rem; box-shadow: 0 18px 48px rgb(0 0 0 / 0.22); }
.menu-note { margin: 0 0.5rem 0.5rem; color: var(--muted); font-size: 0.85em; line-height: 1.45; }
.menu ul { margin: 0.25rem 0 0; padding: 0.25rem 0 0; list-style: none; border-top: 1px solid var(--rule); }
.menu a { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.55rem 0.5rem; border-radius: calc(var(--radius-m) - 0.75rem); /* Inside the menu's 0.75rem padding. */ text-decoration: none; }
.menu a:hover, .menu a:focus-visible { background: var(--mat); outline: none; }
.menu-download { font-weight: 600; }
.menu-meta { color: var(--muted); font-size: 0.85em; }
.progress { position: absolute; inset-inline: 0; bottom: 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: right; opacity: 0; }
[dir="ltr"] .progress { transform-origin: left; }
.nav[data-solid] .progress { opacity: 1; }
@supports (animation-timeline: scroll()) {
  .progress { animation: progress linear both; animation-timeline: scroll(root); }
  @keyframes progress { to { transform: scaleX(1); } }
}

/* Focus rings on dark ground (the hero, the transparent bar, the footer) use the light ink; split parts follow their shape. */
:is(.hero, .nav:not([data-solid]), .footer) :focus-visible { outline-color: var(--on-night); }
/* Hero */
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 100svh; display: grid; align-items: center; background: var(--night); color: var(--on-night); }
.hero-backdrop { position: absolute; inset: -12% 0; z-index: -1; }
.hero-backdrop img { width: 100%; height: 100%; object-fit: cover; filter: blur(36px) saturate(1.15) brightness(0.5); transform: scale(1.2); }
.hero-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 55%, var(--night)); }
/* Closing photograph above the footer: full bleed, with its caption and credit like the book's photos. */
.closing-photo { margin: 0; padding-bottom: 2rem; background: var(--night); color: var(--on-night); }
.closing-photo img { display: block; width: 100%; height: auto; max-height: 92vh; object-fit: cover; }
.closing-photo figcaption { max-width: var(--measure); margin: 0 auto; padding: 1rem var(--gutter) 0; font-family: var(--sans); font-size: 0.9rem; line-height: 1.55; }
.closing-photo figcaption span { display: block; }
.closing-photo .credit, .closing-photo .closing-note { color: var(--on-night-soft); font-size: 0.9em; }
.hero-inner { display: grid; gap: clamp(2.5rem, 6vw, 5rem); align-items: center; width: 100%; max-width: 72rem; margin: 0 auto; padding: 6rem var(--gutter) 6rem; box-sizing: border-box; }
.hero-cover { order: -1; justify-self: center; width: min(52vw, 15rem); height: auto; border-radius: 3px; /* A printed cover: nearly square corners on purpose. */ box-shadow: 0 30px 70px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.06); }
.hero-author { margin: 0 0 1rem; font-family: var(--sans); font-size: 0.95rem; font-weight: 600; color: var(--on-night-soft); }
.hero-title { margin: 0 0 1.5rem; font-size: clamp(2.4rem, 1.5rem + 4vw, 5.5rem); line-height: 1.04; font-weight: bold; text-wrap: balance; }
.hero-lede { margin: 0 0 2.5rem; max-width: 32rem; font-size: clamp(1.1rem, 1rem + 0.4vw, 1.35rem); line-height: 1.65; color: var(--on-night-soft); text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-cue { position: absolute; bottom: 1.5rem; inset-inline-start: 50%; translate: 50% 0; color: var(--on-night-soft); padding: 0.5rem; }
[dir="ltr"] .hero-cue { translate: -50% 0; }
@media (min-width: 56rem) {
  .hero-inner { grid-template-columns: 1.25fr 0.75fr; }
  .hero-cover { order: 0; width: min(100%, 22rem); }
}
@media (max-width: 30rem) {
  .hero-actions > .btn, .hero-actions > .split { flex: 1 1 100%; justify-content: center; }
  .hero-actions .split-main { flex: 1; justify-content: center; }
}

/* Book */
.book { padding: 0 var(--gutter) clamp(5rem, 12vw, 9rem); outline: none; }
.book > .doc { width: 100%; max-width: var(--measure); margin-inline: auto; }

/* Colour guard: book.css colours text for print, and it loads in the "book" cascade layer (index.html), so any
   site rule wins over it. This zero-specificity rule gives every element of the EPUB documents the site's text
   token, so a new print colour can never break dark mode; every site rule with a class still applies. */
:where(.book .doc, .colophon) :where(h1, h2, h3, h4, h5, h6, p, span, div, section, aside, figcaption, caption, th, td, li, dt, dd, blockquote, em, strong, small, cite, sup, sub) { color: inherit; }
.book figure .withheld { background: var(--mat); border-color: var(--rule); }
.book table.text-table th { border-bottom-color: var(--muted); }
/* Tables printed as text fit the column: fixed layout, and long cells wrap anywhere on a phone. */
.book table.text-table { table-layout: fixed; width: 100%; }
.book table.text-table :is(th, td) { overflow-wrap: anywhere; }
@media (max-width: 40rem) { .book table.text-table { font-size: 0.8rem; } .book table.text-table :is(th, td) { padding: 0.4rem 0.3rem; } }
.book :is(aside.footnote, th, td) { border-color: var(--rule); }

/* The hero shows the cover, title and author, so the printed cover, blank pages and back cover stay out of the flow.
   The title page moves to the footer credits at build time. */
.book > .doc:is([data-kind="cover"], [data-kind="blank"], [data-kind="backcover"]), .book > .doc:has(> nav#toc) { display: none; }
.book [data-epub-type="pagebreak"] { display: none; }
.book p { margin: 0 0 1.2em; text-indent: 0; text-wrap: pretty; }
.book a[role="doc-noteref"] { color: var(--accent); font-family: var(--sans); font-weight: 600; }

/* Footer credits: the title page and the copyright page in small type. */
.colophon { text-align: start; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid rgb(255 255 255 / 0.14); width: 100%; font-size: 0.8rem; line-height: 1.6; color: var(--on-night-soft); }
.colophon section { margin: 0 0 1.5rem; }
.colophon p { margin: 0 0 0.3rem; }
.colophon .display-title { margin-bottom: 0.4rem; font-size: 0.95rem; font-weight: 700; color: var(--on-night); }
.colophon section.titlepage > p:nth-of-type(2) { margin-bottom: 0.9rem; font-size: 0.9rem; color: var(--on-night); }
.colophon .small { margin-top: 0.75rem; font-size: 0.9em; }
.colophon [data-epub-type="pagebreak"] { display: none; }

.book section.chapter { padding-top: clamp(5rem, 14vw, 11rem); }
.book section.chapter > h2 { margin: 0 0 clamp(2rem, 5vw, 3.5rem); font-size: clamp(1.6rem, 1.1rem + 2vw, 3rem); line-height: 1.15; text-wrap: balance; overflow-wrap: break-word; }
.book section.chapter > h2::after { content: ""; display: block; width: 3rem; height: 2px; margin-top: 1.75rem; background: var(--accent); }
.book .chapter-number { display: block; margin-bottom: 1rem; font-family: var(--sans); font-size: 0.85rem; font-weight: 600; color: var(--accent); opacity: 1; }
.book section.chapter > h2 + p { font-size: 1.12em; line-height: 1.7; }
/* The book stylesheet may colour titles for print; the site uses its own tokens so dark mode stays readable. */
.book h2, .book .display-title { color: var(--ink); }
.book .edition-note, .book .fx-label, .book .byline, .book figcaption .credit, .book figcaption .edition-credit, .book .source-note { color: var(--muted); }
.book figcaption .edition-credit a { color: inherit; }
/* Poems and songs: a centred block with its own narrow measure, lines aligned to the start, a soft mat and
   a small ornament. A long line wraps with a hanging indent, so it still reads as one verse. */
.book section.poem { width: fit-content; max-width: min(30rem, 100%); box-sizing: border-box; margin: clamp(2.5rem, 7vw, 4.5rem) auto; padding: clamp(1.75rem, 5vw, 2.75rem) clamp(1.25rem, 5vw, 3rem); border-radius: var(--radius-m); background: var(--mat); text-align: start; }
.book section.poem::before { content: ""; display: block; width: 2.25rem; height: 1px; margin: 0 auto 1.5rem; background: var(--accent); box-shadow: 0 4px 0 -0.5px color-mix(in srgb, var(--accent) 45%, transparent); }
.book .poem-title { margin: 0 0 0.35rem; font-size: 1.2em; font-weight: 600; line-height: 1.35; color: var(--ink); text-wrap: balance; }
.book .poem-author { margin: 0 0 1.5rem; font-family: var(--sans); font-size: 0.78em; color: var(--muted); }
.book .poem-author::before { content: "— "; }
.book .poem-body p.stanza { margin: 0 0 1.4em; line-height: 1.9; text-indent: 0; }
.book .poem-body p.stanza:last-child { margin-bottom: 0; }
.book .poem-body .line { display: block; padding-inline-start: 1.25em; text-indent: -1.25em; }
.book .poem-body br { display: none; } /* Each line is a block; the EPUB's line breaks are for e-readers. */
/* Lines that step in, as printed (indent-1 .. indent-6, N em further in). The hanging indent still applies,
   so a wrapped stepped line reads as one verse. */
.book .poem-body .line.indent-1 { padding-inline-start: calc(1.25em + 1em); }
.book .poem-body .line.indent-2 { padding-inline-start: calc(1.25em + 2em); }
.book .poem-body .line.indent-3 { padding-inline-start: calc(1.25em + 3em); }
.book .poem-body .line.indent-4 { padding-inline-start: calc(1.25em + 4em); }
.book .poem-body .line.indent-5 { padding-inline-start: calc(1.25em + 5em); }
.book .poem-body .line.indent-6 { padding-inline-start: calc(1.25em + 6em); }
.book .byline { color: var(--muted); }

.book blockquote.epigraph { margin: 2.5rem 0; padding: 0; padding-inline-start: 1.25rem; border: 0; border-inline-start: 2px solid var(--accent); color: var(--soft); font-size: 1.02em; }
.book blockquote.pullquote { margin: clamp(3rem, 8vw, 5.5rem) 0; text-align: center; font-size: clamp(1.5rem, 1.1rem + 1.7vw, 2.35rem); line-height: 1.35; color: var(--ink); }
.book blockquote.pullquote::before, .book blockquote.pullquote::after { content: ""; display: block; width: 2.5rem; height: 1px; margin: 0 auto 1.5rem; background: var(--muted); }
.book blockquote.pullquote::after { margin: 1.5rem auto 0; }
.book blockquote.pullquote p { margin: 0; }
@media (min-width: 64rem) { .book blockquote.pullquote { margin-inline: -5rem; } }

.book table { width: 100%; margin: 2.5rem 0; border-collapse: collapse; font-family: var(--sans); font-size: 0.95rem; }
.book caption { margin-bottom: 0.75rem; text-align: start; font-weight: 600; }
.book th, .book td { padding: 0.65rem 0.75rem; text-align: start; border-bottom: 1px solid var(--rule); }
.book thead th { border-bottom: 2px solid var(--ink); }

.book aside.footnote { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.9rem; line-height: 1.6; color: var(--soft); }
.book aside.footnote a { color: var(--accent); }

.book section.credits { margin-top: clamp(5rem, 12vw, 8rem); padding-top: 2.5rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.95rem; line-height: 1.6; color: var(--soft); }
.book section.credits h2 { font-size: 1rem; color: var(--muted); margin: 0 0 1rem; }
.book section.credits p { margin: 0 0 0.4rem; }

/* Figures */
.book figure { margin: clamp(3rem, 9vw, 6.5rem) 0; text-align: start; }
/* Figures that follow each other form a set: about a third of the usual gap between them.
   Page markers between them are hidden, so they count as adjacent. */
.book figure:has(+ figure, + [data-epub-type="pagebreak"] + figure) { margin-bottom: clamp(1rem, 3vw, 2.2rem); }
.book :is(figure + figure, figure + [data-epub-type="pagebreak"] + figure) { margin-top: clamp(1rem, 3vw, 2.2rem); }
.book figure img { display: block; cursor: zoom-in; }
.book figcaption { margin: 1rem auto 0; font-family: var(--sans); font-size: 0.9rem; line-height: 1.55; color: var(--ink); }
.book figcaption .credit { margin-top: 0.25rem; color: var(--muted); opacity: 1; font-size: 0.9em; }

/* Photos run full width and always show whole: at most 88vh tall, never cropped, never moving. */
.book figure.photo { width: 100vw; margin-inline: calc(50% - 50vw); }
.book figure.photo img { width: min(100%, calc(88vh * var(--ratio, 1))); height: auto; margin: 0 auto; }
.book figure.photo figcaption { max-width: var(--measure); padding-inline: var(--gutter); }

/* In-column images: never cropped, and enlarged at most 1.5 times their pixel width.
   Phones run them edge to edge. On wider screens landscape images grow past the text column. */
.book figure.inline > img { width: min(100%, calc(var(--w, 100%) * 1.5), calc(82vh * var(--ratio, 1))); height: auto; margin: 0 auto; }
@media (max-width: 40rem) {
  .book figure.inline:has(> img) { margin-inline: calc(-1 * var(--gutter)); }
  .book figure.inline:has(> img) > figcaption { padding-inline: var(--gutter); }
  .book figure.inline > img[data-shape="landscape"] { width: min(100%, calc(var(--w) * 2)); }
}
@media (min-width: 48rem) {
  .book figure.inline > img[data-shape="landscape"] {
    --big: min(calc(var(--w) * 1.5), calc(100vw - 2 * var(--gutter)), 60rem);
    width: var(--big); max-width: none; margin-inline: calc((100% - var(--big)) / 2);
  }
}
.book figure.inline figcaption { text-align: start; }
.book section.chapter.opens-with-photo { padding-top: clamp(1.5rem, 4vw, 3rem); }
.book section.opens-with-photo > figure.photo:first-of-type { margin-top: 0; }

/* Facsimile appendix: page images as a grid of thumbnails on the web. */
/* Widths leave room for the white space between the inline blocks, so two (phone) or four pages share a row. */
.book .fx-set > .doc { display: inline-block; vertical-align: top; width: calc(50% - 1.3rem); max-width: none; margin: 0.5rem; }
@media (min-width: 48rem) { .book .fx-set > .doc { width: calc(25% - 1.3rem); } }
.book section.facsimile-page { padding: 0; }
.book .fx-nav { display: flex; justify-content: space-between; margin: 0 0 0.35rem; font-family: var(--sans); font-size: 0.75rem; }
.book .fx-label { color: var(--muted); }
.book figure.facsimile { margin: 0; }
.book figure.facsimile img { width: 100%; height: auto; box-shadow: 0 2px 10px rgb(0 0 0 / 0.12); }
.book section.facsimile-intro { padding-top: clamp(5rem, 14vw, 11rem); }

/* Printed contents: parts with title and author. The site has no pages, so page numbers stay hidden. */
.book ol.contents .page { display: none; }
.book section.contents { padding-top: clamp(4rem, 10vw, 7rem); font-family: var(--sans); }
.book section.contents > h2 { font-size: clamp(1.35rem, 1.2rem + 0.4vw, 1.6rem); margin: 0 0 1rem; }
.book ol.contents, .book ol.contents ol { list-style: none; margin: 0; padding: 0; }
.book ol.contents > li.part { margin: 2rem 0 0; }
.book ol.contents .part-title { display: block; margin-bottom: 0.5rem; font-family: var(--sans); font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.book ol.contents ol li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.book ol.contents a { text-decoration: none; }
.book ol.contents a:hover { text-decoration: underline; }
.book ol.contents .author { color: var(--muted); font-size: 0.9em; }
.book ol.contents .page { margin-inline-start: auto; color: var(--muted); font-family: var(--sans); font-size: 0.8em; font-variant-numeric: tabular-nums; }

/* Artwork is never cropped: shown whole on a mat. */
.book figure.artwork { width: min(100vw, 62rem); margin-inline: calc(50% - min(50vw, 31rem)); padding: clamp(1.5rem, 6vw, 4.5rem) var(--gutter); box-sizing: border-box; background: var(--mat); }
.book figure.artwork img { width: min(100%, calc(78vh * var(--ratio, 1))); height: auto; margin: 0 auto; box-shadow: 0 18px 40px rgb(0 0 0 / 0.18); }
.book figure.artwork figcaption { max-width: var(--measure); text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .hero-backdrop { animation: drift linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
    @keyframes drift { to { transform: translateY(22%); } }
    /* Book images never move: no pan, no drift. Artwork only fades in a little as it enters, in place.
       Text never fades, so it is readable at every moment of a scroll. */
    .book figure.artwork img { animation: appear ease-out both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
    @keyframes appear { from { opacity: 0.4; } }
  }
  .hero-cue { animation: bob 2.6s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translateY(6px); } }
}

/* Deep links: shown on hover or keyboard focus. */
.deep-link { margin-inline-start: 0.5rem; padding: 0.15rem 0.5rem; font-family: var(--sans); font-size: 0.75rem; font-weight: 400; letter-spacing: 0; color: var(--muted); vertical-align: middle; opacity: 0; border-radius: var(--radius-pill); }
:is(h2, figcaption):hover .deep-link, .deep-link:focus-visible, .deep-link[data-copied] { opacity: 1; }
@media (hover: none) { .deep-link { display: none; } }
/* Jump highlight: background only, so nothing moves. JS removes it after about a second. */
.flash { animation: flash 1.2s ease-in both; }
@keyframes flash { 0%, 70% { background: color-mix(in srgb, var(--accent) 18%, transparent); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; background: color-mix(in srgb, var(--accent) 18%, transparent); } }
::highlight(jump-1) { background-color: color-mix(in srgb, var(--accent) 32%, transparent); }
::highlight(jump-2) { background-color: color-mix(in srgb, var(--accent) 18%, transparent); }
::highlight(jump-3) { background-color: color-mix(in srgb, var(--accent) 8%, transparent); }

/* Footer */
.footer { background: var(--night); color: var(--on-night); font-family: var(--sans); }
.footer-inner { max-width: var(--measure); margin: 0 auto; padding: clamp(4rem, 10vw, 7rem) var(--gutter); display: grid; justify-items: start; gap: 0.5rem; }
.footer-title { margin: 0; font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); font-weight: bold; line-height: 1.15; }
.footer-author { margin: 0 0 1.5rem; color: var(--on-night-soft); }
.footer .btn { background: var(--on-night); color: var(--night); }
.footer-top { margin-top: 2rem; font-size: 0.9rem; color: var(--on-night-soft); }
.related { margin-top: 2.5rem; }
.related-title { margin: 0 0 0.5rem; font-size: 1rem; color: var(--on-night); }
.related ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; }
.related a { color: var(--on-night); }
.related-note { display: block; font-size: 0.85rem; color: var(--on-night-soft); }

/* A withheld image: its box shows a muted "image removed" mark; the caption under it explains why. */
.book figure .withheld { display: grid; place-items: center; }
.book figure .withheld::before { content: ""; width: 2.25rem; height: 2.25rem; background: var(--muted); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 16 5-5 4 4 3-3 6 6M3 3l18 18'/%3E%3C/svg%3E") center / contain no-repeat; }
/* Part openings: the two printed lines of a part title are one title at one size, centred on the photo's axis. */
.book section.part > :is(h2, p.display-title) { margin: 0; font-size: clamp(1.75rem, 1.2rem + 2vw, 3rem); line-height: 1.2; text-align: center; text-wrap: balance; }
.book section.part > h2 { margin-top: clamp(1.5rem, 4vw, 2.5rem); }
/* The frontispiece dedication: its printed lines read as one short verse, not as separate paragraphs. */
.book section.frontispiece > p { margin: 0; }
.book section.frontispiece > figure + p { margin-top: clamp(1.5rem, 4vw, 2.5rem); }
/* English text in the same sans as the Hebrew, not the print's Times (book.css sits in a lower cascade layer). */
[lang="en"] { font-family: var(--sans); }
/* Phones: text never under 13 px (credits, notes, captions). */
@media (max-width: 40rem) {
  .book :is(figcaption .credit, figcaption .edition-credit, .edition-note, .fx-label, .source-note) { font-size: max(0.8125rem, 0.9em); }
}
/* The footer shows the title once: the title page's own title stays in the EPUB only. */
.colophon section.titlepage > .display-title { display: none; }
/* A long URL or word may break, so a narrow column (facsimile pages, phone notes) never grows past the screen. */
.book .doc { overflow-wrap: break-word; }
.book .fx-mask-note { overflow-wrap: anywhere; }
/* Every document of the book (chapters, parts, facsimile pages) skips style, layout and paint until it comes near the
   viewport; the browser keeps each one's last rendered height. The page has ~10,000 elements, so this is what keeps
   frames cheap. Find-in-page still searches skipped text; jumps render their target first (00-core.js).
   Tools that must see every element at once (axe in smoke_site.py) set data-render-all on <html>. */
.book > .doc { content-visibility: auto; contain-intrinsic-size: auto 1200px; }
.book > .fx-set { content-visibility: auto; contain-intrinsic-size: auto 40000px; } /* All facsimile pages: one box. */
[data-render-all] .book > :is(.doc, .fx-set) { content-visibility: visible; }
/* While 00-core.js measures documents: render them all, with the same containment that content-visibility applies,
   so a document's child margins stay inside it and the measured height equals its rendered height. */
[data-sizing] .book > :is(.doc, .fx-set) { content-visibility: visible; contain: layout style paint; }
@media print { .book > :is(.doc, .fx-set) { content-visibility: visible; } }

/* Motion (html.motion only): the hero eases in on load; a chapter's accent rule draws in on first view; poem lines
   rise in a short stagger once. Text that is already on screen never fades. */
.motion .hero-text { animation: rise-in var(--dur-slow) var(--ease-out) both; }
.motion .hero-cover { animation: rise-in var(--dur-slow) var(--ease-out) 80ms both; }
.motion .book section.chapter > h2::after { transform: scaleX(0); transform-origin: right; transition: transform var(--dur-slow) var(--ease-out); }
[dir="ltr"] .motion .book section.chapter > h2::after { transform-origin: left; }
.motion .book section.chapter > h2.seen::after { transform: none; }
.motion .book section.poem:not(.seen) .line { opacity: 0; }
.motion .book section.poem.seen .line { animation: rise-in var(--dur-base) var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 12) * 45ms); }
/* Panels */
dialog { color: var(--ink); background: var(--paper); font-family: var(--sans); }
dialog::backdrop { background: rgb(10 9 8 / 0.5); backdrop-filter: blur(2px); }
.panel { width: min(32rem, calc(100vw - 2rem)); max-height: min(85vh, 46rem); padding: 0; border: 0; border-radius: var(--radius-m); box-shadow: 0 24px 60px rgb(0 0 0 / 0.25); }
.panel-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding-block: 0.75rem; padding-inline: 1.25rem 0.75rem; background: var(--paper); }
.panel-head h2 { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.panel-head button { width: 2.5rem; height: 2.5rem; border-radius: var(--radius-pill); font-size: 1.3rem; }
.panel-head button:hover { background: var(--mat); }
.panel-list ol, ol.panel-list { list-style: none; margin: 0; padding: 0 0.5rem 0.75rem; }
.panel-list li :is(a, button) { display: block; width: 100%; text-align: start; padding: 0.75rem; border-radius: calc(var(--radius-m) - 0.5rem); /* Inside the list's 0.5rem padding. */ text-decoration: none; line-height: 1.45; }
.panel-list li :is(a, button):hover, .panel-list li :is(a, button):focus-visible { background: var(--mat); outline: none; }
#search-form { padding: 0.25rem 1.25rem; } /* Room for the focus ring above and below the field. */
#search-input { width: 100%; box-sizing: border-box; padding: 0.8rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--mat); color: inherit; font: inherit; font-size: 1rem; }
#search-input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.search-status { margin: 0.75rem 1.25rem 0.25rem; font-size: 0.85rem; color: var(--muted); }
.search-results li :is(a, button) { display: flex; gap: 0.75rem; align-items: flex-start; }
.search-results .result-text { flex: 1; min-width: 0; }
.search-results .where { display: block; margin-bottom: 0.2rem; font-size: 0.8rem; color: var(--muted); }
.result-thumb, .result-tile { flex: none; width: 3rem; height: 3rem; border-radius: var(--radius-s); object-fit: cover; background: var(--mat); }
.result-tile { display: grid; place-items: center; }
.result-tile svg { width: 1.6rem; height: 1.6rem; fill: var(--place); stroke: var(--paper); stroke-width: 1.2; }
#search-dialog { height: min(80vh, 42rem); }
#search-dialog[open] { display: flex; flex-direction: column; }
#search-dialog .search-results { flex: 1; overflow-y: auto; }
/* Phones: the search panel takes nearly the whole screen, above the keyboard. */
@media (max-width: 40rem) {
  #search-dialog { width: calc(100vw - 1rem); height: calc(100dvh - 1rem); max-height: none; margin: 0.5rem auto auto; }
}
.search-results mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 2px; }

/* The native clear button of search fields is the only blue in the interface: draw it in the muted ink instead. */
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; width: 1rem; height: 1rem; background: var(--muted); cursor: pointer; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat; }
/* Results: at most three lines of snippet, so more results fit; a hint line in the empty panel. */
.search-results .result-text { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.search-results .search-hint { padding: 0.75rem; font-size: 0.85rem; color: var(--muted); }
/* Dialogs open with a short scale and fade (html.motion only). */
.motion dialog[open] { animation: pop-in var(--dur-base) var(--ease-out); }
.motion dialog[open]::backdrop { animation: fade-in var(--dur-base) var(--ease-out); }
/* Figure viewer: the image on a dark stage, its caption below (beside it on wide screens). */
.figure-viewer { --drag: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(14 13 12 / calc(1 - var(--drag) * 0.85)); color: #eee8de; overflow: hidden; }
.figure-viewer::backdrop { background: transparent; }
.figure-viewer[open] { display: grid; grid-template: "bar" auto "stage" minmax(0, 1fr) "caption" auto / minmax(0, 1fr); }
.viewer-bar { grid-area: bar; z-index: 2; display: flex; align-items: center; gap: 0.5rem; padding: max(0.5rem, env(safe-area-inset-top)) 0.75rem 0.5rem; padding-inline-start: 1.1rem; font-family: var(--sans); transition: opacity var(--dur-base) var(--ease-out); opacity: calc(1 - var(--drag) * 2); }
.viewer-count { flex: 1; font-size: 0.85rem; color: #b9b0a2; font-variant-numeric: tabular-nums; }
.viewer-original { padding: 0.45rem 0.8rem; border-radius: var(--radius-pill); font-size: 0.82rem; color: #d9d1c4; text-decoration: none; }
.viewer-original:hover { background: rgb(255 255 255 / 0.1); }
.viewer-btn { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--radius-pill); color: #f3ede3; background: rgb(255 255 255 / 0.08); transition: background-color var(--dur-quick) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
.viewer-btn:hover { background: rgb(255 255 255 / 0.18); }
.viewer-btn svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.figure-viewer :focus-visible { outline-color: #f3ede3; }

.viewer-stage { grid-area: stage; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.viewer-stage img { max-width: none; max-height: none; object-fit: contain; transform-origin: 50% 50%; cursor: zoom-in; -webkit-user-drag: none; }
.figure-viewer[data-zoomed] .viewer-stage img { cursor: grab; }
.figure-viewer[data-zoomed] .viewer-stage img:active { cursor: grabbing; }
/* Previous and next sit at the stage edges; touch screens use a swipe and hide them. */
.viewer-step { position: absolute; z-index: 1; top: 50%; translate: 0 -50%; width: 3.25rem; height: 3.25rem; background: rgb(14 13 12 / 0.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.viewer-step:disabled { opacity: 0; pointer-events: none; }
.viewer-prev { inset-inline-start: clamp(0.5rem, 2vw, 1.5rem); }
.viewer-next { inset-inline-end: clamp(0.5rem, 2vw, 1.5rem); }
[dir="rtl"] .viewer-next svg, [dir="ltr"] .viewer-prev svg { transform: scaleX(-1); }
.figure-viewer[data-zoomed] .viewer-step { opacity: 0; pointer-events: none; }
@media (hover: none) { .viewer-step { display: none; } }

.viewer-caption { grid-area: caption; box-sizing: border-box; width: 100%; max-width: 46rem; max-height: 34dvh; margin: 0 auto; overflow-y: auto; padding: 0.75rem 1.25rem max(1rem, env(safe-area-inset-bottom)); font-family: var(--sans); font-size: 0.95rem; line-height: 1.6; color: #eee8de; transition: opacity var(--dur-base) var(--ease-out); opacity: calc(1 - var(--drag) * 2); }
.viewer-caption:empty { display: none; }
.viewer-caption { white-space: normal; }
.viewer-caption > * { margin: 0 0 0.35rem; }
.viewer-caption .credit { display: block; color: #b9b0a2; font-size: 0.85em; }
.viewer-caption a { color: #f0c3a6; }
.viewer-caption .deep-link { display: none; }
.figure-viewer[data-zoomed] :is(.viewer-caption, .viewer-bar .viewer-count) { opacity: 0.25; }
/* Wide screens: the caption becomes a column beside the image, so the image keeps the full height. */
@media (min-width: 64rem) and (min-aspect-ratio: 4/3) {
  .figure-viewer[open] { grid-template: "stage bar" auto "stage caption" minmax(0, 1fr) / minmax(0, 1fr) minmax(16rem, 24rem); }
  .viewer-bar { padding-top: 1rem; }
  .viewer-caption { align-self: end; max-height: none; padding: 1rem 1.5rem 2rem; padding-inline-start: 1.25rem; font-size: 1rem; }
  /* Without a caption the image takes the whole width under the bar. */
  .figure-viewer[open]:has(.viewer-caption:empty) { grid-template: "bar" auto "stage" minmax(0, 1fr) / minmax(0, 1fr); }
}
@media print { .figure-viewer { display: none; } }
/* Videos from printed QR codes: the QR code shrinks beside the caption, the player takes the column. */
.book figure.has-video { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem 1rem; align-items: start; }
.book figure.has-video .video { grid-column: 1 / -1; }
.book figure.has-video > a.qr-link { grid-row: 2; grid-column: 2; }
.book figure.has-video > a.qr-link img { width: 4.5rem; height: auto; }
.book figure.has-video figcaption { grid-row: 2; grid-column: 1; margin: 0; }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-m); overflow: hidden; }
.video iframe, .video-play { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play { padding: 0; cursor: pointer; background: #000; }
.book .video .video-play img { width: 100%; height: 100%; margin: 0; cursor: pointer; object-fit: cover; opacity: 0.85; transition: opacity 150ms ease; }
.book .video-play:hover img, .book .video-play:focus-visible img { opacity: 1; }
.video-icon { position: absolute; top: 50%; left: 50%; width: 4.25rem; height: 3rem; margin: -1.5rem 0 0 -2.125rem; border-radius: var(--radius-s); background: rgb(0 0 0 / 0.72); }
.video-icon::after { content: ""; position: absolute; top: 50%; left: 50%; margin: -0.6rem 0 0 -0.35rem; border-style: solid; border-width: 0.6rem 0 0.6rem 1rem; border-color: transparent transparent transparent #fff; }

/* With a player on the page the printed QR code has no use: a small text link to YouTube takes its place. */
.book figure.has-video > a.qr-link { display: none; }
.video-link { display: inline-block; margin-top: 0.35rem; font-family: var(--sans); font-size: 0.85rem; color: var(--accent); }
/* Maps: parts shared by every map (50-maps.js). Pins, cards and controls use the site tokens, so they follow dark mode. */
:root {
  --pin: #8f3f22; --pin-ring: #ffffff; --halo: #fbf8f3;
  --map-shadow: 0 1px 2px rgb(0 0 0 / 0.18), 0 4px 14px rgb(0 0 0 / 0.16);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pin: #e3a07c; --pin-ring: #141312; --halo: #141312; --map-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 6px 18px rgb(0 0 0 / 0.5); }
}
:root[data-theme="dark"] { --pin: #e3a07c; --pin-ring: #141312; --halo: #141312; --map-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 6px 18px rgb(0 0 0 / 0.5); }

/* .leaflet-container in each selector: leaflet.css loads later and must not win ties. */
.map-box.leaflet-container { font-family: var(--sans); font-size: 0.875rem; background: var(--mat); }
.map-box:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Quieter base tiles so pins and old maps lead; dimmed in dark mode, so the map is not the brightest thing on the page. */
.map-box .map-tiles { filter: saturate(0.55) contrast(0.92) brightness(1.03); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map-box .map-tiles { filter: saturate(0.5) brightness(0.62) contrast(1.1); } }
:root[data-theme="dark"] .map-box .map-tiles { filter: saturate(0.5) brightness(0.62) contrast(1.1); }

/* Pins: a dot with a ring, and the name beside it on a halo when there is room for it. */
.map-pin { overflow: visible; }
.map-pin .pin-dot { position: absolute; inset: 1px; border-radius: 50%; background: var(--pin); box-shadow: 0 0 0 2px var(--pin-ring), 0 1px 4px rgb(0 0 0 / 0.45); transition: scale var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.map-pin .pin-label {
  position: absolute; top: 50%; right: calc(100% + 4px); translate: 0 -50%; color: var(--ink); font: 600 12.5px/1.3 var(--sans); white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 1px var(--halo), 0 0 2px var(--halo), 0 0 3px var(--halo), 0 0 4px var(--halo), 0 0 6px var(--halo);
}
.map-pin.label-hidden .pin-label { visibility: hidden; }
.map-pin:is(:hover, :focus-visible, .selected) { z-index: 1000 !important; }
.map-pin:is(:hover, :focus-visible, .selected) .pin-label { visibility: visible; }
.map-pin:hover .pin-dot { scale: 1.2; }
.map-pin.selected .pin-dot { scale: 1.45; box-shadow: 0 0 0 2px var(--pin-ring), 0 0 0 4.5px var(--pin), 0 2px 8px rgb(0 0 0 / 0.45); }
.map-pin.selected .pin-label { font-weight: 700; }
.map-pin:focus-visible { outline: none; }
.map-pin:focus-visible .pin-dot { box-shadow: 0 0 0 2px var(--pin-ring), 0 0 0 4.5px var(--accent); }

/* Popups: a compact card on paper. */
.map-box .leaflet-popup-content-wrapper, .map-box .leaflet-popup-tip { background: var(--paper); color: var(--ink); box-shadow: var(--map-shadow); }
.map-box .leaflet-popup-content-wrapper { border-radius: var(--radius-m); padding: 0; border: 1px solid var(--rule); }
.map-box .leaflet-popup-content { margin: 0; font: inherit; }
.map-box.leaflet-container a.leaflet-popup-close-button { right: auto; left: 2px; top: 2px; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; font: 22px/1 var(--sans); color: var(--muted); }
.map-box.leaflet-container a.leaflet-popup-close-button:hover { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .map-box .leaflet-popup { animation: map-pop var(--dur-slow) var(--ease); }
}
@keyframes map-pop { from { opacity: 0; translate: 0 6px; } }

/* Chips and small controls on the map. */
.map-chips { display: grid; gap: 6px; justify-items: start; margin: 10px 0 0 10px !important; }
.map-chips button, .map-control {
  display: inline-flex; align-items: center; gap: 6px; min-height: 2.25rem; padding: 0 0.8rem; border: 1px solid var(--rule); border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--paper) 94%, transparent); color: var(--ink); font: 600 0.8rem/1.2 var(--sans); box-shadow: var(--map-shadow);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.map-chips button:hover, .map-control:hover { border-color: var(--accent); }
.map-chips i { width: 9px; height: 9px; border-radius: 50%; background: var(--pin); box-shadow: 0 0 0 1.5px var(--pin-ring); }

/* Hint shown when a gesture would scroll the page instead of moving the map. */
.map-hint { position: absolute; inset: 0; z-index: 1001; display: grid; place-items: center; padding: 1rem; background: rgb(20 18 16 / 0.28); pointer-events: none; opacity: 0; transition: opacity var(--dur-slow) var(--ease); }
.map-hint span { max-width: 22rem; padding: 0.6rem 1rem; border-radius: var(--radius-s); background: rgb(20 18 16 / 0.9); color: #fff; font: 600 0.95rem/1.4 var(--sans); text-align: center; direction: rtl; }
[data-hint] > .map-hint { opacity: 1; }

/* The folded map credit: a small © that opens on tap or hover. */
.map-credit { display: flex; align-items: center; gap: 4px; margin: 0 6px 6px !important; font: 11px/1.4 var(--sans); }
.map-credit button { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: color-mix(in srgb, var(--paper) 92%, transparent); color: var(--ink); font-size: 13px; padding: 0; box-shadow: var(--map-shadow); }
.map-credit span { display: none; max-width: min(28rem, 80vw); padding: 2px 8px; border-radius: var(--radius-s); background: color-mix(in srgb, var(--paper) 94%, transparent); color: var(--ink); }
.map-credit span a { color: inherit; }
.map-credit.open span, .map-credit:hover span { display: inline; }
/* Places (55-places.js). Shared map parts (pins, popups, chips, hint, credit) are in 50-maps.css. */
.book section.places { margin: clamp(3rem, 8vw, 5rem) 0 0; font-family: var(--sans); }
.places-head { max-width: var(--measure); margin: 0 auto 1.25rem; }
.places h2 { color: var(--ink); margin: 0 0 0.4rem; font-size: clamp(1.35rem, 1.2rem + 0.4vw, 1.6rem); } /* Like the contents heading. */
.places-intro { margin: 0; color: var(--soft); font-size: 0.9rem; line-height: 1.55; }
/* Edge to edge like a photo, but shorter. Its own stacking context keeps Leaflet's panes under the bar. */
.places-map { position: relative; z-index: 0; isolation: isolate; width: 100vw; margin-inline: calc(50% - 50vw); height: clamp(22rem, 72vh, 46rem); direction: ltr; background: var(--mat); }
.places-all { max-width: var(--measure); margin: 0.75rem auto 0; font-size: 0.9rem; }
.places-all summary { cursor: pointer; color: var(--muted); padding: 0.6rem 0; }
.places-list { margin: 0.5rem 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; font-size: 0.875rem; }
.places-list li { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.25rem; padding: 0 0.3rem 0 0.75rem; border: 1px solid var(--rule); border-radius: var(--radius-pill); }
[dir="rtl"] .places-list li { padding: 0 0.75rem 0 0.3rem; }
.place-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--pin); }
.place-name { font-weight: 600; }
.place-chapters { display: none; }
.places-list button { align-self: stretch; font-weight: 600; padding: 0 0.15rem; }
.places-list button:hover { text-decoration: underline; }
.places-list:not([data-live]) .place-chapters { display: inline; }
.places-list:not([data-live]) .place-chapters a { margin-inline-start: 0.5rem; color: var(--muted); }

/* Place card: in a popup on desktop and in a sheet on phones. */
.place-card { text-align: start; padding: 0.85rem 1rem 1rem; font: 0.875rem/1.5 var(--sans); color: var(--ink); }
.pc-title { margin: 0 0 0.3rem; padding-inline-end: 2.25rem; font-size: 1.05rem; line-height: 1.3; color: var(--ink); }
.pc-desc { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin: 0; color: var(--soft); }
.map-box.leaflet-container a.pc-source { display: inline-block; margin-top: 0.15rem; font-size: 0.8rem; color: var(--accent); }
.pc-chapters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 0.65rem; }
.map-box.leaflet-container .pc-chapters a { display: inline-flex; align-items: center; min-height: 2rem; padding: 0 0.7rem; border: 1px solid var(--rule); border-radius: var(--radius-pill); background: var(--mat); color: var(--ink); font-size: 0.8rem; text-decoration: none; line-height: 1.3; transition: border-color var(--dur-fast) var(--ease); }
.map-box.leaflet-container .pc-chapters a:hover { border-color: var(--accent); }
.pc-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 0.65rem; }
.pc-thumbs button { padding: 0; border-radius: var(--radius-s); overflow: hidden; line-height: 0; }
.pc-thumbs img { width: 56px; height: 56px; object-fit: cover; }
.pc-thumbs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Phones: the card is a sheet along the bottom of the map. */
.map-sheet { position: absolute; z-index: 1001; inset-inline: 8px; bottom: 8px; max-height: 62%; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--paper); box-shadow: var(--map-shadow); direction: rtl; }
.map-sheet::before { content: ""; display: block; width: 2.25rem; height: 4px; margin: 6px auto 0; border-radius: 2px; background: var(--rule); }
@media (prefers-reduced-motion: no-preference) {
  .map-sheet { transition: translate var(--dur-slow) var(--ease), opacity var(--dur-slow) var(--ease); }
  @starting-style { .map-sheet { translate: 0 24px; opacity: 0; } }
}
.map-sheet .place-card { padding-top: 0.35rem; }
.sheet-close { position: absolute; top: 2px; left: 2px; width: 2.75rem; height: 2.75rem; border-radius: var(--radius-pill); font-size: 1.4rem; color: var(--muted); z-index: 1; }

/* Place dots in the printed contents: one dot per place; the button opens the place names. */
.place-dots { display: inline-flex; align-items: center; gap: 3px; min-height: 2.75rem; min-width: 2.75rem; justify-content: center; padding: 0 0.35rem; border-radius: var(--radius-pill); vertical-align: middle; }
.place-dots:hover { background: var(--mat); }
.place-dots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--place); }
.place-pills { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.35rem 0 0.15rem; font-family: var(--sans); font-size: 0.85rem; }
.place-pills[hidden] { display: none; }
.place-pill { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem; padding: 0 0.65rem 0 0.4rem; border: 1px solid var(--rule); border-radius: var(--radius-pill); background: var(--paper); line-height: 1.3; }
[dir="rtl"] .place-pill { padding: 0 0.4rem 0 0.65rem; }
.place-pill:hover { border-color: var(--accent); }
.place-pill i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--place); }
/* Data tables rebuilt from printed table images. Bars show the highlighted column against its largest value. */
.book figure.has-table { max-width: 46rem; margin-inline: auto; }
.book table.data-table { width: 100%; margin: 0; border-collapse: collapse; font-family: var(--sans); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--rule); text-align: start; vertical-align: middle; }
.data-table tbody th { font-weight: 500; }
.data-table thead th { padding: 0; border-bottom: 2px solid var(--ink); }
.data-table thead button { width: 100%; padding: 0.5rem 0.6rem; font: inherit; font-weight: 600; text-align: start; color: inherit; background: none; border: 0; cursor: pointer; }
.data-table thead button::after { content: " ↕"; color: var(--muted); font-weight: 400; }
.data-table th[aria-sort="ascending"] button::after { content: " ↑"; color: var(--accent); }
.data-table th[aria-sort="descending"] button::after { content: " ↓"; color: var(--accent); }
.data-table td.bar { background: linear-gradient(to left, color-mix(in srgb, var(--accent) 22%, transparent) calc(var(--v) * 100%), transparent 0); }
.book figure.has-table { overflow-x: auto; }
@media (max-width: 40rem) {
  .book table.data-table { font-size: 0.75rem; }
  .data-table th, .data-table td { padding: 0.35rem 0.3rem; }
  .data-table thead button { padding: 0.4rem 0.3rem; }
}
.print-version { margin-top: 0.75rem; font-family: var(--sans); font-size: 0.85rem; }
.print-version summary { cursor: pointer; color: var(--muted); }
.print-version img { margin-top: 0.75rem; }

/* Rows of a data table fade in once, in a short stagger (html.motion only). */
.motion table.data-table:not(.seen) tbody tr { opacity: 0; }
.motion table.data-table.seen tbody tr { animation: fade-in var(--dur-base) var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 10) * 30ms); }
/* Charts: thin 2px lines, recessive grid, text in text tokens. Two series colours, validated together
   for light (#8f3f22, #00789a on #f7f3ec) and dark (#cf6f3f, #14a3b5 on #141312), all pairs. */
:root { --series-2: #00789a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-2: #14a3b5; } }
:root[data-theme="dark"] { --series-2: #14a3b5; }
.book figure.has-chart { max-width: 48rem; margin-inline: auto; }
.book figure.has-chart > img { margin-inline: auto; }
.view-toggle { display: inline-flex; margin: 0 0 0.75rem; padding: 3px; border: 1px solid var(--rule); border-radius: var(--radius-pill); font-family: var(--sans); font-size: 0.8rem; }
.view-toggle button { padding: 0.35rem 0.85rem; border-radius: var(--radius-pill); color: var(--muted); }
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chart-area { position: relative; display: grid; gap: 0.75rem; }
.chart-panel { position: relative; }
.chart-plot { position: relative; }
/* The y axis is on the left of the drawing, so its title sits on the left too, and the legend on the right. */
.chart-head { display: flex; flex-direction: row-reverse; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; font-family: var(--sans); font-size: 0.8rem; }
.chart-axis-title, .chart-x-title { margin: 0 0 0.25rem; color: var(--muted); font-family: var(--sans); font-size: 0.78rem; }
.chart-x-title { text-align: center; margin-top: 0.15rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin: 0; padding: 0; list-style: none; color: var(--ink); }
.chart-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.key { display: inline-block; width: 1.1rem; height: 2px; }
.key.points { width: 0.5rem; height: 0.5rem; border-radius: 50%; }
.key.s1 { background: var(--series); } .key.s2 { background: var(--series-2); }
.chart { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); direction: ltr; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 13px; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; }
.chart .line.s2 { stroke: var(--series-2); }
.chart .pt { fill: var(--series); }
.chart .pt.s2 { fill: var(--series-2); }
.chart .direct { font-size: 12px; font-weight: 600; fill: var(--series); }
.chart .direct.s2 { fill: var(--series-2); }
.chart .band { fill: color-mix(in srgb, var(--muted) 12%, transparent); }
.chart .band-label { fill: var(--muted); font-size: 11px; font-weight: 700; }
.chart .marker { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .marker-badge { fill: var(--paper); stroke: var(--muted); stroke-width: 1; }
.chart .marker-n { fill: var(--ink); font-size: 10px; font-weight: 700; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .dot { fill: var(--series); stroke: var(--paper); stroke-width: 2; }
.chart .dot.s2 { fill: var(--series-2); }
.chart:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.chart-markers { margin: 0.4rem 0 0; padding-inline-start: 1.4rem; font-family: var(--sans); font-size: 0.78rem; color: var(--soft); }
.chart-source, .chart-notes { margin: 0.6rem 0 0; font-family: var(--sans); font-size: 0.78rem; line-height: 1.5; color: var(--muted); }
.chart-source a { color: inherit; }
.csv-link { display: inline-block; min-height: 1.5rem; padding-block: 0.2rem; margin-top: 0.5rem; font-family: var(--sans); font-size: 0.8rem; color: var(--accent); }
.chart-tip { position: absolute; transform: translate(-50%, calc(-100% - 12px)); padding: 0.3rem 0.55rem; border-radius: var(--radius-s); background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 0.8rem; white-space: nowrap; pointer-events: none; }
.colophon :is(section, p) { text-align: start; }

/* A chart's lines draw in once, the first time it is drawn (html.motion only). Paint only, no layout. */
@keyframes draw-line { from { stroke-dashoffset: 1; } }
.motion .chart .line.draw-in { stroke-dasharray: 1; animation: draw-line var(--dur-slow) var(--ease-out) both; }
/* Navigator: tabs, a chapter filter, parts with their chapters, and the timeline. */
#toc-dialog { height: min(85vh, 46rem); }
#toc-dialog[open] { display: flex; flex-direction: column; }
#toc-dialog .panel-body { flex: 1; min-height: 0; overflow-y: auto; }
.tabs { display: flex; gap: 0.25rem; padding: 0.25rem 1rem 0.5rem; border-bottom: 1px solid var(--rule); }
.tabs:has(> [role="tab"]:only-of-type) { display: none; }
.tabs [role="tab"] { padding: 0.45rem 0.9rem; border-radius: var(--radius-pill); font-size: 0.9rem; color: var(--muted); }
/* The selected tab sits on an ink pill that slides between tabs (its place comes from 20-navigator.js). */
.tabs { position: relative; isolation: isolate; }
.tabs::before { content: ""; position: absolute; z-index: -1; top: var(--tab-top, 0.25rem); left: 0; width: var(--tab-w, 0); height: var(--tab-h, 0); border-radius: var(--radius-pill); background: var(--ink); transform: translateX(var(--tab-x, 0)); transition: transform var(--dur-base) var(--ease-out), width var(--dur-base) var(--ease-out); }
.tabs [role="tab"][aria-selected="true"] { color: var(--paper); }
.toc-filter { position: sticky; top: 0; z-index: 1; padding: 0.75rem 1rem 0.5rem; background: var(--paper); }
.toc-filter input { width: 100%; box-sizing: border-box; padding: 0.6rem 0.9rem; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--mat); color: inherit; font: inherit; font-size: 0.95rem; }
.toc-filter input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.toc-empty { margin: 1rem 1.5rem; color: var(--muted); }
.panel-list .toc ol { padding: 0; }
.toc-part { margin-top: 0.75rem; }
.toc-part-title { display: block; padding: 0.4rem 0.75rem; font-size: 0.8rem; font-weight: 700; color: var(--accent); text-decoration: none; }
/* Title and author on the start side, place dots in their own column at the end. */
.panel-list .toc-item a { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name dots" "author dots"; align-items: center; gap: 0.1rem 0.6rem; padding: 0.55rem 0.75rem; }
.toc-name { grid-area: name; }
.toc-author { grid-area: author; }
.toc-name { flex: 1 1 12rem; }
.toc-author { font-size: 0.8rem; color: var(--muted); }
.toc-places { grid-area: dots; display: inline-flex; align-items: center; gap: 3px; font-size: 0.7rem; color: var(--muted); }
.toc-places i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--place); }
.panel-list a[aria-current] { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .panel-list a[aria-current] { box-shadow: inset -3px 0 0 var(--accent); }
.timeline { list-style: none; margin: 0; padding: 1rem 1.25rem 1.5rem; position: relative; }
.timeline::before { content: ""; position: absolute; inset-block: 1rem; inset-inline-start: 1.6rem; width: 2px; background: var(--rule); }
.tl-event a { position: relative; display: grid; gap: 0.1rem; padding: 0.45rem 0.6rem 0.45rem 0; padding-inline: 1.6rem 0.6rem; border-radius: calc(var(--radius-m) - 0.5rem); text-decoration: none; line-height: 1.4; }
.tl-event a::before { content: ""; position: absolute; inset-inline-start: 0.12rem; top: 0.85rem; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 2px var(--muted); }
.tl-event a:hover, .tl-event a:focus-visible { background: var(--mat); outline: none; }
.tl-date { font-size: 0.78rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-text { font-size: 0.9rem; }
.tl-major a { padding-block: 0.7rem; }
.tl-major a::before { inset-inline-start: 0; top: 1.05rem; width: 0.8rem; height: 0.8rem; background: var(--accent); box-shadow: 0 0 0 3px var(--paper); }
.tl-major .tl-date { color: var(--accent); font-size: 0.85rem; }
.tl-major .tl-text { font-size: 1.02rem; font-weight: 600; }

/* Places index: dot, name and one line of description as one button; the chapters that mention it as links below. */
.places-order { margin: 0.25rem 1rem 0.5rem; font-size: 0.8rem; }
.pi-list { list-style: none; margin: 0; padding: 0 0.5rem 0.75rem; }
.pi-group .toc-part-title { margin: 0.75rem 0 0; }
.pi-item { padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }
.pi-place { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "dot name far" ". desc desc"; align-items: center; gap: 0.1rem 0.5rem; width: 100%; padding: 0.4rem 0.6rem; border-radius: calc(var(--radius-m) - 0.5rem); text-align: start; }
.pi-place:hover, .pi-place:focus-visible { background: var(--mat); }
.pi-place i { grid-area: dot; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--place); }
.pi-name { grid-area: name; font-weight: 600; }
.pi-far { grid-area: far; font-size: 0.72rem; color: var(--muted); }
.pi-desc { grid-area: desc; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.82rem; color: var(--soft); }
.pi-chapters { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; padding: 0.15rem 0.6rem 0.25rem; padding-inline-start: 1.8rem; font-size: 0.8rem; }
.pi-chapters a { color: var(--accent); min-height: 1.5rem; display: inline-flex; align-items: center; }
/* Footnote and glossary popovers. */
.note-pop { position: fixed; inset: auto; margin: 0; box-sizing: border-box; width: min(24rem, calc(100vw - 1.5rem)); max-height: min(60vh, 26rem); overflow: auto; padding: 0.9rem 1rem; padding-inline-end: 3rem; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 0.9rem; line-height: 1.55; box-shadow: 0 16px 40px rgb(0 0 0 / 0.22); }
.note-pop p { margin: 0.3rem 0 0; }
.note-pop strong { display: block; font-size: 1rem; }
.pop-go { position: absolute; top: 0.6rem; inset-inline-end: 0.6rem; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--radius-pill); color: var(--accent); }
.pop-go:hover { background: var(--mat); }
.pop-go svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.book a[role="doc-noteref"] { padding: 0 0.15em; text-decoration: none; }
/* Glossary terms: a quiet dotted underline; the first use in each chapter. */
.book button.term { padding: 0.1rem 0; min-height: 1.5rem; font: inherit; color: inherit; text-decoration: underline dotted color-mix(in srgb, var(--accent) 70%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 0.25em; cursor: help; }
.book button.term:hover { text-decoration-style: solid; }
.book a.crosslink { color: var(--accent); }
/* Popovers and the e-reader menu grow from their trigger's side (html.motion only). */
.motion :is(.note-pop, .menu):popover-open { animation: pop-in var(--dur-base) var(--ease-out); transform-origin: top center; }
/* Interactive explainers inside printed figures (72-explorables.js and the 7N-explorable-*.js drawings).
   Colours: the site tokens and the cover palette in books/eli-raz/AGENTS-BRIEF.md (cliff #916c43, sand #bc9f73,
   sea #0e4840, teal #2b7f86, light sand #e6cfa6). The drawings read the --xp-* tokens below from a canvas, so each
   is a plain colour (no var() or color-mix()). Labels in drawings have a paper halo: AA contrast on any fill. */
:root {
  --xp-sky-top: #fbf8f2; --xp-sky: #f1ebe0;
  --xp-land: #ead6b0; --xp-land-deep: #d9bd8c; --xp-land-edge: #916c43; --xp-cap: #a88459;
  --xp-salt: #fdfcf9; --xp-salt-shade: #e7e1d6; --xp-salt-edge: #8a8274;
  --xp-fresh: #d3e8e8; --xp-fresh-deep: #b5d6d7; --xp-fresh-ink: #1d6a71; --xp-surface: #b9d6d3;
  --xp-brine: #a9c4bf; --xp-lake: #5e9893; --xp-lake-deep: #2f6a64; --xp-brine-ink: #8f3f22;
  --xp-void: #241f1a;
  --xp-plate-a: #ead6b0; --xp-plate-a-deep: #dcc293; --xp-plate-b: #dcc6a0; --xp-plate-b-deep: #c9ae7f;
  --xp-basin: #0e4840; --xp-basin-light: #1f6a61; --xp-copper: #3f8f6a; --xp-copper-edge: #2c6a4e;
  --xp-dot: rgb(60 40 20 / 0.08); --xp-shadow: rgb(40 25 10 / 0.22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --xp-sky-top: #1b1a18; --xp-sky: #161514;
    --xp-land: #4d3f2c; --xp-land-deep: #3a2f21; --xp-land-edge: #bc9f73; --xp-cap: #8a6c48;
    --xp-salt: #e4ded3; --xp-salt-shade: #b9b1a3; --xp-salt-edge: #f3ede3;
    --xp-fresh: #1e3a3d; --xp-fresh-deep: #18302f; --xp-fresh-ink: #7cc9cf; --xp-surface: #5fa6ad;
    --xp-brine: #23423e; --xp-lake: #2f8088; --xp-lake-deep: #1d5a5f; --xp-brine-ink: #e3a07c;
    --xp-void: #050404;
    --xp-plate-a: #4d3f2c; --xp-plate-a-deep: #3f3324; --xp-plate-b: #42372a; --xp-plate-b-deep: #352c21;
    --xp-basin: #1f6f76; --xp-basin-light: #2b8a92; --xp-copper: #5fb98d; --xp-copper-edge: #8fd6b1;
    --xp-dot: rgb(255 240 220 / 0.05); --xp-shadow: rgb(0 0 0 / 0.45);
  }
}
:root[data-theme="dark"] {
  --xp-sky-top: #1b1a18; --xp-sky: #161514;
  --xp-land: #4d3f2c; --xp-land-deep: #3a2f21; --xp-land-edge: #bc9f73; --xp-cap: #8a6c48;
  --xp-salt: #e4ded3; --xp-salt-shade: #b9b1a3; --xp-salt-edge: #f3ede3;
  --xp-fresh: #1e3a3d; --xp-fresh-deep: #18302f; --xp-fresh-ink: #7cc9cf; --xp-surface: #5fa6ad;
  --xp-brine: #23423e; --xp-lake: #2f8088; --xp-lake-deep: #1d5a5f; --xp-brine-ink: #e3a07c;
  --xp-void: #050404;
  --xp-plate-a: #4d3f2c; --xp-plate-a-deep: #3f3324; --xp-plate-b: #42372a; --xp-plate-b-deep: #352c21;
  --xp-basin: #1f6f76; --xp-basin-light: #2b8a92; --xp-copper: #5fb98d; --xp-copper-edge: #8fd6b1;
  --xp-dot: rgb(255 240 220 / 0.05); --xp-shadow: rgb(0 0 0 / 0.45);
}

/* Frame: a card with the title, the drawing, the control and the explanation. */
.book figure.has-explorable { max-width: 48rem; margin-inline: auto; }
.book figure.has-explorable > img { margin-inline: auto; }
.explorable {
  font-family: var(--sans); padding: clamp(0.9rem, 3vw, 1.4rem);
  border: 1px solid var(--rule); border-radius: 18px; background: var(--paper);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 18px 40px -26px var(--xp-shadow);
  contain: content; /* Changes inside the card do not lay out or paint the rest of the book. */
}
@media (max-width: 40rem) { .book figure.has-explorable > :is(.explorable, .view-toggle) { margin-inline: 0.75rem; } }
.xp-head { margin-bottom: 0.8rem; }
.xp-title { margin: 0; font-weight: 700; font-size: 1.05rem; line-height: 1.35; }
.xp-instruction { margin: 0.25rem 0 0; color: var(--soft); font-size: 0.85rem; line-height: 1.5; }
.xp-stage {
  position: relative; -webkit-touch-callout: none; border-radius: 12px; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent);
}
.explorable[data-kind="transform"] .xp-stage { max-width: 22rem; margin-inline: auto; }
.xp-canvas { display: block; width: 100%; height: 100%; }
/* Overlays: pre-drawn canvases and labels that move by transform and opacity only (compositor work, no repaint). */
.xp-layer { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.xp-tag {
  font: 600 13px/1 var(--sans); color: var(--ink); white-space: nowrap; direction: rtl; will-change: transform, opacity;
  text-shadow: 0 0 2px var(--paper), 0 0 2px var(--paper), 0 0 3px var(--paper), 0 0 3px var(--paper);
}

/* Handle: a 48 px touch target, moved only by transform. The page does not scroll while it is dragged. */
.xp-handle {
  position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; display: grid; place-items: center;
  cursor: grab; touch-action: none; will-change: transform;
}
.xp-grip, .xp-grip-ring { grid-area: 1 / 1; width: 26px; height: 26px; border-radius: 50%; box-sizing: border-box; }
.xp-grip {
  display: block; background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 0 2px 6px var(--xp-shadow);
  transition: transform var(--dur-quick) var(--ease-out), border-color var(--dur-quick) var(--ease-out);
}
.xp-grip svg { width: 100%; height: 100%; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.xp-handle:hover .xp-grip, .dragging .xp-grip { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 2px 6px var(--xp-shadow); transform: scale(1.08); }
.dragging .xp-handle { cursor: grabbing; }
.xp-grip-ring { border: 2px solid var(--accent); opacity: 0; }
.hinting .xp-grip-ring { animation: xp-ring 1.1s ease-out 2; }
@keyframes xp-ring { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(2.3); } }

/* Control: label and value, a styled range with marks, and a reset button. */
.xp-controls { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 0.2rem 0.9rem; margin-top: 1rem; }
.xp-control-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.2rem 0.75rem; }
.xp-label-text { font-weight: 700; font-size: 0.85rem; }
/* The value line never moves: each part has a fixed-width slot (set from the longest value), the digits are
   tabular, and the number is isolated from the Hebrew around it. */
.xp-output { font-size: 0.85rem; color: var(--soft); white-space: nowrap; }
.xp-output > * { display: inline-block; }
.xp-num { font-variant-numeric: tabular-nums; text-align: right; unicode-bidi: isolate; font-weight: 700; color: var(--ink); }
.xp-note { text-align: start; }
.xp-track { position: relative; min-width: 0; }
.xp-range { display: block; width: 100%; height: 2.75rem; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
/* The rail and the fill sit under a transparent track; the fill moves by transform only. 14px: half the thumb. */
.xp-rail, .xp-fill { position: absolute; left: 14px; right: 14px; top: calc(1.375rem - 3px); height: 6px; border-radius: 3px; pointer-events: none; }
.xp-rail { background: var(--rule); }
.xp-fill { background: var(--accent); transform-origin: left center; transform: scaleX(0); will-change: transform; }
.xp-range { position: relative; }
.xp-range::-webkit-slider-runnable-track { height: 6px; background: transparent; }
.xp-range::-moz-range-track { height: 6px; background: transparent; }
.xp-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--accent); box-shadow: 0 2px 6px var(--xp-shadow);
}
.xp-range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); box-shadow: 0 2px 6px var(--xp-shadow); }
.xp-range:focus { outline: none; }
.xp-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
.xp-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
.xp-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.xp-marks { position: relative; height: 2.75rem; margin: -0.55rem 14px 0; } /* 14px: half the thumb, so marks meet its centre. */
.xp-mark {
  position: absolute; left: calc(var(--at) * 100%); top: 0; transform: translateX(-50%);
  min-height: 2.75rem; padding: 0.35rem 0.45rem 0; font-size: 0.75rem; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.xp-mark::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 0.4rem; background: var(--muted); }
.xp-mark[data-edge="start"] { transform: none; padding-left: 0; }
.xp-mark[data-edge="start"]::before { left: 0; }
.xp-mark[data-edge="end"] { transform: translateX(-100%); padding-right: 0; }
.xp-mark[data-edge="end"]::before { left: auto; right: 0; }
.xp-mark:hover { color: var(--accent); }
.xp-reset {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.75rem; padding: 0 1rem;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); font-size: 0.85rem; font-weight: 600;
}
.xp-reset::before { content: "↺"; font-size: 1rem; line-height: 1; }
.xp-reset:hover { background: var(--mat); border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.xp-readout { font-variant-numeric: tabular-nums; margin: 0.75rem 0 0; font-size: 0.92rem; line-height: 1.65; color: var(--ink); min-height: 4.95em; }
.xp-schematic, .xp-sources { margin: 0.6rem 0 0; font-size: 0.78rem; line-height: 1.55; color: var(--muted); }
.xp-schematic { padding-top: 0.75rem; border-top: 1px solid var(--rule); }
.xp-sources a { color: inherit; }
/* Edition corrections in the text: a quiet † and, on hover or focus, a faint dotted underline under the corrected words. */
:root { --now: #1f6b71; --now-bg: color-mix(in srgb, #2b7f86 16%, transparent); --was-bg: color-mix(in srgb, var(--accent) 14%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --now: #8fd0d4; --now-bg: color-mix(in srgb, #5fb3b9 22%, transparent); } }
:root[data-theme="dark"] { --now: #8fd0d4; --now-bg: color-mix(in srgb, #5fb3b9 22%, transparent); }

.book a.edition-mark { position: relative; padding: 0 0.1em; color: var(--muted); font-weight: 400; transition: color var(--dur-quick) var(--ease-out); }
.book a.edition-mark::after { content: ""; position: absolute; inset: -0.8em -0.5em; } /* A finger-sized target around a small sign. */
.book a.edition-mark:is(:hover, :focus-visible) { color: var(--accent); }
.book span.edition-correction { text-decoration: underline dotted transparent; text-decoration-thickness: 1.5px; text-underline-offset: 0.28em; transition: text-decoration-color var(--dur-quick) var(--ease-out); }
.book span.edition-correction:is(:hover, .is-open, :has(+ .edition-mark:is(:hover, :focus-visible))) { text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); }

/* Correction popover (inside .note-pop). */
.corr-pop .corr-head { margin: 0; color: var(--ink); }
.corr-was { padding: 0 0.2em; border-radius: calc(var(--radius-s) / 2); background: var(--was-bg); text-decoration: line-through color-mix(in srgb, var(--accent) 60%, transparent); }
.corr-pop .corr-why { margin-top: 0.45rem; color: var(--soft); font-size: 0.85rem; }
.corr-pop .corr-why:empty { display: none; }
.corr-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; padding-top: 0.7rem; border-top: 1px solid var(--rule); }
.corr-actions :is(a, button) { display: inline-flex; align-items: center; min-height: 2.1rem; padding: 0 0.8rem; border-radius: var(--radius-pill); background: var(--mat); color: var(--ink); font-size: 0.82rem; font-weight: 600; text-decoration: none; transition: background-color var(--dur-quick) var(--ease-out); }
.corr-actions :is(a, button):hover { background: color-mix(in srgb, var(--accent) 14%, var(--mat)); }
.note-pop:has(.corr-pop) { padding-inline-end: 1rem; }

/* "As printed" mode: the † marks and the correction notes hide; a small banner below the bar offers the way back. */
[data-printed-text] .book :is(a.edition-mark, aside.edition-correction) { display: none; }
.printed-banner { position: fixed; z-index: 950; top: 4.4rem; inset-inline: 0; display: flex; align-items: center; gap: 0.35rem; width: fit-content; max-width: calc(100vw - 1.5rem); box-sizing: border-box; margin: 0 auto; padding: 0.3rem; padding-inline-start: 0.9rem; border: 1px solid var(--rule); border-radius: var(--radius-pill); background: color-mix(in srgb, var(--paper) 90%, transparent); color: var(--soft); font: 0.8rem/1.3 var(--sans); box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: banner-in var(--dur-slow) var(--ease-out) both; }
.printed-banner span { flex: 1 1 auto; min-width: 0; }
.printed-banner :is(button, a) { flex: none; min-height: 2rem; padding: 0 0.85rem; border-radius: var(--radius-pill); font-weight: 600; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; }
.printed-banner button { background: var(--ink); color: var(--paper); }
.printed-banner a { color: var(--accent); }
.printed-banner a:hover { background: var(--mat); }
@keyframes banner-in { from { opacity: 0; transform: translateY(-0.5rem); } }
@media (max-width: 30rem) { .printed-banner a { display: none; } }
@media print { .printed-banner { display: none; } }

/* Links to the errata page: footer and navigator. */
.footer-errata { color: var(--on-night-soft); font-size: 0.9rem; }
.toc-errata { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.2rem 1rem; margin: 0.5rem 1rem 1.25rem; padding: 0.8rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius-m); text-decoration: none; line-height: 1.4; transition: background-color var(--dur-quick) var(--ease-out); }
.toc-errata:hover, .toc-errata:focus-visible { background: var(--mat); }
.toc-errata > span:first-child::before { content: "† "; color: var(--accent); }
.toc-errata-meta { font-size: 0.8rem; color: var(--muted); }

/* Errata page */
.errata-page { font-family: var(--sans); }
.er-bar { position: sticky; top: 0; z-index: 10; padding: 0.6rem var(--gutter); background: color-mix(in srgb, var(--paper) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--rule); }
.er-back { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; padding: 0 0.9rem 0 0.7rem; padding-inline: 0.7rem 0.9rem; border-radius: var(--radius-pill); font-size: 0.9rem; font-weight: 600; text-decoration: none; transition: background-color var(--dur-quick) var(--ease-out); }
.er-back:hover { background: var(--mat); }
.er-back svg, .er-search svg, .erv-close svg { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[dir="ltr"] .er-back svg { transform: scaleX(-1); }
.er-main { max-width: 46rem; margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) var(--gutter) 5rem; }
.er-main h1 { color: var(--ink); margin: 0 0 0.75rem; font-size: clamp(2rem, 1.5rem + 2.5vw, 3.2rem); line-height: 1.1; }
.er-lede { margin: 0 0 1.5rem; font-size: 1.1rem; color: var(--accent); font-weight: 600; }
.er-intro p { margin: 0 0 1rem; font-size: 1.02rem; line-height: 1.75; color: var(--soft); text-wrap: pretty; }
.er-dagger { color: var(--accent); font-weight: 700; }

/* A switch drawn in site colors; the native checkbox stays for keyboard and screen readers. */
.er-switch { position: relative; display: flex; align-items: flex-start; gap: 0.85rem; margin: 1.5rem 0 2.5rem; padding: 0.9rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius-m); cursor: pointer; }
.er-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.er-switch-track { position: relative; flex: none; width: 2.6rem; height: 1.5rem; margin-top: 0.1rem; border-radius: var(--radius-pill); background: var(--rule); transition: background-color var(--dur-base) var(--ease-out); }
.er-switch-track::after { content: ""; position: absolute; top: 0.2rem; inset-inline-start: 0.2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform var(--dur-base) var(--ease-out); }
.er-switch input:checked + .er-switch-track { background: var(--accent); }
.er-switch input:checked + .er-switch-track::after { transform: translateX(1.1rem); }
[dir="rtl"] .er-switch input:checked + .er-switch-track::after { transform: translateX(-1.1rem); }
.er-switch input:focus-visible + .er-switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.er-switch-text { font-weight: 600; line-height: 1.4; }
.er-switch-text small { display: block; margin-top: 0.2rem; font-weight: 400; font-size: 0.82rem; color: var(--muted); }

/* Filters and search stay at hand while the list scrolls. */
.er-tools { z-index: 5; padding: 0.75rem 0 0.5rem; background: var(--paper); outline: none; }
@media (min-width: 48rem) {
  /* Full-bleed paper behind the sticky tools, without widening the page. */
  .er-tools { position: sticky; top: 3.7rem; box-shadow: 0 0 0 100vmax var(--paper), 0 1px 0 100vmax var(--rule); clip-path: inset(0 -100vmax -1px -100vmax); }
  .er-filters { flex-wrap: wrap; overflow: visible; }
} /* On phones the tools would take a third of the screen. */
.er-filters { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.5rem; scrollbar-width: none; }
@media (max-width: 48rem) { .er-filters { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); } }
.er-filter { flex: none; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.25rem; padding: 0 0.85rem; border: 1px solid var(--rule); border-radius: var(--radius-pill); font-size: 0.85rem; white-space: nowrap; transition: background-color var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out); }
.er-filter span { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.er-filter:hover { background: var(--mat); }
.er-filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.er-filter[aria-pressed="true"] span { color: inherit; opacity: 0.75; }
.er-search { position: relative; display: flex; align-items: center; }
.er-search svg { position: absolute; inset-inline-start: 0.8rem; color: var(--muted); pointer-events: none; }
.er-search input { width: 100%; box-sizing: border-box; padding: 0.65rem 1rem; padding-inline-start: 2.5rem; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--mat); color: inherit; font: inherit; font-size: 0.95rem; }
.er-search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.er-status { min-height: 1.2em; margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--muted); }

.er-section { margin-top: 2.5rem; }
.er-section h2 { color: var(--ink); display: flex; align-items: baseline; gap: 0.6rem; margin: 0 0 0.3rem; font-size: 1.35rem; }
.er-count { font-size: 0.85rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.er-about { margin: 0 0 1.1rem; font-size: 0.9rem; line-height: 1.6; color: var(--muted); }

.er-row { content-visibility: auto; contain-intrinsic-size: auto 16rem; margin: 0 0 0.85rem; padding: 1rem 1.1rem 0.9rem; border: 1px solid var(--rule); border-radius: var(--radius-m); background: color-mix(in srgb, var(--mat) 35%, var(--paper)); scroll-margin-top: 11rem; }
.er-row:target { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.er-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; margin-bottom: 0.7rem; }
.er-num { display: inline-grid; place-items: center; min-width: 1.7rem; height: 1.7rem; padding: 0 0.3rem; box-sizing: border-box; border-radius: var(--radius-pill); background: var(--mat); font-size: 0.75rem; font-weight: 700; color: var(--soft); font-variant-numeric: tabular-nums; }
.er-where { flex: 1 1 10rem; min-width: 0; font-size: 0.8rem; color: var(--muted); }
.er-tag { padding: 0.1rem 0.55rem; border-radius: var(--radius-pill); background: var(--was-bg); color: var(--accent); font-size: 0.72rem; font-weight: 700; }
.er-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.er-pill { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem; padding: 0 0.7rem; border: 1px solid var(--rule); border-radius: var(--radius-pill); background: var(--paper); font-size: 0.76rem; font-weight: 600; color: var(--soft); transition: border-color var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out); }
.er-pill::before { content: ""; width: 0.85rem; height: 0.85rem; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l4 4v14H6z'/%3E%3Cpath d='M9 11h7M9 15h7'/%3E%3C/svg%3E") center / contain no-repeat; }
.er-pill:hover { border-color: var(--accent); color: var(--accent); }
.er-line { display: flex; align-items: baseline; gap: 0.75rem; margin: 0.3rem 0; }
.er-label { flex: none; width: 3.6rem; font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.er-quote { font-size: 1.05rem; line-height: 1.55; overflow-wrap: anywhere; }
.er-row[data-status="verified"] .er-printed .er-quote { text-decoration: line-through color-mix(in srgb, var(--accent) 55%, transparent); color: var(--soft); }
.er-fixed .er-quote { padding: 0 0.25em; border-radius: calc(var(--radius-s) / 2); background: var(--now-bg); }
.er-why { margin: 0.75rem 0 0.4rem; font-size: 0.95rem; line-height: 1.65; text-wrap: pretty; }
.er-evidence { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin: 0.25rem 0 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--muted); }
.er-evidence a { color: var(--accent); overflow-wrap: anywhere; }
.er-foot { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.er-go { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.1rem; padding: 0 0.85rem; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font-size: 0.8rem; font-weight: 600; text-decoration: none; transition: transform var(--dur-quick) var(--ease-out); }
.er-go:hover { transform: translateY(-1px); }
.er-go::after { content: "←"; }
[dir="ltr"] .er-go::after { content: "→"; }
.er-empty { margin: 3rem 0; text-align: center; color: var(--muted); }
.er-note { margin-top: 3rem; font-size: 0.8rem; color: var(--muted); }

/* Viewer: the print image beside our text; stacked on phones. */
.er-viewer { width: min(80rem, calc(100vw - 2rem)); height: min(52rem, calc(100dvh - 2rem)); max-width: none; max-height: none; padding: 0; border: 0; border-radius: var(--radius-m); box-shadow: 0 30px 80px rgb(0 0 0 / 0.35); overflow: hidden; }
.er-viewer[open] { display: flex; flex-direction: column; animation: viewer-in var(--dur-base) var(--ease-out); }
.er-viewer[open]::backdrop { animation: fade-in var(--dur-base) var(--ease-out); }
@keyframes viewer-in { from { opacity: 0; transform: translateY(0.75rem) scale(0.985); } }
@keyframes fade-in { from { opacity: 0; } }
.erv-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; padding-inline-start: 1rem; border-bottom: 1px solid var(--rule); }
.erv-tabs { display: flex; flex: 1; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; }
.erv-tab { flex: none; min-height: 2.25rem; padding: 0 0.9rem; border-radius: var(--radius-pill); font-size: 0.85rem; font-weight: 600; color: var(--soft); transition: background-color var(--dur-quick) var(--ease-out); }
.erv-tab:hover { background: var(--mat); }
.erv-tab[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.erv-close { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-pill); }
.erv-close:hover { background: var(--mat); }
.erv-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.erv-image { position: relative; overflow: auto; overscroll-behavior: contain; display: grid; place-items: center; padding: 1rem; background: color-mix(in srgb, var(--ink) 7%, var(--paper)); }
.erv-image img { display: block; max-width: 100%; max-height: 100%; border-radius: calc(var(--radius-s) / 2); box-shadow: 0 4px 18px rgb(0 0 0 / 0.16); opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.erv-image.ready img { opacity: 1; }
.erv-image[data-kind="line"] img { width: max(100%, 820px); max-width: none; max-height: none; height: auto; }
.erv-image[data-kind="line"] { place-items: center start; }
.erv-image[data-kind="page"] img { cursor: zoom-in; }
.erv-image[data-kind="page"] { place-items: start center; }
.erv-image[data-kind="page"]:not(.zoomed) { place-items: center; }
.erv-image.zoomed { display: block; padding: 0; }
.erv-image.zoomed img { max-width: none; max-height: none; height: auto; border-radius: 0; cursor: zoom-out; }
.erv-text { overflow-y: auto; overscroll-behavior: contain; padding: 1.25rem 1.5rem 2rem; border-inline-start: 1px solid var(--rule); }
.erv-row { margin: 0 0 1rem; font-size: 0.8rem; color: var(--muted); }
.cmp-label { margin: 1.1rem 0 0.3rem; font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.cmp-label:first-of-type { margin-top: 0; }
.cmp-text { margin: 0; font-size: 1rem; line-height: 1.8; text-align: start; }
.cmp-text mark { padding: 0 0.15em; border-radius: calc(var(--radius-s) / 2); background: color-mix(in srgb, #bc9f73 38%, transparent); color: inherit; }
.cmp-text mark.was { background: var(--was-bg); text-decoration: line-through color-mix(in srgb, var(--accent) 60%, transparent); }
.cmp-text mark.now { background: var(--now-bg); }
@media (max-width: 48rem) {
  .er-viewer { width: 100vw; height: 100dvh; border-radius: 0; }
  .erv-body { grid-template-columns: 1fr; grid-template-rows: minmax(12rem, 46%) minmax(0, 1fr); }
  .erv-body:has(> .erv-image[data-kind="line"]) { grid-template-rows: auto minmax(0, 1fr); }
  .erv-text { border-inline-start: 0; border-top: 1px solid var(--rule); }
}
@media print { .er-bar, .er-tools, .er-switch, .er-pills, .er-foot { display: none; } }
/* Maps inside printed figures (75-map-figures.js): figure maps and the then-and-now view. */
/* Line slots: the first three colours of the dataviz reference palette, validated for colour-blind readers as a set
   in light and dark mode (all pairs). Each slot also has its own dash, and the legend names every line. */
:root { --line-1: #2a78d6; --line-2: #eb6834; --line-3: #1baf7a; --area: #8f3f22; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --line-1: #3987e5; --line-2: #d95926; --line-3: #199e70; --area: #e3a07c; } }
:root[data-theme="dark"] { --line-1: #3987e5; --line-2: #d95926; --line-3: #199e70; --area: #e3a07c; }

.book figure.has-map { max-width: 48rem; margin-inline: auto; }
.book figure.has-map > img { margin-inline: auto; }
.map-figure { font-family: var(--sans); }
.mf-title { margin: 0 0 0.5rem; font-weight: 700; font-size: 1rem; }
.mf-map, .tn-stage { box-sizing: border-box; position: relative; z-index: 0; isolation: isolate; width: 100%; max-height: min(80vh, 44rem); min-height: 18rem; border: 1px solid var(--rule); border-radius: var(--radius-m); overflow: hidden; direction: ltr; background: var(--mat); }
.tn-map { position: absolute; inset: 0; }

/* Lines on a paper halo, so they read on any tile. */
path.mf-line { fill: none; stroke-width: 3.5px; stroke-linecap: round; stroke-linejoin: round; }
path.mf-line-halo { fill: none; stroke: var(--halo); stroke-opacity: 0.85; stroke-width: 7.5px; stroke-linecap: round; stroke-linejoin: round; }
path.mf-line.slot-1 { stroke: var(--line-1); }
path.mf-line.slot-2 { stroke: var(--line-2); stroke-dasharray: 9 6; }
path.mf-line.slot-3 { stroke: var(--line-3); stroke-dasharray: 1 6.5; stroke-width: 4.5px; }
.mf-area { fill: var(--area); fill-opacity: 0.12; stroke: var(--area); stroke-width: 2px; stroke-dasharray: 5 4; }
.mf-area-label.leaflet-tooltip { padding: 0; border: 0; background: none; box-shadow: none; color: var(--ink); font: 600 12.5px/1.3 var(--sans); text-shadow: 0 0 2px var(--halo), 0 0 3px var(--halo), 0 0 5px var(--halo); }
.mf-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin: 0.6rem 0 0; padding: 0; list-style: none; font-size: 0.85rem; color: var(--soft); }
.mf-legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.mf-legend svg { width: 1.75rem; height: 0.75rem; flex: none; overflow: visible; }
.mf-legend path.mf-line { stroke-width: 3px; }
.mf-card { display: grid; gap: 0.15rem; padding: 0.6rem 0.9rem 0.65rem 2.6rem; font-size: 0.875rem; text-align: start; }
.map-box.leaflet-container .mf-card a { color: var(--accent); }

/* Then and now. */
.tn-modes { margin: 0 0 0.6rem; }
.tn-stage.side { aspect-ratio: auto !important; height: min(80vh, 44rem); max-height: none; border: 0; border-radius: 0; overflow: visible; background: none; }
.tn-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; height: 100%; direction: rtl; }
.tn-pane { display: grid; grid-template-rows: auto 1fr auto; gap: 0.35rem; min-width: 0; }
.tn-pane .tn-map { box-sizing: border-box; position: relative; inset: auto; border: 1px solid var(--rule); border-radius: var(--radius-m); overflow: hidden; }
.tn-pick { display: flex; justify-content: space-between; gap: 2px; padding: 3px; border: 1px solid var(--rule); border-radius: var(--radius-pill); }
.tn-pick button, .tn-stops button { min-height: 2.5rem; padding: 0 0.5rem; border-radius: var(--radius-pill); color: var(--muted); font-weight: 600; font-size: 0.9rem; font-variant-numeric: tabular-nums; transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.tn-pick button { flex: 1; min-height: 2.25rem; font-size: 0.85rem; }
.tn-pane-notes .tn-level { font-size: 0.8rem; }
.tn-layer { transition: none; will-change: opacity; } /* Opacity follows the time control frame by frame, on the compositor. */
.tn-loading { position: absolute; z-index: 1001; top: 10px; left: 50%; translate: -50% 0; margin: 0; padding: 0.3rem 0.8rem; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--paper) 94%, transparent); color: var(--ink); font-size: 0.8rem; box-shadow: var(--map-shadow); direction: rtl; }

/* Time control: a range with the years under it; the years are buttons that glide to their layer. */
.tn-time { margin-top: 0.75rem; }
.tn-time input[type="range"] { display: block; width: 100%; min-height: 2.75rem; margin: 0; accent-color: var(--accent); }
.tn-stops { display: flex; justify-content: space-between; margin-top: -0.35rem; }
.tn-stops button { min-width: 3.25rem; }
:is(.tn-stops, .tn-pick) button:hover { background: var(--mat); color: var(--ink); }
:is(.tn-stops, .tn-pick) button[aria-pressed="true"] { color: var(--paper); background: var(--ink); }
.tn-readout { margin-top: 0.4rem; min-height: 6.5em; }
.tn-level { margin: 0; font-size: 0.9rem; line-height: 1.6; }
.tn-credit { margin: 0.3rem 0 0; font-size: 0.75rem; line-height: 1.45; color: var(--muted); text-align: left; }
:is(.tn-level, .tn-credit) a { color: inherit; }

/* Phones: inline figures run edge to edge (02-book.css), so the map does too and the text keeps the page gutter. */
@media (max-width: 40rem) {
  .book figure.has-map > .view-toggle { margin-inline: var(--gutter); }
  .map-figure > :not(.mf-map, .tn-stage) { margin-inline: var(--gutter); }
  .mf-map, .tn-stage:not(.side) { border-inline: 0; border-radius: 0; }
  .tn-stage.side { padding-inline: 0.5rem; }
}
/* Continue reading: a quiet pill at the bottom of the screen. */
.resume { position: fixed; inset-inline: 0; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 900; display: flex; width: fit-content; max-width: calc(100vw - 2rem); margin: 0 auto; align-items: center; border-radius: var(--radius-pill); background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 0.9rem; box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); }
.resume a { padding: 0.65rem 1.1rem; padding-inline-end: 0.4rem; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume button { width: 2.5rem; height: 2.5rem; border-radius: var(--radius-pill); color: inherit; font-size: 1.2rem; }
@media print { .resume, .note-pop { display: none; } }
.resume { transition: opacity var(--dur-slow) var(--ease); }
.resume.leaving { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .resume { transition: none; } }
/* Back chip: a quiet pill at the bottom of the screen, like the continue-reading pill. */
.back-chip { position: fixed; inset-inline: 0; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 900; display: flex; align-items: center; gap: 0.5rem; width: fit-content; max-width: calc(100vw - 2rem); margin: 0 auto; padding: 0.6rem 1.1rem; border-radius: var(--radius-pill); background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 0.9rem; box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); }
.back-chip .back-arrow { width: 1rem; height: 1rem; flex: none; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14m0 0-6-6m6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; }
[dir="ltr"] .back-chip .back-arrow { transform: scaleX(-1); }
.back-chip:focus-visible { outline-color: var(--accent); }
@media print { .back-chip { display: none; } }
.back-chip .back-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Chapter rail on the inline-start edge: a thin track with a mark per chapter (longer for parts), the current one in
   the accent. A wide invisible strip makes it easy to catch with a finger. */
.rail { position: fixed; z-index: 950; top: 5rem; bottom: 2rem; inset-inline-start: 0; width: 2.25rem; touch-action: none; cursor: ns-resize; }
.rail-track { position: absolute; inset-block: 0; inset-inline-start: 0.5rem; width: 0.5rem; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--paper) 85%, transparent); box-shadow: 0 0 0 1px var(--rule); }
.rail-track i { position: absolute; inset-inline-start: 0.1rem; width: 0.3rem; height: 2px; background: var(--muted); }
.rail-track i.part { inset-inline-start: 0; width: 0.5rem; background: var(--ink); }
.rail-track i.current { inset-inline-start: -0.2rem; width: 0.9rem; height: 3px; background: var(--accent); }
.rail-label { position: absolute; inset-inline-start: 1.6rem; translate: 0 -50%; max-width: min(18rem, 70vw); padding: 0.35rem 0.75rem; border-radius: var(--radius-s); background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
@media print { .rail { display: none; } }
/* Languages: the chapter switch, the element chip and the reading mode button with its menu. */

/* Chapter switch: a small segmented control above the chapter title, with the machine translation note. */
.lang-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin: 0 0 1.25rem; font-family: var(--sans); font-size: 0.8rem; line-height: 1.2; }
.lang-switch { position: relative; isolation: isolate; display: inline-grid; grid-template-columns: repeat(var(--count, 2), 1fr); padding: 3px; border-radius: var(--radius-pill); background: var(--mat); box-shadow: inset 0 0 0 1px var(--rule); }
.lang-switch::before {
  content: ""; position: absolute; z-index: -1; inset-block: 3px; inset-inline-start: 3px;
  width: calc((100% - 6px) / var(--count, 2)); border-radius: var(--radius-pill); background: var(--ink);
  translate: calc(var(--at, 0) * 100%) 0; transition: translate var(--dur) var(--ease);
}
.lang-switch:dir(rtl)::before { translate: calc(var(--at, 0) * -100%) 0; }
.lang-switch button { min-height: 2rem; padding: 0.3rem 0.85rem; border-radius: var(--radius-pill); color: var(--soft); font-weight: 600; transition: color var(--dur) var(--ease); }
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] { color: var(--paper); }
.lang-note { color: var(--muted); animation: lang-in var(--dur) var(--ease); }
@keyframes lang-in { from { opacity: 0; } }

/* An element the reader switched alone: a thin line beside it, so mixed languages stay visible. */
.book .lang-single { position: relative; }
.book .lang-single::before { content: ""; position: absolute; inset-block: 0.3em; inset-inline-start: -0.85rem; width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 60%, transparent); }
.book figure.lang-single::before { inset-block: auto 0; height: 3em; }

/* Element chip. */
.lang-chip {
  position: absolute; z-index: 800; padding: 0.2rem 0.65rem; min-height: 1.75rem; border-radius: var(--radius-pill);
  border: 1px solid var(--rule); background: var(--paper); color: var(--accent); font-family: var(--sans); font-size: 0.75rem; font-weight: 600; line-height: 1.2;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.1); opacity: 0; scale: 0.92;
  transition: opacity var(--dur-fast) var(--ease), scale var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.lang-chip.shown { opacity: 1; scale: 1; }
.lang-chip:hover { background: var(--mat); }
/* Narrow screen: a pill at the bottom of the screen; the element it acts on gets a soft mat. */
.lang-chip.docked {
  position: fixed; inset-inline: 0; bottom: max(1rem, env(safe-area-inset-bottom)); width: fit-content; margin: 0 auto;
  min-height: 2.75rem; padding: 0.6rem 1.2rem; border: 0; background: var(--ink); color: var(--paper); font-size: 0.9rem;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); scale: 1; translate: 0 0.5rem;
  transition: opacity var(--dur) var(--ease), translate var(--dur) var(--ease);
}
.lang-chip.docked.shown { translate: 0 0; }
.lang-chip.docked:hover { background: var(--ink); }
.book .lang-target { border-radius: var(--radius-s); background: var(--mat); box-shadow: 0 0 0 0.5rem var(--mat); transition: background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
@media (prefers-reduced-motion: reduce) { .lang-chip, .lang-chip.docked { scale: 1; translate: none; } }

/* Reading mode button: small, on the side, after the cover. It moves up while a note sits at the bottom. */
.lang-fab {
  position: fixed; z-index: 890; inset-inline-end: max(1rem, env(safe-area-inset-left)); bottom: max(1rem, env(safe-area-inset-bottom));
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--radius-pill);
  border: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 92%, transparent); color: var(--ink);
  backdrop-filter: blur(12px) saturate(1.3); -webkit-backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.12); font-family: var(--sans);
  opacity: 0; visibility: hidden; translate: 0 0.5rem;
  transition: opacity var(--dur) var(--ease), translate var(--dur) var(--ease), visibility var(--dur), background-color var(--dur-fast) var(--ease);
}
.lang-fab[data-shown] { opacity: 1; visibility: visible; translate: 0 0; }
body:has(.resume:not(.leaving), .toast.shown, .back-chip:not([hidden])) .lang-fab[data-shown] { translate: 0 -3.5rem; }
body:has(.resume:not(.leaving), .back-chip:not([hidden])) .lang-chip.docked { bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 3.5rem); }
.lang-fab[data-shown][data-tucked] { opacity: 0; visibility: hidden; translate: 0 1rem; }
.lang-fab:hover { background: var(--mat); }
.lang-glyph { position: relative; width: 1.5rem; height: 1.5rem; font-weight: 700; line-height: 1; }
.lang-glyph::before, .lang-glyph::after { position: absolute; }
.lang-glyph::before { content: "א" / ""; top: 0; inset-inline-start: 0; font-size: 1rem; }
.lang-glyph::after { content: "A" / ""; bottom: 0; inset-inline-end: 0; font-size: 0.8rem; color: var(--muted); }
.lang-fab[data-active]::after { content: ""; position: absolute; top: 0.3rem; inset-inline-end: 0.3rem; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); }
@media (prefers-reduced-motion: reduce) { .lang-fab, .lang-fab[data-shown], .lang-fab[data-shown][data-tucked], body:has(.resume:not(.leaving), .toast.shown, .back-chip:not([hidden])) .lang-fab[data-shown] { translate: none; } }
@media print { .lang-fab, .lang-chip, .lang-bar { display: none; } }

/* Reading mode menu (a popover, styled like the e-reader menu). */
.lang-menu { width: min(21rem, calc(100vw - 2rem)); }
.lang-modes { display: grid; gap: 2px; }
.lang-modes button { display: grid; gap: 0.15rem; padding: 0.55rem 0.6rem; padding-inline-start: 2.1rem; position: relative; border-radius: calc(var(--radius-m) - 0.75rem); /* Inside the menu's 0.75rem padding. */ text-align: start; }
.lang-modes button:hover, .lang-modes button:focus-visible { background: var(--mat); outline: none; }
.lang-modes button::before { content: ""; position: absolute; inset-inline-start: 0.65rem; top: 0.8rem; width: 0.85rem; height: 0.85rem; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--muted); transition: border-width var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.lang-modes button[aria-checked="true"]::before { border: 0.28rem solid var(--accent); }
.lang-mode-title { font-weight: 600; }
/* Lines in the other direction sit at the same edge as the others. */
.lang-modes button:dir(rtl) > [dir="ltr"] { text-align: right; }
.lang-modes button:dir(ltr) > [dir="rtl"] { text-align: left; }
.lang-menu ul { margin-top: 0.5rem; }

/* Cross-fade of a language swap (85-languages.js). */
:root.lang-swap::view-transition-old(root), :root.lang-swap::view-transition-new(root) { animation-duration: var(--dur); animation-timing-function: var(--ease); }
.lang-menu ul a { flex-direction: column; align-items: stretch; gap: 0.15rem; }
/* A short status note at the bottom of the screen (offline saving). */
.toast {
  position: fixed; inset-inline: 0; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 950;
  width: fit-content; max-width: calc(100vw - 2rem); margin: 0 auto; box-sizing: border-box;
  padding: 0.65rem 1.1rem; border-radius: var(--radius-pill); background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-size: 0.9rem; line-height: 1.4; box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  opacity: 0; transform: translateY(0.5rem);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.shown { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .toast { transform: none; } }
@media print { .toast { display: none; } }
