/* Targuma web — "Classical" design system (design_handoff_prismshelf).
   Editorial, book-like: near-white ground, hairline rules, color as stroke
   not fill, outlined buttons (never solid-filled), bordered unfilled cards,
   whisper shadows. Headings: Cormorant Garamond; body: Lora. Both lack
   Ethiopic glyphs, so Noto Serif Ethiopic (self-hosted) always follows them
   in the stack — Amharic renders in Noto seamlessly. Self-hosted fonts only:
   no CDN, no runtime third-party requests. */

/* ---------- fonts ---------- */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("/static/fonts/CormorantGaramond-Variable.woff2") format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/static/fonts/CormorantGaramond-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/static/fonts/Lora-Variable.woff2") format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/static/fonts/Lora-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Noto Serif Ethiopic";
  src: url("/fonts/NotoSerifEthiopic-Regular.ttf");
  font-weight: normal; font-style: normal;
}
@font-face {
  font-family: "Noto Serif Ethiopic";
  src: url("/fonts/NotoSerifEthiopic-Bold.ttf");
  font-weight: bold; font-style: normal;
}
@font-face {
  font-family: "Noto Serif";
  src: url("/fonts/NotoSerif-Regular.ttf");
  font-weight: normal; font-style: normal;
}
@font-face {
  font-family: "Noto Serif";
  src: url("/fonts/NotoSerif-Bold.ttf");
  font-weight: bold; font-style: normal;
}
@font-face {
  font-family: "Noto Serif";
  src: url("/fonts/NotoSerif-Italic.ttf");
  font-weight: normal; font-style: italic;
}

/* ---------- tokens ----------
   Same custom-property names as before (pages and inline styles depend on
   them); values come from classical.css. */
:root {
  color-scheme: light;
  --bg: #f3f2f2;
  --surface: #eae9e9;
  --text: #201f1d;
  --muted: color-mix(in srgb, #201f1d 55%, transparent);
  --accent: #b68235;
  --border: color-mix(in srgb, #201f1d 16%, transparent);
  --shadow: color-mix(in srgb, #2d2b2b 16%, transparent);

  --neutral-100: #f8f4f4;
  --neutral-200: #eae7e7;
  --neutral-300: #d7d3d3;
  --neutral-600: #7d7979;
  --neutral-700: #605d5d;
  --neutral-900: #2d2b2b;
  --accent-100: #fff3e4;
  --accent-700: #7d5411;
  --accent-800: #5a3b0a;
  --accent-tint: color-mix(in srgb, var(--accent) 12%, transparent);

  /* Status hues (paid/pending/failed need three distinguishable strokes;
     kept quiet and ink-adjacent — always stroke, never fill). */
  --ok: #4c7a50;
  --warn: #a04432;
  --gold: var(--accent); /* legacy alias, kept for older rules */

  --font-heading: "Cormorant Garamond", "Noto Serif Ethiopic", serif;
  --font-body: "Lora", "Noto Serif Ethiopic", "Noto Serif", serif;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 7px;
  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1917;
  --surface: #26231f;
  --text: #ddd8ce;
  --muted: color-mix(in srgb, #ddd8ce 55%, transparent);
  --accent: #e1ad66;
  --border: rgba(221, 216, 206, 0.16);
  --shadow: rgba(0, 0, 0, 0.45);
  --neutral-100: #26231f;
  --neutral-200: #2e2a26;
  --neutral-300: #3a3630;
  --neutral-600: #a09a8f;
  --neutral-700: #bdb7ab;
  --neutral-900: #eae6dd;
  --accent-100: rgba(182, 130, 53, 0.16);
  --accent-700: #dcac63;
  --accent-800: #e8c68f;
  --ok: #7fae83;
  --warn: #cf7a63;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 3px 10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1b1917;
    --surface: #26231f;
    --text: #ddd8ce;
    --muted: color-mix(in srgb, #ddd8ce 55%, transparent);
    --accent: #e1ad66;
    --border: rgba(221, 216, 206, 0.16);
    --shadow: rgba(0, 0, 0, 0.45);
    --neutral-100: #26231f;
    --neutral-200: #2e2a26;
    --neutral-300: #3a3630;
    --neutral-600: #a09a8f;
    --neutral-700: #bdb7ab;
    --neutral-900: #eae6dd;
    --accent-100: rgba(182, 130, 53, 0.16);
    --accent-700: #dcac63;
    --accent-800: #e8c68f;
    --ok: #7fae83;
    --warn: #cf7a63;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 3px 10px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* survives display:grid/flex rules */
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  transition: background 0.3s, color 0.3s;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
}
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--accent-700); }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 250–300ms fade + 6px rise on screen entry (cheap, CSS-only). */
@keyframes vfade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.reader-main, .library, .panel, .store-grid, .book-hero,
.auth-card, .legal-page, .store-hero { animation: vfade 0.3s ease; }
@media (prefers-reduced-motion: reduce) {
  .reader-main, .library, .panel, .store-grid, .book-hero,
  .auth-card, .legal-page, .store-hero { animation: none; }
}

/* Outlined buttons — never solid-filled. Hover = tint, active = deeper. */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-heading); font-weight: 600; font-size: 14px;
  line-height: 1.2; cursor: pointer;
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 8px 17px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
button:active { background: color-mix(in srgb, var(--text) 14%, transparent); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary {
  background: transparent; color: var(--accent); border-color: var(--accent);
}
button.primary:hover { background: var(--accent-tint); }
button.primary:active { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.75rem 1.4rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
.topbar .title {
  flex: 1; font-family: var(--font-heading); font-weight: 600; font-size: 19px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar button { padding: 5px 12px; font-size: 13px; min-height: 32px; }

/* ---------- login ---------- */
.auth-card {
  max-width: 23rem; margin: 14vh auto; padding: 27.6px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.auth-card h1 { margin: 0 0 1.2rem 0; font-size: 25px; font-weight: 600; }
.auth-card label { display: block; font-size: 12px; color: var(--muted); margin-top: 0.9rem; }
.auth-card input {
  width: 100%; min-height: 36px; padding: 6px 10px; margin-top: 0.25rem;
  font-family: var(--font-body); font-size: 14px;
  background: transparent; color: var(--text); caret-color: var(--accent);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.auth-card input:hover { border-color: color-mix(in srgb, var(--text) 45%, transparent); }
.auth-card input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.auth-card .actions { display: flex; gap: 0.6rem; margin-top: 1.4rem; }
.auth-card .actions button { flex: 1; }
.auth-error { color: var(--warn); font-size: 0.9rem; min-height: 1.4em; margin-top: 0.8rem; }

/* "Continue with Google" (auth sprint): GIS renders the button itself;
   we own the centering, the consent line, and the or-divider. */
#google-signin { display: flex; justify-content: center; min-height: 44px; }
/* "Sign in with Apple": Apple's JS paints its own button (black on light
   pages, white on dark — the login page picks the colour before painting)
   at Google's width and pill shape, directly under it. */
#apple-box { display: flex; justify-content: center; margin-top: 0.55rem; }
#appleid-signin { width: 316px; max-width: 100%; height: 40px; }
.google-consent, .provider-consent { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 0.55rem; }
.google-consent a, .provider-consent a { color: var(--accent); }
#deleted-notice { margin: 0 0 1rem; }
.or-divider {
  display: flex; align-items: center; gap: 0.8rem;
  margin: 1.1rem 0 0.2rem; color: var(--muted); font-size: 12px;
}
.or-divider::before, .or-divider::after {
  content: ""; flex: 1; border-top: 1px solid var(--border);
}

/* ---------- library (themed table) ---------- */
.library { max-width: 60rem; margin: 0 auto; padding: 1.6rem 1.4rem 4rem; }
.lib-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lib-table th {
  text-align: left; font-family: var(--font-body); font-weight: 400;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  padding: 9.2px; border-bottom: 1px solid var(--border);
}
.lib-table td { padding: 9.2px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lib-table tbody tr:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.lib-table tr.book-card { cursor: pointer; }
.lib-table .t { font-family: var(--font-heading); font-weight: 600; font-size: 16px; }
.lib-table .a { font-style: italic; color: var(--muted); font-size: 13px; }
.lib-table .s { color: var(--muted); font-size: 12px; font-feature-settings: 'tnum'; }
.lib-table .meta .s { display: block; }
.progress-track {
  height: 2px; background: var(--neutral-300); min-width: 90px; flex: 1;
}
.progress-track .fill { height: 100%; background: var(--accent); transition: width 0.25s; }
.progress-cell { display: flex; align-items: center; gap: 10px; }
.progress-cell .pct {
  font-size: 11.5px; color: var(--muted);
  font-feature-settings: 'tnum'; white-space: nowrap;
}

/* Legacy card class: now a plain hook (grid look retired); cover cell. */
.book-card .cover {
  width: 42px; aspect-ratio: 2 / 3;
  overflow: hidden; border: 1px solid var(--border);
}
.book-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 3rem 1rem; font-style: italic; }

/* Typographic cover placeholder (Cover.dc.html): paper ground, colored
   spine band, gold rule, Cormorant title. Applies only while no cover
   image has been loaded into the tile. */
.cover { position: relative; }
.cover:not(:has(img)) {
  background: var(--neutral-100);
  border: 1px solid var(--border);
  box-shadow: inset 7px 0 0 var(--accent-800);
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
  text-align: left;
  font-family: var(--font-heading); font-weight: 400;
  color: var(--neutral-900);
  padding: 14% 11% 14% calc(11% + 7px);
  overflow: hidden;
}
.cover:not(:has(img))::before {
  content: ""; width: 26px; height: 1px; flex: none;
  background: var(--accent); margin-bottom: 12px;
}
.book-card .cover:not(:has(img)) { box-shadow: inset 3px 0 0 var(--accent-800); padding: 4px 6px 4px 9px; font-size: 7.5px; }
.book-card .cover:not(:has(img))::before { width: 10px; margin-bottom: 4px; }

/* ---------- reader ---------- */
.reader-main {
  max-width: 640px; margin: 0 auto; padding: 2.4rem 2rem 5rem;
  line-height: 1.78;
}
.reader-main h1 {
  font-weight: 400; font-size: 2em; line-height: 1.15; margin: 1rem 0 0.4rem;
}
.reader-main h1::after {
  content: ""; display: block; width: 48px; height: 1px;
  background: var(--accent); margin: 14px 0 12px;
}
.reader-main h2 { font-size: 1.35em; font-weight: 600; margin: 1.4em 0 0.6em; }
.reader-main h3 { font-size: 1.15em; font-weight: 600; margin: 1.2em 0 0.5em; }
.reader-main p { margin: 0 0 0.2em; text-indent: 1.5em; text-align: justify; }
.reader-main h1 + p, .reader-main h2 + p, .reader-main h3 + p { text-indent: 0; }
/* Author underlines (<u> in the canonical chapter XHTML): explicit, with the
   site's underline offset so Ethiopic descenders stay clear of the line. */
.reader-main u { text-decoration: underline; text-underline-offset: 3px; }

body.font-1 .reader-main { font-size: 0.95rem; }
body.font-2 .reader-main { font-size: 1.1rem; }
body.font-3 .reader-main { font-size: 1.28rem; }

/* ---------- figures (illustrated books, Sprint I-2) ----------
   The canonical <figure> block, rendered the Classical way: centered
   plate, quiet italic caption, hairline discipline — theme tokens keep it
   right in light, dark, and true black alike. */
.reader-main figure {
  margin: 1.7em auto;
  max-width: 100%;
  text-align: center;
}
.reader-main figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  cursor: zoom-in;
}
.reader-main figure img:not([src]) {
  /* Awaiting its authed bytes: a whisper of surface, no broken-image glyph. */
  display: inline-block;
  min-height: 2.5em;
  min-width: 40%;
  background: var(--surface);
  color: transparent;
}
.reader-main figcaption {
  font-size: 0.78em;
  font-style: italic;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 0.55em;
  text-align: center;
  text-indent: 0;
}

/* Click-to-zoom lightbox: the dictionary sheet's overlay manners (scrim,
   Escape or a click anywhere closes), image shown at reading size. */
.figure-lightbox {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.8rem; padding: 1.2rem;
  /* A dark room in EVERY theme (the neutral tokens invert in dark mode,
     so a token scrim would go near-white there; plates read best on ink). */
  background: rgba(20, 18, 16, 0.85);
  cursor: zoom-out;
}
.figure-lightbox img {
  max-width: min(94vw, 60rem);
  max-height: 84vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  background: #fff; /* plates keep paper-white ground even in dark themes */
}
.figure-lightbox .caption {
  max-width: min(94vw, 60rem);
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.5;
  text-align: center;
  color: #eae6dd; /* readable on the scrim in every theme */
}
body.lightbox-open { overflow: hidden; }

.chapter-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  max-width: 640px; margin: 2.5rem auto 0; padding: 0.9rem 2rem 2rem;
  border-top: 1px solid var(--border);
}
.chapter-nav button { border-color: transparent; color: var(--muted); }
.chapter-nav button:hover { color: var(--accent); background: var(--accent-tint); }

.toc-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 20;
  width: min(20rem, 85vw);
  background: var(--bg); border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  overflow-y: auto; padding: 1.2rem;
}
.toc-drawer.open { transform: translateX(0); }
.toc-drawer h2 { margin: 0.2rem 0 0.8rem; font-size: 20px; font-weight: 600; }
.toc-drawer ol { list-style: none; margin: 0; padding: 0; }
.toc-drawer li {
  padding: 0.55em 0.4em; cursor: pointer;
  border-bottom: 1px solid var(--border); font-size: 0.95rem;
}
.toc-drawer li:hover { color: var(--accent); }
.toc-drawer li.current { color: var(--accent); }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 15;
  background: color-mix(in srgb, var(--neutral-900) 50%, transparent);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }

.status-line { color: var(--muted); text-align: center; padding: 2rem; font-style: italic; }

@media (max-width: 480px) {
  .topbar { padding: 0.5rem 0.6rem; gap: 0.4rem; }
  .topbar button { padding: 0.35em 0.55em; font-size: 0.85rem; }
  .reader-main { padding: 1.2rem 1rem 4rem; }
  .library { padding: 0.8rem; }
}

/* ---------- annotations ---------- */
mark.hl { color: inherit; border-radius: var(--radius-sm); padding: 0.05em 0; cursor: pointer; }
mark.hl-yellow { background: rgba(244, 214, 96, 0.45); }
mark.hl-green  { background: rgba(126, 200, 128, 0.40); }
mark.hl-blue   { background: rgba(110, 170, 235, 0.38); }
mark.hl-pink   { background: rgba(238, 130, 170, 0.38); }
sup.note-marker { cursor: pointer; color: var(--accent); font-size: 0.75em; padding: 0 0.15em; }

.sel-popover {
  position: absolute; z-index: 40; display: flex; gap: 0.5rem; align-items: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 0.7rem; box-shadow: var(--shadow-md);
}
.sel-popover .dot {
  width: 1.35rem; height: 1.35rem; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.sel-popover .dot:hover { transform: scale(1.15); }
.sel-popover button { border: none; background: none; font-size: 0.95rem; padding: 0.2em 0.4em; }

.ann-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 20;
  width: min(22rem, 90vw);
  background: var(--bg); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%); transition: transform 0.25s ease;
  overflow-y: auto; padding: 1.2rem;
}
.ann-drawer.open { transform: translateX(0); }
.ann-drawer h2 { margin: 0.2rem 0 0.8rem; font-size: 20px; font-weight: 600; }
.ann-row {
  border-left: 2px solid var(--accent);
  border-bottom: 1px solid var(--border);
  padding: 0.6em 0.2em 0.6em 0.7em; cursor: pointer;
}
.ann-row .kind {
  font-size: 10.5px; color: var(--accent);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.ann-row .snippet { font-size: 0.92rem; font-style: italic; margin: 0.2em 0; }
.ann-row .note-text { font-size: 0.88rem; color: var(--muted); }
.ann-row .row-actions { display: flex; gap: 0.6rem; margin-top: 0.3em; }
.ann-row .row-actions button { font-size: 0.8rem; padding: 0.25em 0.7em; }
.note-dialog {
  position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--neutral-900) 50%, transparent);
}
.note-dialog .box {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18.4px; width: min(26rem, 92vw); box-shadow: var(--shadow-lg);
}
.note-dialog .box h3 { margin-top: 0; font-size: 20px; }
.note-dialog textarea {
  width: 100%; min-height: 6em; font-family: var(--font-body); font-size: 1rem;
  background: transparent; color: var(--text); caret-color: var(--accent);
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.6em;
}
.note-dialog .actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.8rem; }

