/* PrismShelf 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; }

/* ---------- 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; }

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; }

.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); }
.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; }
.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) 1fr; gap: 3.2rem;
  align-items: start; animation: vfade 0.3s ease;
}
.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: 1fr; }
  .author-portrait { width: 100%; max-width: 14rem; margin: 0 auto; }
}

/* 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); }