/* ---------- storefront ---------- */
.topbar .nav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.topbar .nav a { color: var(--text); font-size: 14px; }
.topbar .nav a:hover { color: var(--accent); }
.topbar .nav a.current { color: var(--accent); }
.brand { font-family: var(--font-heading); font-weight: 600; }
.brand a { color: inherit; }
.brand a:hover { color: var(--accent); }

/* Editorial hero: type on the ground, hairline below — no color slab. */
.store-hero {
  max-width: 66rem; margin: 0 auto; padding: 2.6rem 1.4rem 0;
  text-align: center;
}
.store-hero h1 {
  margin: 0; font-weight: 400; font-size: 42px; line-height: 1.05;
}
.store-hero .sub {
  color: var(--accent); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; margin-top: 0.6rem;
}
.store-hero::after {
  content: ""; display: block; height: 1px; background: var(--border);
  margin-top: 1.8rem;
}

/* Featured book (first title in the catalog). */
.featured {
  max-width: 66rem; margin: 0 auto; padding: 2.2rem 1.4rem 0;
  display: grid; grid-template-columns: 1fr minmax(150px, 210px); gap: 2.6rem;
  align-items: center; animation: vfade 0.3s ease;
}
.featured .kicker {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
}
.featured h2 { font-weight: 400; font-size: 44px; line-height: 1.06; margin: 10px 0 0; }
.featured .a { font-size: 14px; color: var(--muted); margin-top: 8px; font-style: italic; }
.featured .blurb {
  text-align: justify; max-width: 56ch; font-size: 14.5px; line-height: 1.7;
  margin: 14px 0 0;
}
.featured .cta { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.featured .p { font-size: 12.5px; color: var(--muted); font-feature-settings: 'tnum'; }
.featured .cover { aspect-ratio: 2 / 3; width: 100%; cursor: pointer; box-shadow: var(--shadow-md); }
.featured .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.featured .cover:not(:has(img)) { font-size: clamp(15px, 1.35em, 24px); line-height: 1.08; }
.featured::after {
  content: ""; display: block; height: 1px; background: var(--border);
  grid-column: 1 / -1; margin-top: 0.6rem;
}
@media (max-width: 560px) { .featured { grid-template-columns: 1fr; } .featured .cover { max-width: 11rem; } }

.store-grid {
  max-width: 66rem; margin: 0 auto; padding: 1.8rem 1.4rem 4rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 2rem 1.6rem;
}
.store-card {
  background: transparent; border: none;
  cursor: pointer; text-decoration: none; color: inherit; display: block;
}
.store-card .cover {
  aspect-ratio: 2 / 3; width: 100%;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.store-card:hover .cover { box-shadow: var(--shadow-md); }
.store-card .cover:not(:has(img)) { font-size: clamp(13px, 1.2em, 19px); line-height: 1.1; }
.store-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-card .meta { padding: 10px 2px 0; }
.store-card .meta .t {
  font-family: var(--font-heading); font-weight: 600;
  font-size: 16.5px; line-height: 1.2;
}
.store-card .meta .a { color: var(--muted); font-size: 12px; font-style: italic; margin-top: 3px; }
.store-card .meta .p {
  color: var(--accent-700); font-size: 12px; margin-top: 7px;
  font-feature-settings: 'tnum';
}

.book-hero {
  max-width: 58rem; margin: 0 auto; padding: 2.2rem 1.4rem;
  display: grid; grid-template-columns: minmax(9rem, 15.5rem) 1fr; gap: 2.9rem;
}
.book-hero .cover {
  aspect-ratio: 2 / 3; align-self: start;
  box-shadow: var(--shadow-md);
}
.book-hero .cover:not(:has(img)) { font-size: clamp(16px, 1.5em, 26px); line-height: 1.08; }
.book-hero .cover img { width: 100%; height: 100%; object-fit: cover; }
.book-hero h1 { margin: 0 0 0.2rem; font-weight: 400; font-size: 40px; line-height: 1.05; }
.book-hero .author { color: var(--muted); font-style: italic; margin-bottom: 0.9rem; }
.book-hero .blurb { margin: 0.6rem 0 1.2rem; line-height: 1.75; text-align: justify; max-width: 58ch; }

/* Hairline-bounded stat row (rating/pages/published treatment). */
.stat-strip {
  display: flex; gap: 26px; margin: 18.4px 0; padding: 13.8px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-feature-settings: 'tnum';
}
.stat-strip .n { font-size: 16px; font-family: var(--font-heading); font-weight: 600; }
.stat-strip .l {
  font-size: 11px; color: var(--muted); letter-spacing: 0.06em;
  text-transform: uppercase; margin-top: 2px;
}

.format-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 0.2rem; margin-bottom: 0;
  background: transparent;
}
.format-row:first-child { border-top: 1px solid var(--border); }
.format-row .f { font-family: var(--font-heading); font-weight: 600; font-size: 16px; }
.format-row .price { color: var(--accent-700); font-feature-settings: 'tnum'; }
.format-row .soon {
  color: var(--muted); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.sample-cta { margin: 1rem 0; display: flex; gap: 12px; flex-wrap: wrap; }
/* Historical class name; visually the secondary outlined button now. */
.gold-btn {
  background: transparent; border-color: var(--accent); color: var(--accent);
}
.gold-btn:hover { background: var(--accent-tint); border-color: var(--accent); }

.sample-banner {
  text-align: center; padding: 0.55rem 1rem; font-size: 12.5px;
  font-style: italic; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.sample-banner a { color: var(--accent); font-style: normal; }

/* ---------- dashboard / admin ---------- */
.panel { max-width: 62rem; margin: 1.2rem auto; padding: 0 1.4rem; }
.panel h2 { font-size: 25px; font-weight: 600; margin: 1.6rem 0 0.7rem; }
.stat-row { display: flex; gap: 1px; flex-wrap: wrap; margin: 1rem 0; border: 1px solid var(--border); background: var(--border); }
.stat {
  flex: 1 1 9rem; background: var(--bg); border: none;
  border-radius: 0; padding: 0.9rem 1.1rem; box-shadow: none;
}
.stat .label {
  color: var(--muted); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.stat .value {
  font-family: var(--font-heading); font-weight: 400;
  font-size: 28px; margin-top: 0.2rem; font-feature-settings: 'tnum';
}
.stat.gold .value { color: var(--accent); }
.stat.accent .value { color: var(--accent); }
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 14px;
  background: transparent; border: none; border-radius: 0;
}
table.data th, table.data td {
  text-align: left; padding: 0.55em 0.8em; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th {
  color: var(--muted); font-weight: 400; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
table.data tbody tr:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
table.data td.num, table.data th.num { text-align: right; font-feature-settings: 'tnum'; }
table.data td.wrap { white-space: normal; }
.tag {
  display: inline-block; font-size: 11px; letter-spacing: 0.02em;
  border-radius: 3px; padding: 2px 10px;
  border: 1px solid var(--border); color: var(--muted);
  background: transparent;
}
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.gold { color: var(--accent); border-color: var(--accent); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
/* Figure counts under the admin build status ("68 figures, 7 tables"). */
.figure-count { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; margin: 0.6rem 0 0.2rem; }
.bars .bar { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-width: 8px; }
.bars .bar.gold { background: color-mix(in srgb, var(--accent) 55%, var(--bg)); }
.bar-labels { display: flex; gap: 6px; font-size: 0.7rem; color: var(--muted); }
.bar-labels span { flex: 1; text-align: center; overflow: hidden; }
.tabs { display: flex; gap: 0.4rem; margin: 1rem 0; flex-wrap: wrap; }
.tabs button.active {
  background: var(--accent-tint); color: var(--accent);
  border-color: var(--accent);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.7rem; margin: 0.6rem 0 1rem; }
.form-grid label { display: block; font-size: 12px; color: var(--muted); }
.form-grid input, .form-grid textarea, .form-grid select {
  width: 100%; min-height: 34px; padding: 0.45em 0.7em; margin-top: 0.25rem;
  font-family: var(--font-body); font-size: 14px;
  background: transparent; color: var(--text); caret-color: var(--accent);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.form-grid input:hover, .form-grid textarea:hover, .form-grid select:hover {
  border-color: color-mix(in srgb, var(--text) 45%, transparent);
}
.form-grid input:focus-visible, .form-grid textarea:focus-visible,
.form-grid select:focus-visible { border-color: var(--accent); outline-offset: 0; }
.inline-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.inline-actions button { font-size: 0.82rem; padding: 0.3em 0.8em; }
.notice {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: var(--radius-md); padding: 0.8rem 1rem; margin: 0.8rem 0; line-height: 1.7;
}

/* ---------- trust surfaces, insight, identity ---------- */
.promise-line {
  border: 1px solid var(--accent); border-radius: var(--radius-md);
  padding: 0.7rem 1rem; margin: 0.8rem 0; line-height: 1.7;
}
.estimate-note { font-size: 0.8rem; color: var(--muted); margin: 0.3rem 0 0.8rem; }
.etb { font-size: 0.72em; color: var(--muted); white-space: nowrap; font-feature-settings: 'tnum'; }
.etb em { font-style: normal; opacity: 0.8; }
.bucket-toggle { margin-inline-start: 0.8rem; display: inline-flex; gap: 0.3rem; }
.bucket-toggle button { font-size: 0.78rem; padding: 0.2em 0.8em; }
.bucket-toggle button.active {
  background: var(--accent-tint); color: var(--accent); border-color: var(--accent);
}
/* Chart honesty: a bar never spans the panel like a slab, and a zero
   bucket still shows as a labeled stub instead of a gap. */
.bars .bar { max-width: 3.5rem; }
.bars .bar.zero { background: var(--neutral-300); }
.bar-labels span { max-width: 3.5rem; }
.bars, .bar-labels { justify-content: center; }
.contact-link { font-size: 0.8rem; margin-inline-start: 0.8rem; }
/* Owner's desk (admin Overview): an author's books fold out under the
   author row, quieter than the row that owns them. */
table.data tr.ov-subrow td { color: var(--muted); font-size: 13px; padding-top: 0.25rem; padding-bottom: 0.25rem; }
.author-card {
  display: grid; grid-template-columns: auto 1fr; gap: 1.2rem;
  align-items: start; border-top: 1px solid var(--border);
  max-width: 58rem; margin: 1.6rem auto 0; padding: 1.2rem 1.4rem 0;
}
.author-card .author-photo {
  width: 6.5rem; height: 6.5rem; object-fit: cover; border-radius: 50%;
  border: 1px solid var(--accent);
}
.author-card h2 { font-weight: 600; font-size: 20px; }
.check-label { display: flex; gap: 0.5rem; align-items: center; }
.check-label input { width: auto; }
.forgot-row { margin-top: 0.8rem; font-size: 0.85rem; }
.mail-body {
  white-space: pre-wrap; font-family: var(--font-body); font-size: 0.85rem;
  margin: 0.3rem 0; line-height: 1.6;
}

/* ---------- audiobook player ---------- */
.listen-btn {
  margin-top: 0.4rem; font-size: 0.8rem; padding: 0.25em 0.9em;
  border-color: var(--accent); color: var(--accent);
}
.listen-btn:hover { background: var(--accent-tint); }
.sample-audio { margin: 0.6rem 0; }
.sample-audio audio { width: 100%; max-width: 26rem; margin-top: 0.3rem; }
.sample-audio .s, .player-head .s { color: var(--muted); font-size: 0.85rem; }
.player-head {
  display: grid; grid-template-columns: auto 1fr; gap: 1.2rem;
  align-items: center; margin: 0.6rem 0 1rem;
}
.player-head .cover {
  width: 6rem; height: 9rem;
  overflow: hidden; font-size: 0.7rem;
}
.player-head .cover:not(:has(img)) { padding: 8px 6px 8px 13px; }
.player-head .cover img { width: 100%; height: 100%; object-fit: cover; }
.player-bar {
  display: flex; align-items: center; gap: 0.7rem;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  border-left: none; border-right: none; border-radius: 0;
  padding: 0.7rem 0.2rem;
}
.player-bar input[type="range"] { flex: 1; accent-color: var(--accent); }
.player-bar .ptime {
  font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--muted);
  min-width: 3.2em; text-align: center;
}
.player-bar select {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.3em 0.5em;
  font-family: var(--font-body);
}
tr.current-chapter td { color: var(--accent); font-weight: 600; }

@media (max-width: 560px) {
  .book-hero { grid-template-columns: 1fr; }
  .book-hero .cover { max-width: 14rem; margin: 0 auto; }
  .author-card { grid-template-columns: 1fr; }
  .stat-strip { gap: 18px; flex-wrap: wrap; }
}

/* ---------- public footer + legal pages ---------- */
.site-footer {
  margin-top: 3rem;
  padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  justify-content: center;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }

.legal-page { max-width: 720px; margin: 0 auto; padding: 1.2rem; line-height: 1.7; }
.legal-page h1 { font-size: 32px; font-weight: 400; margin: 0.4rem 0 0.8rem; }
.legal-page h2 { font-size: 20px; font-weight: 600; margin: 1.6rem 0 0.4rem; }
.legal-page ul { padding-inline-start: 1.4rem; }
.legal-page li { margin: 0.35rem 0; }
.legal-stamp { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.6rem; font-style: italic; }
.lang-toggle a, .lang-toggle .current { padding: 0.2rem 0.5rem; }
.lang-toggle .current { color: var(--accent); }

/* ---------- public author page (handoff: Author screen) ---------- */
/* Matted-portrait treatment from the design system (classical.css
   .plate): sepia-toned plate in a surface mat with a hairline outline. */
.plate {
  filter: sepia(0.22) saturate(0.82) contrast(1.05);
  border: 6px solid var(--surface);
  outline: 1px solid var(--border);
}
.author-page {
  max-width: 58rem; margin: 0 auto; padding: 2.2rem 1.4rem 4rem;
  display: grid; grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr); gap: 3.2rem;
  align-items: start; animation: vfade 0.3s ease;
}
/* minmax(0, 1fr) above and min-width: 0 here: a 1fr track otherwise
   takes the bibliography grid's min-content width (three 9rem covers)
   and the whole page scrolled sideways on a phone (2026-09-24). */
.author-page > div { min-width: 0; }
.author-portrait {
  aspect-ratio: 4 / 5;
  display: grid; place-items: center;
  background: repeating-linear-gradient(45deg,
    var(--neutral-200), var(--neutral-200) 10px,
    var(--neutral-100) 10px, var(--neutral-100) 20px);
}
.author-portrait span {
  font-family: ui-monospace, Menlo, monospace; font-size: 10.5px;
  color: var(--neutral-600); letter-spacing: 0.06em;
}
.author-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.author-page .kicker {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-700);
}
.author-page h1 { margin: 6px 0 0; font-weight: 400; font-size: 44px; line-height: 1.05; }
.author-page .meta-line {
  font-size: 12.5px; color: var(--muted); margin-top: 10px;
  font-feature-settings: 'tnum';
}
.author-page .rule { border: none; height: 1px; background: var(--border); margin: 18px 0 0; }
.author-page .bio {
  margin: 18px 0 0; text-align: justify;
  font-size: 14.5px; line-height: 1.75; max-width: 58ch;
}
.author-page .catalog-title { margin: 28px 0 0; font-weight: 600; font-size: 16px; }
.author-books {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 28px 24px; margin-top: 16px; max-width: 36rem;
}
/* Book page: the author name links here — accent hairline, never the
   browser-default blue. */
.book-hero .author a {
  color: inherit; border-bottom: 1px solid var(--accent);
  padding-bottom: 1px; transition: color 0.2s;
}
.book-hero .author a:hover { color: var(--accent-700); }
@media (max-width: 560px) {
  .author-page { grid-template-columns: minmax(0, 1fr); }
  .author-portrait { width: 100%; max-width: 14rem; margin: 0 auto; }
  /* Two covers per row on a phone — one cover per row wasted the shelf
     (the auto-fill minimum of 10.5rem only fits once in 346px). */
  .store-grid, .author-books, .author-spotlight .spotlight-books {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem;
  }
  .author-books { max-width: none; }
}

/* ---------- true-black reading theme (reader parity with the app) ----------
   Same ink as dark, ground pushed to pure black (OLED). Selected from the
   reader's theme cycle (light → dark → black); other pages simply render
   it as a deeper dark. */
:root[data-theme="black"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #121110;
  --text: #d9d4ca;
  --muted: color-mix(in srgb, #d9d4ca 55%, transparent);
  --accent: #e1ad66;
  --border: rgba(221, 216, 206, 0.18);
  --shadow: rgba(0, 0, 0, 0.65);
  --neutral-100: #121110;
  --neutral-200: #1a1816;
  --neutral-300: #2a2723;
  --neutral-600: #a09a8f;
  --neutral-700: #bdb7ab;
  --neutral-900: #eae6dd;
  --accent-100: rgba(182, 130, 53, 0.16);
  --accent-700: #dcac63;
  --accent-800: #e8c68f;
  --ok: #7fae83;
  --warn: #cf7a63;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.7);
  --shadow-md: 0 3px 10px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.8);
}

/* ---------- Ethiopic typeface choices (reader parity with the app) ---------- */
@font-face {
  font-family: "Noto Sans Ethiopic";
  src: url("/static/fonts/NotoSansEthiopic-Regular.ttf");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans Ethiopic";
  src: url("/static/fonts/NotoSansEthiopic-Bold.ttf");
  font-weight: bold; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Abyssinica SIL";
  src: url("/static/fonts/AbyssinicaSIL-Regular.ttf");
  font-weight: normal; font-style: normal; font-display: swap;
}
body.face-sans .reader-main {
  font-family: "Noto Sans Ethiopic", "Lora", "Noto Serif", sans-serif;
}
body.face-abyssinica .reader-main {
  font-family: "Abyssinica SIL", "Noto Serif Ethiopic", "Lora", serif;
}
/* TODO(web parity, post-freeze): when an English edition is published, the
   web reader needs the app's per-language faces too — Latin Noto Serif/Sans
   for 'en' books, never the Ethiopic faces (app language_registry.dart). */

/* Two more size steps beyond the original 3 (the app's aA has more play). */
body.font-4 .reader-main { font-size: 1.45rem; }
body.font-5 .reader-main { font-size: 1.65rem; }

/* The aA settings popover (size steps + typeface choice). */
.aa-menu {
  position: fixed; z-index: 45; top: 52px; right: 12px;
  width: min(17rem, 92vw);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 0.9rem 1rem;
}
.aa-menu .row { display: flex; align-items: center; gap: 0.6rem; margin: 0.5rem 0; }
.aa-menu .label {
  flex: 1; font-size: 11px; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.aa-menu button { padding: 4px 12px; font-size: 13px; }
.aa-menu button.active {
  background: var(--accent-tint); color: var(--accent); border-color: var(--accent);
}

/* ---------- the dictionary sheet ---------- */
.dict-backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: color-mix(in srgb, var(--neutral-900) 22%, transparent);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.dict-backdrop.show { opacity: 1; pointer-events: auto; }
.dict-sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 60;
  width: min(40rem, 100vw);
  max-height: 62vh; overflow-y: auto;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.3rem calc(0.9rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 105%); transition: transform 0.22s ease;
}
.dict-sheet.open { transform: translate(-50%, 0); }
.dict-head { display: flex; align-items: baseline; gap: 0.8rem; }
.dict-word {
  flex: 1; font-family: var(--font-heading);
  font-weight: 600; font-size: 24px;
}
.dict-close { border: none; padding: 2px 8px; color: var(--muted); }
.dict-loading { color: var(--muted); font-style: italic; padding: 0.7rem 0; }
.dict-loading::before {
  content: ""; display: inline-block; vertical-align: -2px;
  width: 0.85em; height: 0.85em; margin-inline-end: 0.5em;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: dictspin 0.8s linear infinite;
}
@keyframes dictspin { to { transform: rotate(360deg); } }
.dict-note { color: var(--muted); font-style: italic; padding: 0.55rem 0; }
.dict-nudge { border-top: 1px solid var(--border); }
.dict-lemma {
  color: var(--accent-700); font-size: 0.95rem; margin: 0.3rem 0 0.1rem;
  font-feature-settings: 'tnum';
}
.dict-entry { padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.dict-entry:last-child { border-bottom: none; }
.dict-entry-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.dict-headword { font-weight: 600; font-size: 1.1rem; }
.dict-translit { color: var(--muted); font-style: italic; font-size: 0.9rem; }
.dict-gloss { margin-top: 0.25rem; line-height: 1.55; }
.dict-ai-note { color: var(--muted); font-size: 0.88rem; margin-top: 0.25rem; }
.dict-nearby-title {
  font-size: 11px; color: var(--muted); letter-spacing: 0.08em;
  text-transform: uppercase; margin-top: 0.5rem;
}
.dict-entry-nearby .dict-gloss { color: var(--muted); font-size: 0.92rem; }
.dict-attrib {
  border-top: 1px solid var(--border); margin-top: 0.6rem; padding-top: 0.5rem;
  color: var(--muted); font-size: 0.72rem;
}

/* ---------- the companion sheets: So far (እስካሁን) and Ask (ጠይቅ) ----------
   The dictionary sheet's frame, with the notes set as margin notes: the
   book's own words in the reading face, the explanation beneath. */
.companion-sheet { max-height: 74vh; }
.companion-body { padding-top: 0.2rem; }
.sofar-pending {
  color: var(--muted); font-size: 0.82rem; font-style: italic;
  padding: 0.3rem 0 0.5rem; border-bottom: 1px solid var(--border);
}
.sofar-chapter-title {
  font-family: var(--font-heading); font-weight: 600; font-size: 1.05rem;
  margin: 0.7rem 0 0.25rem;
}
.sofar-latest .sofar-chapter-title { font-size: 1.15rem; }
.sofar-summary { line-height: 1.6; margin: 0.25rem 0 0.4rem; }
.sofar-points-label { margin-top: 0.35rem; }
.sofar-points { list-style: none; margin: 0.25rem 0 0.4rem; padding: 0; }
.sofar-points li { position: relative; padding-inline-start: 1.4em; line-height: 1.5; margin: 0.15em 0; }
.sofar-points li::before {
  content: attr(data-marker); position: absolute; inset-inline-start: 0;
  color: var(--accent);
}
.sofar-earlier { border-top: 1px solid var(--border); margin-top: 0.6rem; padding-top: 0.4rem; }
.sofar-earlier > summary {
  cursor: pointer; font-size: 11px; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase; padding: 0.3rem 0;
}
.sofar-earlier .sofar-chapter { border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.sofar-earlier .sofar-chapter > summary { cursor: pointer; list-style-position: outside; margin: 0.5rem 0 0.2rem; }
.sofar-earlier .sofar-chapter > summary.sofar-chapter-title { font-size: 1rem; }
/* Sections: "In this chapter so far" (most recent first) and, under a
   finished chapter, its sections folded in reading order. */
.sofar-in-chapter { margin-top: 0.1rem; }
.sofar-sections { margin: 0.3rem 0 0.4rem; }
.sofar-section {
  border-inline-start: 2px solid var(--border); padding-inline-start: 0.7rem;
  margin: 0.5rem 0;
}
.sofar-section-title {
  font-family: var(--font-heading); font-weight: 600; font-size: 0.98rem;
  margin: 0 0 0.15rem;
}
.sofar-section .sofar-summary { margin: 0.15rem 0 0.3rem; }
.sofar-section .sofar-points { margin: 0.15rem 0 0.2rem; }
.sofar-section-fold { margin-top: 0.3rem; }
.sofar-section-fold > summary {
  cursor: pointer; font-size: 11px; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase; padding: 0.2rem 0;
}
.ask-form { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.ask-input {
  flex: 1; min-height: 36px; padding: 6px 10px;
  font-family: var(--font-body); font-size: 15px;
  background: transparent; color: var(--text); caret-color: var(--accent);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.ask-input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.ask-submit { white-space: nowrap; }
.ask-hint { color: var(--muted); font-size: 0.8rem; font-style: italic; margin: 0.4rem 0 0.2rem; }
.ask-note {
  margin-top: 0.7rem; padding: 0.6rem 0.9rem;
  border-inline-start: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.ask-notfound { border-inline-start-color: var(--border); background: transparent; }
.ask-question { color: var(--muted); font-size: 0.9rem; }
.ask-question::before { content: "«"; }
.ask-question::after { content: "»"; }
.ask-quote {
  margin: 0.45rem 0; padding: 0.1rem 0 0.1rem 0.8rem;
  border-inline-start: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  font-family: var(--font-body);
}
.ask-quote p { margin: 0; line-height: 1.6; }
.ask-quote cite {
  display: block; font-style: normal; font-size: 0.78rem; color: var(--muted);
  margin-top: 0.15rem;
}
.ask-quote-link { cursor: pointer; }
.ask-quote-link:hover { border-inline-start-color: var(--accent); }
.ask-answer { line-height: 1.6; margin: 0.45rem 0 0.2rem; }
.ask-notfound .ask-answer { color: var(--muted); font-style: italic; }
.ask-vote {
  display: flex; align-items: center; gap: 0.4rem; margin-top: 0.4rem;
  font-size: 0.8rem; color: var(--muted);
}
.ask-vote button { border: none; background: none; font-size: 1rem; padding: 0.1em 0.3em; cursor: pointer; }
.ask-vote button:disabled { opacity: 0.4; }
.ask-thanks { font-style: italic; }
.ask-error { color: var(--warn); }
/* Explain (ፍቺ+): the passage as the quoted block, the explanation, then
   the notes as a compact list (term bold, kind as a small label) and the
   citations. The selection menus' Explain action shares their look. */
.explain-notes, .explain-refs { list-style: none; margin: 0.3rem 0 0.2rem; padding: 0; }
.explain-note-item { line-height: 1.55; margin: 0.3em 0; }
.explain-term { font-weight: 600; margin-inline-end: 0.35em; }
.explain-kind { font-size: 10px; vertical-align: middle; margin-inline-end: 0.45em; }
.explain-note-text { color: var(--text); }
.explain-refs li { position: relative; padding-inline-start: 1.2em; line-height: 1.5; }
.explain-refs li::before { content: "※"; position: absolute; inset-inline-start: 0; color: var(--accent); }
.explain-action { white-space: nowrap; }

/* ---------- zero-tap highlight toolbar ---------- */
.hl-toolbar {
  position: absolute; z-index: 40;
  display: flex; gap: 0.55rem; align-items: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 0.8rem; box-shadow: var(--shadow-md);
}
.hl-toolbar .dot {
  width: 1.25rem; height: 1.25rem; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.hl-toolbar .dot.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.hl-toolbar button { border: none; background: none; font-size: 0.9rem; padding: 0.15em 0.4em; }

/* ---------- in-book search ---------- */
.search-panel {
  position: fixed; top: 0; left: 50%; transform: translate(-50%, -105%);
  z-index: 46; width: min(40rem, 96vw); max-height: 70vh;
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg); transition: transform 0.22s ease;
}
.search-panel.open { transform: translate(-50%, 0); }
.search-panel .search-bar { display: flex; gap: 0.5rem; padding: 0.8rem 1rem 0.5rem; }
.search-panel input {
  flex: 1; min-height: 36px; padding: 6px 10px;
  font-family: var(--font-body); font-size: 15px;
  background: transparent; color: var(--text); caret-color: var(--accent);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.search-panel input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.search-results { overflow-y: auto; padding: 0 1rem 0.8rem; }
.search-hit {
  padding: 0.55em 0.3em; border-bottom: 1px solid var(--border); cursor: pointer;
}
.search-hit:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.search-hit .ch {
  font-size: 10.5px; color: var(--accent); letter-spacing: 0.06em;
  text-transform: uppercase;
}
.search-hit .snip { font-size: 0.92rem; margin-top: 0.15em; }
.search-hit .snip b { color: var(--accent-700); font-weight: 600; }
.search-count { color: var(--muted); font-size: 0.8rem; padding: 0.3rem 0.3rem 0.5rem; }
.search-hit.current { background: var(--accent-tint); }
/* Search sprint: matches grouped under a sticky chapter heading. */
.search-chapter {
  position: sticky; top: 0; z-index: 1; background: var(--bg);
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.65em 0.3em 0.3em; border-bottom: 1px solid var(--border);
  font-size: 10.5px; color: var(--accent); letter-spacing: 0.06em;
  text-transform: uppercase;
}
.search-chapter .n { color: var(--muted); letter-spacing: 0; text-transform: none; }
/* The match walker after a jump: ‹ 3 of 17 › — bottom right, clear of
   the centred back-pill. */
.search-nav {
  position: fixed; bottom: 3.4rem; right: 1rem; z-index: 30;
  display: flex; align-items: center; gap: 0.1rem;
  background: var(--bg); border: 1px solid var(--accent); color: var(--accent);
  border-radius: 999px; padding: 0.2em 0.4em; box-shadow: var(--shadow-md);
  font-size: 0.85rem; font-feature-settings: 'tnum';
}
.search-nav button {
  border: none; background: none; color: var(--accent); min-height: 0;
  font-size: 1.05rem; padding: 0.05em 0.45em; line-height: 1.2;
}
.search-nav #search-pos { padding: 0 0.2em; }

/* Flash the jumped-to match, then the re-render clears it. */
mark.hl-flash {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  animation: searchflash 1.4s ease;
}
@keyframes searchflash {
  from { background: color-mix(in srgb, var(--accent) 60%, transparent); }
}

/* Pinned return pill after a search jump (the Kindle back-pill). */
.back-pill {
  position: fixed; bottom: 3.4rem; left: 50%; transform: translateX(-50%);
  z-index: 30; font-size: 0.85rem;
  background: var(--bg); border: 1px solid var(--accent); color: var(--accent);
  border-radius: 999px; padding: 0.45em 1.1em; box-shadow: var(--shadow-md);
}

/* ---------- reader progress footer ---------- */
.progress-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 12;
  text-align: center; cursor: pointer;
  padding: 0.35rem 1rem calc(0.35rem + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.8rem; font-feature-settings: 'tnum';
  transition: background 0.3s;
}

/* ---------- audiobook player parity ---------- */
.speed-stepper { display: inline-flex; align-items: center; gap: 0.15rem; }
.speed-stepper button { padding: 2px 9px; font-size: 14px; min-height: 28px; }
.speed-stepper .readout {
  min-width: 3.4em; text-align: center; cursor: pointer;
  font-variant-numeric: tabular-nums; font-size: 0.9rem; color: var(--text);
}
.player-settings {
  display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: center;
  padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 0.85rem;
}
.player-settings label { display: inline-flex; align-items: center; gap: 0.45rem; }
.player-settings select {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.25em 0.45em; font-family: var(--font-body);
}
.sleep-remaining { color: var(--accent-700); font-feature-settings: 'tnum'; }

/* Registration consent row: checkbox + inline legal links. */
.consent-row {
  display: flex; align-items: flex-start; gap: 0.5rem;
  margin-top: 1rem; font-size: 0.88rem; color: var(--muted);
}
.consent-row input { width: auto; margin-top: 0.2rem; accent-color: var(--accent); }
.consent-row a { color: var(--accent); }

/* ---------- book-intake wizard (docs/research/book_intake_wizard_spec.md) ----------
   Same Classical grammar as the admin tables: strokes not fills, hairline
   borders, the status hues as chips. */
.wizard { max-width: 54rem; }
.wizard h3 { font-size: 20px; margin: 1.6rem 0 0.5rem; }
.wizard h4 { font-size: 16px; margin: 1.2rem 0 0.4rem; }
.wiz-steps { display: flex; gap: 0.4rem; margin: 0.9rem 0 1.3rem; flex-wrap: wrap; }
.wiz-steps button { font-size: 13px; gap: 8px; }
.wiz-steps button .n {
  display: inline-flex; width: 1.45em; height: 1.45em;
  border: 1px solid currentColor; border-radius: 50%;
  align-items: center; justify-content: center; font-size: 0.85em;
}
.wiz-steps button.active {
  background: var(--accent-tint); color: var(--accent); border-color: var(--accent);
}
.drop-zone {
  border: 1.5px dashed var(--border); border-radius: var(--radius-lg);
  padding: 1.5rem 1.2rem; text-align: center; color: var(--muted);
  cursor: pointer; font-size: 14px; margin: 0.7rem 0;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-tint); }
.drop-zone.attached { border-style: solid; color: var(--text); }
.drop-zone.missing { border-color: var(--warn); color: var(--text); }
.field-error { color: var(--warn); font-size: 0.85rem; margin-top: 0.3rem; white-space: pre-wrap; }
.field-error:empty { display: none; }
.hint { color: var(--muted); font-size: 12px; margin-top: 0.25rem; line-height: 1.55; font-weight: 400; }
.warn-notice {
  border-color: color-mix(in srgb, var(--warn) 55%, transparent);
  background: color-mix(in srgb, var(--warn) 6%, transparent);
}
.choice-list { display: grid; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.choice-list .choice {
  display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: start;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem; cursor: pointer; font-size: 14px;
}
.choice-list .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.choice-list input { accent-color: var(--accent); margin-top: 0.25rem; }
.cover-side-status { font-size: 12.5px; color: var(--muted); margin-top: 0.3rem; white-space: pre-wrap; }
/* Cover Studio's picker grid: live typographic thumbnails, Classical
   framing — bordered unfilled cards, accent as stroke, whisper shadow. */
.cover-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(7.2rem, 1fr));
  gap: 0.7rem; margin: 0.8rem 0 1rem;
}
.cover-thumb {
  display: block; padding: 0.45rem 0.45rem 0.4rem; height: auto;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer; text-align: center;
}
.cover-thumb img {
  display: block; width: 100%; height: auto; border-radius: 1px;
  box-shadow: var(--shadow-sm);
}
.cover-thumb .cover-thumb-label {
  display: block; margin-top: 0.4rem; font-size: 11.5px; line-height: 1.45;
  color: var(--muted); letter-spacing: 0.01em; text-transform: none;
}
.cover-thumb:hover { border-color: var(--neutral-600); }
.cover-thumb.selected {
  border-color: var(--accent); background: var(--accent-tint);
  box-shadow: 0 0 0 1px var(--accent);
}
.cover-thumb.selected .cover-thumb-label { color: var(--text); }
.cover-thumb .tag { font-size: 10px; padding: 0 0.35rem; }
/* Read-mostly: the post-publish cover visit locks everything but the
   picker (the one wizard write that survives publish). */
.locked { opacity: 0.5; pointer-events: none; }
details.adv { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.6rem 0.9rem; margin: 0.9rem 0; }
details.adv summary { cursor: pointer; font-family: var(--font-heading); font-weight: 600; font-size: 14px; }
.pattern-result { font-size: 13px; margin-top: 0.3rem; }
.pattern-result.ok { color: var(--ok); }
.pattern-result.bad { color: var(--warn); }
.wiz-footnote {
  color: var(--muted); font-size: 12.5px; line-height: 1.6;
  border-top: 1px solid var(--border); padding-top: 0.7rem; margin-top: 1rem;
}
.wiz-actions { display: flex; gap: 0.6rem; margin: 1.4rem 0 2.4rem; align-items: center; flex-wrap: wrap; }
.wiz-actions .spacer { flex: 1; }
.save-state { color: var(--muted); font-size: 12px; font-style: italic; }
.problem-list { display: grid; gap: 0.45rem; margin-top: 0.5rem; }
.problem-list .problem { display: flex; gap: 0.6rem; align-items: baseline; font-size: 13.5px; line-height: 1.55; }
.report-warnings { display: grid; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.report-warning {
  display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: baseline;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.55rem 0.8rem; font-size: 13.5px; line-height: 1.55;
}
.report-warning .where { color: var(--muted); font-size: 11.5px; margin-inline-start: 0.4em; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.9rem; margin: 0.9rem 0; }
.preview-frame {
  width: 100%; height: 30rem; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--surface);
}
.slug-preview { color: var(--muted); font-size: 13px; margin-top: 0.3rem; font-feature-settings: 'tnum'; }
.next-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.8rem; margin: 0.9rem 0; }
.next-cards a.card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.8rem 1rem; color: var(--text); font-size: 13.5px; line-height: 1.5;
}
.next-cards a.card:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- reviews (Classical: hairlines, stroke not fill) ----------
   Stars are strokes too: a filled ★ in the accent, an outline ☆ in the
   border colour, never a coloured pill. The distribution bars are the
   one place a fill earns its keep — a bar IS a quantity. */

.reviews {
  max-width: 58rem; margin: 0 auto 3rem; padding: 0 1.4rem;
  border-top: 1px solid var(--border); padding-top: 2rem;
}
.reviews h2 {
  font-family: var(--font-heading); font-weight: 400; font-size: 30px;
  margin: 0 0 1.1rem;
}
.stars { white-space: nowrap; letter-spacing: 0.08em; line-height: 1; }
.stars .on { color: var(--accent); }
.stars .off { color: var(--border); }

.rating-summary {
  display: grid; grid-template-columns: minmax(8rem, 11rem) 1fr; gap: 2.2rem;
  align-items: start; margin-bottom: 1.8rem;
}
.rating-summary .score { text-align: center; }
.rating-summary .score .avg {
  font-family: var(--font-heading); font-weight: 400; font-size: 54px;
  line-height: 1; font-feature-settings: 'tnum';
}
.rating-summary .score .stars { font-size: 17px; margin: 0.4rem 0 0.35rem; display: block; }
.rating-summary .score .count {
  color: var(--muted); font-size: 11.5px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.rating-dist { display: grid; gap: 5px; align-content: start; }
.dist-row {
  display: grid; grid-template-columns: 3.4em 1fr 2.6em; gap: 0.7rem;
  align-items: center; font-size: 12.5px; color: var(--muted);
  font-feature-settings: 'tnum';
}
.dist-row .track {
  height: 7px; background: color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: 3px; overflow: hidden;
}
.dist-row .fill {
  height: 100%; background: var(--accent); border-radius: 3px;
  min-width: 0; transition: width 0.25s ease;
}
.dist-row .n { text-align: right; }

.review-invite {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem; margin-bottom: 1.4rem;
  font-size: 13.5px; line-height: 1.6; color: var(--muted);
  display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap;
}
.review-invite .grow { flex: 1; min-width: 12rem; }

.review-form { margin-bottom: 1.8rem; }
.review-form .star-pick {
  display: flex; gap: 0.15rem; align-items: center; margin: 0.3rem 0 0.9rem;
}
.review-form .star-pick button {
  background: transparent; border: none; padding: 0 0.1rem;
  font-size: 27px; line-height: 1; color: var(--border);
  cursor: pointer; box-shadow: none;
}
.review-form .star-pick button:hover { background: transparent; }
.review-form .star-pick button.on { color: var(--accent); }
.review-form .field-label {
  display: block; font-size: 11px; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.6rem;
}
.review-form input[type="text"], .review-form textarea {
  width: 100%; padding: 0.5em 0.7em; margin-top: 0.3rem;
  font-family: var(--font-body); font-size: 14px; line-height: 1.6;
  background: transparent; color: var(--text); caret-color: var(--accent);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.review-form textarea { min-height: 7rem; resize: vertical; }
.review-form input:focus-visible, .review-form textarea:focus-visible {
  border-color: var(--accent); outline-offset: 0;
}
.review-form .counter {
  font-size: 11.5px; color: var(--muted); text-align: right;
  font-feature-settings: 'tnum'; margin-top: 0.2rem;
}
.review-form .form-actions {
  display: flex; gap: 0.6rem; margin-top: 0.9rem; align-items: center; flex-wrap: wrap;
}
.review-form .form-error { color: var(--warn); font-size: 13px; }

.review-sort { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem; flex-wrap: wrap; }
.review-sort .l {
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase; margin-inline-end: 0.3rem;
}
.review-sort button { font-size: 0.8rem; padding: 0.25em 0.75em; }
.review-sort button.active {
  background: var(--accent-tint); color: var(--accent); border-color: var(--accent);
}

.review-list { display: grid; }
.review {
  border-top: 1px solid var(--border); padding: 1.1rem 0.1rem;
}
.review:last-child { border-bottom: 1px solid var(--border); }
.review .head {
  display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.review .who { font-family: var(--font-heading); font-weight: 600; font-size: 15px; }
.review .when, .review .edited, .review .lang {
  color: var(--muted); font-size: 11.5px; font-feature-settings: 'tnum';
}
.review .edited { font-style: italic; }
.review .verified {
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ok); border: 1px solid var(--ok); border-radius: 3px;
  padding: 1px 7px;
}
.review .stars { font-size: 14px; }
.review .rt {
  font-family: var(--font-heading); font-weight: 600; font-size: 16px;
  margin: 0.35rem 0 0.15rem;
}
.review .rb {
  margin: 0.3rem 0 0; line-height: 1.72; white-space: pre-wrap;
  max-width: 64ch;
}
.review .foot { margin-top: 0.55rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.review .foot button { font-size: 0.78rem; padding: 0.22em 0.7em; }
.review .foot .said { color: var(--muted); font-size: 11.5px; font-style: italic; }
.review.mine { border-inline-start: 2px solid var(--accent); padding-inline-start: 0.8rem; }
.review .hidden-note { color: var(--warn); font-size: 12px; font-style: italic; margin-top: 0.35rem; }

.reviews-more { margin-top: 1rem; }
.reviews-empty {
  color: var(--muted); font-style: italic; font-size: 14px;
  padding: 1.2rem 0; border-top: 1px solid var(--border);
}

/* The store card's one-line rating: stars, then the count in tabular
   figures. Absent entirely on a book nobody has rated. */
.store-card .meta .r, .featured .r {
  margin-top: 4px; font-size: 12px; color: var(--muted);
  display: flex; gap: 0.4rem; align-items: center;
}
.store-card .meta .r .stars, .featured .r .stars { font-size: 12px; }

@media (max-width: 640px) {
  .rating-summary { grid-template-columns: 1fr; gap: 1.1rem; }
  .rating-summary .score { text-align: start; }
}
.book-rating { margin: -0.5rem 0 0.9rem; }
.book-rating a { color: var(--muted); font-size: 13px; text-decoration: none; display: inline-flex; gap: 0.5rem; align-items: center; }
.book-rating a:hover .c { color: var(--accent); }

/* ---- The author picker: one control for owner + author name ----------
   Used by the intake wizard's step 1 and by the Books tab's author
   repair (static/authorpicker.js). The menu overlays, so the combo is
   the positioning context and nothing below it reflows while typing. */
.author-picker { margin: 0.3rem 0 0.9rem; }
.author-combo { position: relative; max-width: 30rem; }
.author-combo .author-input {
  width: 100%; min-height: 34px; padding: 0.45em 0.7em;
  font-family: var(--font-body); font-size: 14px;
  background: transparent; color: var(--text); caret-color: var(--accent);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.author-combo .author-input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.author-picker.locked .author-input { opacity: 0.7; cursor: not-allowed; }
.author-menu {
  position: absolute; inset-inline: 0; top: calc(100% + 2px); z-index: 40;
  max-height: 17rem; overflow-y: auto; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}
.author-option {
  padding: 0.42rem 0.6rem; cursor: pointer; font-size: 13.5px;
  display: flex; flex-direction: column; gap: 1px;
}
.author-option.active, .author-option:hover { background: var(--accent-tint); }
.author-option.empty { color: var(--muted); font-style: italic; cursor: default; }
.author-option.empty:hover { background: transparent; }
.author-option.add { border-top: 1px solid var(--border); color: var(--accent); }
.author-option-name { font-weight: 500; }
.author-option-meta { color: var(--muted); font-size: 11.5px; }
.author-chosen {
  display: flex; align-items: center; gap: 0.55rem; margin-top: 0.45rem;
  padding: 0.4rem 0.55rem; border: 1px solid var(--border);
  border-radius: var(--radius-md); max-width: 30rem; background: var(--accent-tint);
}
.author-chip-photo {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--border);
}
.author-chip-photo.empty { background: var(--border); }
.author-chip-text { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.author-new {
  margin-top: 0.6rem; padding: 0.7rem 0.85rem; border: 1px solid var(--border);
  border-radius: var(--radius-md); max-width: 34rem;
}
.author-new h4 { margin: 0 0 0.5rem; font-size: 14px; font-weight: 600; }
.author-new label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 0.6rem; }
.author-new textarea, .author-new input[type="file"] {
  width: 100%; font-family: var(--font-body); font-size: 14px;
  color: var(--text); background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.45em 0.7em; margin-top: 0.25rem;
}
.author-new input[type="file"] { border: 0; padding-inline: 0; }

/* ---- Storefront gaps (audit B1 #10, #12, #14; delta sec 3) ------------- */
/* "Also available in": a hairline-bounded row of sibling editions. */
.editions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem;
  margin: 0.2rem 0 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.editions .l { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.editions .edition {
  display: inline-flex; align-items: baseline; gap: 0.45rem; color: inherit;
  text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 1px;
}
.editions .edition .lang { font-weight: 600; }
.editions .edition .orig { color: var(--muted); font-size: 11px; }
.editions .edition .t { color: var(--muted); }
/* The page tail: more by this author, the author card, the details list. */
.book-tail { max-width: 58rem; margin: 0 auto; padding: 0 1.4rem 2rem; }
.book-tail .author-card { max-width: none; padding-inline: 0; }
.book-tail .author-card .all-books {
  display: inline-block; margin-top: 0.6rem; font-size: 13px; color: inherit;
  text-decoration: none; border-bottom: 1px solid var(--accent);
}
.more-by { border-top: 1px solid var(--border); padding-top: 1.2rem; margin-top: 1.6rem; }
.more-by .author-books { max-width: none; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.shelf-head h2 { font-weight: 600; font-size: 20px; margin: 0; }
.shelf-head a { font-size: 13px; color: var(--muted); text-decoration: none; }
.shelf-head a:hover { color: var(--accent); }
.book-details { border-top: 1px solid var(--border); padding-top: 1.2rem; margin-top: 1.6rem; }
.book-details h2 { font-weight: 600; font-size: 20px; margin: 0 0 0.6rem; }
.book-details dl {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.6rem 1.6rem; margin: 0; font-feature-settings: 'tnum';
}
.book-details dl > div { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; border-bottom: 1px solid var(--border); padding: 0.35rem 0; font-size: 13.5px; }
.book-details dt { color: var(--muted); }
.book-details dd { margin: 0; text-align: end; }
/* Store cards are blocks with two links inside (book, author). */
.store-card .cover, .store-card .meta .t { color: inherit; text-decoration: none; display: block; }
.store-card .meta .a.author-link { display: inline-block; text-decoration: none; }
.store-card .meta .a.author-link:hover, .featured .a .author-link:hover { color: var(--accent); }
.featured .a .author-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 1px; }
/* Author spotlight on the store landing. */
.author-spotlight { max-width: 66rem; margin: 0 auto; padding: 1.8rem 1.4rem 0; animation: vfade 0.3s ease; }
.author-spotlight .spotlight-head { display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: center; }
.author-spotlight .author-portrait { width: 6.5rem; aspect-ratio: 4 / 5; display: block; }
.author-spotlight .author-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.author-spotlight h2 { font-weight: 400; font-size: 28px; line-height: 1.1; margin: 6px 0 0; }
.author-spotlight h2 a { color: inherit; text-decoration: none; }
.author-spotlight .bio { font-size: 14px; color: var(--muted); margin: 8px 0 0; max-width: 56ch; }
.author-spotlight .spotlight-books { max-width: none; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 2rem 1.6rem; }
.author-spotlight::after { content: ""; display: block; height: 1px; background: var(--border); margin-top: 1.8rem; }
.rating-summary.no-dist { grid-template-columns: 1fr; }

/* No italic Ethiopic face exists: never let the browser synthesize a slanted
   fidel for the italic author lines (Agent UI review 2026-09-04). */
html { font-synthesis: none; }

/* ---------- store search (search sprint) ----------
   The one search box in the public topbar: a hairline input with the
   gold focus ring, a dropdown of instant results underneath. The box
   sits between the brand and the nav; on a phone it wraps to its own
   full-width row so the nav keeps its room. */
.store-search { position: relative; flex: 0 1 24rem; min-width: 9rem; }
.store-search-form { margin: 0; }
.store-search-input {
  width: 100%; min-height: 34px; padding: 0.4em 0.8em;
  font-family: var(--font-body); font-size: 14px;
  background: transparent; color: var(--text); caret-color: var(--accent);
  border: 1px solid var(--border); border-radius: 999px;
  -webkit-appearance: none; appearance: none;
}
.store-search-input::-webkit-search-decoration { -webkit-appearance: none; }
.store-search-input:hover { border-color: color-mix(in srgb, var(--text) 45%, transparent); }
.store-search-input:focus-visible {
  border-color: var(--accent); outline: 2px solid var(--accent-tint); outline-offset: 0;
}
.store-search-menu {
  position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 40;
  min-width: 18rem; max-height: min(28rem, 75vh); overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 0.3rem 0;
}
.store-search-heading {
  font-size: 10.5px; color: var(--accent); letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.55rem 0.9rem 0.2rem;
}
.store-search-option {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.42rem 0.9rem; cursor: pointer; font-size: 13.5px;
}
.store-search-option.active, .store-search-option:hover { background: var(--accent-tint); }
.store-search-option.empty { color: var(--muted); font-style: italic; cursor: default; }
.store-search-option.empty:hover { background: transparent; }
.store-search-option.more {
  border-top: 1px solid var(--border); margin-top: 0.3rem; padding-top: 0.6rem;
  color: var(--accent); font-size: 13px;
}
.store-search-option .thumb {
  flex: none; width: 2.1rem; height: 3.1rem; background: var(--surface);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.store-search-option .thumb.portrait { width: 2.4rem; height: 2.4rem; border-radius: 50%; }
.store-search-option .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-search-option .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.store-search-option .t {
  font-family: var(--font-heading); font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.store-search-option .a {
  color: var(--muted); font-size: 12px; font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.store-search-option .p { color: var(--accent-700); font-size: 12px; font-feature-settings: 'tnum'; }
@media (max-width: 44rem) {
  .topbar { flex-wrap: wrap; }
  .store-search { order: 9; flex: 1 1 100%; }
  .store-search-menu { min-width: 0; }
  /* Two rows at most on a phone: brand + nav + theme on the first, the
     search box on the second. The nav used to wrap into a third row the
     moment its links outgrew the space (a signed-in seller has six);
     now it keeps one line and scrolls sideways, no scrollbar drawn, and
     the brand yields its stretch instead of pushing the nav off the row.
     Scoped to topbars WITH a nav: the reader's button bar is untouched. */
  .topbar:has(.nav) .title { flex: 0 1 auto; min-width: 0; max-width: 46%; }
  .topbar .nav {
    flex: 1 1 0; min-width: 0; flex-wrap: nowrap; white-space: nowrap;
    overflow-x: auto; overscroll-behavior-x: contain; gap: 0.85rem;
    scrollbar-width: none; -ms-overflow-style: none; padding: 2px 0;
  }
  .topbar .nav::-webkit-scrollbar { display: none; }
  .topbar .nav a { font-size: 13.5px; }
}

/* The results page: a quiet head, the authors as a strip of portraits,
   then the same store grid as the landing. */
.search-head { max-width: 66rem; margin: 0 auto; padding: 2rem 1.4rem 0; }
.search-head h1 { margin: 0; font-weight: 400; font-size: 34px; line-height: 1.1; }
.search-head .sub { color: var(--muted); font-style: italic; margin-top: 0.3rem; }
.search-head .did-you-mean { margin-top: 0.8rem; font-size: 15px; }
.search-head .did-you-mean a { color: var(--accent); }
.search-authors, .search-books { max-width: 66rem; margin: 0 auto; padding: 1.6rem 1.4rem 0; }
.search-authors h2, .search-books h2 {
  font-size: 11px; color: var(--accent); letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 600; font-family: var(--font-body);
  margin: 0 0 0.8rem;
}
.search-books + .store-grid { padding-top: 0; }
.author-strip { display: flex; flex-wrap: wrap; gap: 1.2rem 2rem; }
.author-result {
  display: flex; align-items: center; gap: 0.8rem; color: inherit; text-decoration: none;
}
.author-result .plate { width: 3.4rem; height: 3.4rem; border-radius: 50%; overflow: hidden; flex: none; }
.author-result .plate img { width: 100%; height: 100%; object-fit: cover; display: block; }
.author-result .text { display: flex; flex-direction: column; }
.author-result .n { font-family: var(--font-heading); font-weight: 600; font-size: 18px; }
.author-result .n:hover { color: var(--accent); }
.author-result .c { color: var(--muted); font-size: 12px; font-style: italic; }
.store-card .meta .snip {
  color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 6px;
}
.store-card .meta .snip b { color: var(--accent-700); font-weight: 600; }

/* ---------- authors sprint (2026-09-24): initials tiles, the store
   landing's head and catalog, the authors directory ---------- */

/* The initials tile — wherever an author has no photo (BR.mountPortrait).
   The ground is the name's hue (BR.nameHue → --tile-h) mixed with the
   theme's surface, so it reads as a quiet tint in light, dark and true
   black alike; the mark is the initial(s) in the heading face. Colour
   as tint, type as the mark, no placeholder words. */
.initials-tile {
  --tile-h: 200;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; box-sizing: border-box;
  background: color-mix(in srgb, hsl(var(--tile-h) 48% 52%) 26%, var(--surface));
  color: color-mix(in srgb, hsl(var(--tile-h) 40% 30%) 55%, var(--text));
  font-family: var(--font-heading); font-weight: 600; font-style: normal;
  font-size: 40px; line-height: 1; letter-spacing: 0.03em;
  user-select: none;
}
:root[data-theme="dark"] .initials-tile, :root[data-theme="black"] .initials-tile {
  color: color-mix(in srgb, hsl(var(--tile-h) 45% 78%) 60%, var(--text));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .initials-tile {
    color: color-mix(in srgb, hsl(var(--tile-h) 45% 78%) 60%, var(--text));
  }
}
/* The plate's sepia is for photographs; an initials tile keeps its own
   colour, and the striped "no photo" ground has nothing left to say. */
.plate:has(.initials-tile) { filter: none; }
.author-portrait:has(.initials-tile) { background: none; }
.author-page .author-portrait .initials-tile { font-size: 72px; }
.author-spotlight .author-portrait .initials-tile,
.author-entry .author-portrait .initials-tile { font-size: 40px; }
.author-result .plate .initials-tile { font-size: 22px; }
.store-search-option .thumb.portrait .initials-tile { font-size: 15px; }

/* Store landing head: the promise as the headline; "Store" stays the
   nav word (design audit #2: the generic word was the h1). */
.store-hero .kicker {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent);
}
.store-hero h1 { margin-top: 8px; }
.store-hero .tagline {
  color: var(--muted); font-size: 15px; line-height: 1.6;
  max-width: 54ch; margin: 12px auto 0;
}
/* Language (and page count) on every card and on the hero. */
.store-card .meta .l, .featured .l {
  color: var(--muted); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; margin-top: 5px; font-feature-settings: 'tnum';
}
.featured .l { margin-top: 8px; }
/* The catalog head: "All books", the count, and language chips (drawn
   only when the catalog spans more than one language) — outlined, the
   active one tinted, like the review sort. */
.catalog-head { max-width: 66rem; margin: 0 auto; padding: 2rem 1.4rem 0; }
.catalog-head .shelf-head h2 { font-weight: 400; font-size: 28px; }
.catalog-head .count { color: var(--muted); font-size: 12.5px; font-feature-settings: 'tnum'; }
.catalog-head + .store-grid { padding-top: 1.2rem; }
.lang-filter { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin-top: 0.9rem; }
.lang-filter .l {
  font-size: 11px; color: var(--muted); letter-spacing: 0.08em;
  text-transform: uppercase; margin-inline-end: 0.3rem;
}
.lang-filter button { font-size: 13px; padding: 0.3em 0.85em; gap: 0.4em; }
.lang-filter button .n { color: var(--muted); font-size: 11.5px; font-feature-settings: 'tnum'; }
.lang-filter button.active { background: var(--accent-tint); color: var(--accent); border-color: var(--accent); }
.lang-filter button.active .n { color: inherit; }
/* The spotlight's top line carries the door to every author. */
.author-spotlight .spotlight-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}
.author-spotlight .all-authors { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.author-spotlight .all-authors:hover { color: var(--accent); }

/* The authors directory (/authors): one entry per author — portrait
   plate, name, count and languages, one line of bio, and the books as
   small covers — the same hairline rhythm as the rest of the store. */
.page-head { max-width: 66rem; margin: 0 auto; padding: 2.4rem 1.4rem 0; animation: vfade 0.3s ease; }
.page-head .kicker {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent);
}
.page-head h1 { margin: 6px 0 0; font-weight: 400; font-size: 42px; line-height: 1.05; }
.page-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 8px; font-feature-settings: 'tnum'; }
.page-head::after { content: ""; display: block; height: 1px; background: var(--border); margin-top: 1.6rem; }
.authors-list { max-width: 66rem; margin: 0 auto; padding: 0 1.4rem 4rem; animation: vfade 0.3s ease; }
.author-entry {
  display: grid; grid-template-columns: 7rem 1fr; gap: 1.6rem;
  padding: 1.8rem 0; border-bottom: 1px solid var(--border); align-items: start;
}
.author-entry .author-portrait { width: 7rem; display: block; }
.author-entry .author-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.author-entry h2 { margin: 0; font-weight: 400; font-size: 28px; line-height: 1.1; }
.author-entry h2 a { color: inherit; }
.author-entry h2 a:hover { color: var(--accent); }
.author-entry .meta-line { font-size: 12.5px; color: var(--muted); margin-top: 6px; font-feature-settings: 'tnum'; }
.author-entry .bio { font-size: 14px; line-height: 1.7; margin: 10px 0 0; max-width: 60ch; }
.entry-books { display: flex; flex-wrap: wrap; gap: 1rem 0.9rem; margin-top: 1rem; }
.mini-card { width: 5.6rem; color: inherit; text-decoration: none; display: block; }
.mini-card:hover .t { color: var(--accent); }
.mini-card .cover { display: block; aspect-ratio: 2 / 3; width: 100%; box-shadow: var(--shadow-sm); }
.mini-card .cover:not(:has(img)) {
  font-size: 10px; line-height: 1.15;
  box-shadow: inset 4px 0 0 var(--accent-800); padding: 10% 8% 10% calc(8% + 4px);
}
.mini-card .cover:not(:has(img))::before { width: 14px; margin-bottom: 6px; }
.mini-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-card .t {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-family: var(--font-heading); font-weight: 600; font-size: 12.5px; line-height: 1.25; margin-top: 6px;
}
@media (max-width: 560px) {
  .author-entry { grid-template-columns: 5.2rem 1fr; gap: 1rem; padding: 1.4rem 0; }
  .author-entry .author-portrait { width: 5.2rem; }
  .author-entry h2 { font-size: 23px; }
  .author-spotlight .spotlight-top { flex-wrap: wrap; gap: 0.2rem 1rem; }
  .store-hero h1 { font-size: 34px; }
  .catalog-head .shelf-head { flex-wrap: wrap; }
}

/* ---------- Account deletion (App Store 5.1.1(v)) ----------
   The one place a warn-coloured stroke marks an action: set apart below
   everything else on the settings page, never filled (Classical). */
.danger-zone { margin-top: 2.6rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.danger-zone .delete-facts { margin: 0.4rem 0 1rem; padding-left: 1.1rem; }
.danger-zone .delete-facts li { margin-bottom: 0.35rem; }
button.danger { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
button.danger:hover { background: color-mix(in srgb, var(--warn) 8%, transparent); }
button.danger:active { background: color-mix(in srgb, var(--warn) 16%, transparent); }
#delete-confirm { margin-top: 0.4rem; }
#delete-confirm .inline-actions { margin-top: 0.8rem; }
