/* MyVolumes: "Midnight Library". Tokens and components are documented in BRAND.md and on /styleguide/. */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin.5d2835174326.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-latin.e35fad09c70b.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Derived tints, shared by every theme */
  --value-bg: color-mix(in srgb, var(--value) 12%, transparent);
  --danger-bg: color-mix(in srgb, var(--danger) 14%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --text-prose: color-mix(in srgb, var(--text) 88%, var(--text-muted));
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Instrument Sans", -apple-system, "Segoe UI", sans-serif;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px -14px rgba(20, 18, 12, .35);
  --wrap: 1200px;
}
:root, :root[data-theme="light"], :root[data-theme="auto"] {
  /* Oatmeal Tweed, light (the brand): oatmeal pages, tweed-brown actions, brown logo with a red bookmark */
  color-scheme: light;
  --bg: #EEE8DD; --bg-2: #F2EDE4;
  --surface: #F8F4EC; --surface-2: #F0ECE4; --surface-3: #E5E1D9;
  --line: #CFCBC3; --line-soft: #E1DDD5;
  --text: #2A251E; --text-muted: #59554D; --text-faint: #68635B;
  --accent: #6B573F; --accent-hi: #5B4A36; --on-accent: #FFFFFF;
  --value: #406B4E; --flag: #9E3B2F; --danger: #B42318; --danger-text: #B42318;
  --logo-a: #7A4A2A; --logo-b: #E8D9BC; --logo-c: #B3312C; --logo-word: #7A4A2A;
  --chart-1: #16865F; --chart-2: #6250D6; --chart-3: #A86F00;
}
:root[data-theme="dark"] {
  /* Oatmeal Tweed, dark: warm tweed brown-black, tan actions, green kept for money only */
  color-scheme: dark;
  --bg: #15130F; --bg-2: #1A1713;
  --surface: #1F1C17; --surface-2: #292621; --surface-3: #34302B;
  --line: #423F38; --line-soft: #322E29;
  --text: #EDE7DB; --text-muted: #ACA79E; --text-faint: #928E85;
  --accent: #C9A47C; --accent-hi: #D1B290; --on-accent: #0B0B0B;
  --value: #9FC49A; --flag: #E58A7F; --danger: #EC7A6E; --danger-text: #F4B2A9;
  --logo-a: #9A6239; --logo-b: #E8D9BC; --logo-c: #C9433A; --logo-word: #B07446;
  --chart-1: #199E70; --chart-2: #9085E9; --chart-3: #C98500;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    /* "Match my device": the dark values when the device prefers dark */
    color-scheme: dark;
    --bg: #15130F; --bg-2: #1A1713;
    --surface: #1F1C17; --surface-2: #292621; --surface-3: #34302B;
    --line: #423F38; --line-soft: #322E29;
    --text: #EDE7DB; --text-muted: #ACA79E; --text-faint: #928E85;
    --accent: #C9A47C; --accent-hi: #D1B290; --on-accent: #0B0B0B;
    --value: #9FC49A; --flag: #E58A7F; --danger: #EC7A6E; --danger-text: #F4B2A9;
    --logo-a: #9A6239; --logo-b: #E8D9BC; --logo-c: #C9433A; --logo-word: #B07446;
    --chart-1: #199E70; --chart-2: #9085E9; --chart-3: #C98500;
  }
}
:root[data-theme="contrast"] {
  /* High contrast: every text pair 7:1 or better */
  color-scheme: dark;
  --bg: #000000; --bg-2: #0A0A0A;
  --surface: #0F0F0F; --surface-2: #1A1A1A; --surface-3: #262626;
  --line: #8A8A8A; --line-soft: #5C5C5C;
  --text: #FFFFFF; --text-muted: #E6E6E6; --text-faint: #CFCFCF;
  --accent: #E3C29C; --accent-hi: #EDD3B3; --on-accent: #000000;
  --value: #B3E8B0; --flag: #FFA394; --danger: #FF9A8C; --danger-text: #FFC6BD;
  --logo-a: #C08550; --logo-b: #F2E6CF; --logo-c: #FF6B5E; --logo-word: #D49766;
  --chart-1: #199E70; --chart-2: #9085E9; --chart-3: #C98500;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--text) 4.5%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hi); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.02rem; font-family: var(--font-ui); font-weight: 600; letter-spacing: 0; }
p { margin: 0 0 1em; }
code { font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
main { flex: 1; }
main.wrap { padding-top: 26px; padding-bottom: 72px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: var(--radius-sm); z-index: 100; }
.skip:focus { left: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand .accent { color: var(--accent); }
/* Logo lock-up: the book mark sits on the wordmark's x-height band, 0.28em from the M. */
.logo { display: inline-flex; align-items: center; gap: .28em; font-family: var(--font-display); font-weight: 800; font-size: 1.36rem; letter-spacing: -.028em; line-height: 1; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo:hover { color: var(--text); }
.logo:hover .logo-mark { transform: translateY(-.06em) rotate(-4deg); }
.logo-mark { width: 1.3em; height: 1.075em; flex: none; transform: translateY(-.04em); transition: transform .25s cubic-bezier(.2, .7, .2, 1); }
.logo-word .accent { color: var(--logo-word, var(--accent)); }
.logo-lg { font-size: 2.2rem; }
@media (prefers-reduced-motion: reduce) { .logo-mark { transition: none; } }
.nav { display: flex; align-items: center; gap: 4px; }
.nav > a, .nav summary { color: var(--text-muted); text-decoration: none; font-size: .94rem; font-weight: 500; padding: 7px 11px; border-radius: var(--radius-sm); cursor: pointer; }
.nav > a:hover, .nav summary:hover, .nav details[open] summary { color: var(--text); background: var(--surface-2); }
.nav .pill-link { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.nav .pill-link:hover { color: var(--accent-hi); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.dropdown { position: relative; }
.dropdown summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary svg { width: 12px; height: 12px; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; display: grid; gap: 2px; }
.dropdown-menu a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm); font-size: .93rem; display: flex; justify-content: space-between; gap: 12px; }
.dropdown-menu a:hover { background: var(--surface-2); }
.dropdown-menu .count { color: var(--text-faint); font-size: .85rem; }
.header-search { flex: 1; max-width: 320px; margin-left: auto; position: relative; }
.header-search input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 8px 12px 8px 34px; font: inherit; font-size: .92rem; }
.header-search svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.header-search input::placeholder { color: var(--text-faint); }
.account { display: flex; align-items: center; gap: 8px; }
.account form { margin: 0; }
.site-header .menu-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: .94rem; line-height: 1;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hi); color: var(--on-accent); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--surface-3); background: var(--surface); }
.btn-sm { padding: 7px 12px; font-size: .86rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn[aria-pressed="true"] { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger-text); }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
form.inline { display: inline; margin: 0; }

/* ---------- Pills, badges, chips ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--text-muted); padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.pill svg { width: 13px; height: 13px; color: var(--value); }
.pill b { color: var(--text); font-weight: 600; }
.badge { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; padding: 4px 8px; border-radius: 4px; line-height: 1.2; }
.badge-accent { background: var(--accent); color: var(--on-accent); }
.badge-flag { background: color-mix(in srgb, var(--flag) 14%, transparent); color: var(--flag); border: 1px solid color-mix(in srgb, var(--flag) 45%, transparent); }
.badge-outline { color: var(--text-muted); border: 1px solid var(--line); }
.badge-value { background: var(--value-bg); color: var(--value); border: 1px solid color-mix(in srgb, var(--value) 35%, transparent); }
.chip-value { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 700; font-size: .9rem; color: var(--value); background: var(--value-bg); border: 1px solid color-mix(in srgb, var(--value) 30%, transparent); padding: 5px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.chip-value.none { color: var(--text-faint); background: transparent; border-color: var(--line); font-weight: 500; }

/* ---------- Hero ---------- */
.hero { position: relative; text-align: center; padding: clamp(56px, 10vw, 120px) 0 clamp(48px, 8vw, 96px); isolation: isolate; }
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(80px); opacity: .55; pointer-events: none; }
.hero::before { width: 520px; height: 520px; left: -160px; top: -120px; background: radial-gradient(circle, color-mix(in srgb, var(--value) 28%, transparent), transparent 65%); }
.hero::after { width: 520px; height: 520px; right: -160px; bottom: -200px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%); }
.hero h1 { font-size: clamp(2.5rem, 6.4vw, 4.6rem); line-height: 1.04; max-width: 15ch; margin: 0 auto .35em; letter-spacing: -.025em; }
.gradient-text { background: linear-gradient(100deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 50%, var(--logo-word)) 45%, var(--logo-word) 85%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lede { max-width: 620px; margin: 0 auto 28px; color: var(--text-muted); font-size: 1.1rem; }
.hero .lede b { color: var(--text); }
.hero-search { display: flex; max-width: 560px; margin: 0 auto 22px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.hero-search input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 1.05rem; padding: 15px 18px; }
.hero-search input::placeholder { color: var(--text-faint); }
.hero-search button { border-radius: 0; padding: 0 26px; }
.hero .pills { justify-content: center; margin-bottom: 18px; }
.hero .helper { color: var(--text-faint); font-size: .9rem; margin-bottom: 26px; }
.hero .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
  .hero > *:nth-child(2) { animation-delay: .06s; }
  .hero > *:nth-child(3) { animation-delay: .12s; }
  .hero > *:nth-child(4) { animation-delay: .18s; }
  .hero > *:nth-child(5) { animation-delay: .24s; }
  .hero > *:nth-child(6) { animation-delay: .30s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.section { margin: 56px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.eyebrow { display: block; font-family: var(--font-ui); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.page-title { margin: 8px 0 24px; }
.page-title h1 { margin-bottom: 6px; }
.page-title .lede { color: var(--text-muted); font-size: 1.05rem; max-width: 70ch; margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-links { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards and covers ---------- */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 14px; text-decoration: none; color: var(--text); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
a.card:hover, .card.linked:hover { transform: translateY(-3px); border-color: var(--line); box-shadow: var(--shadow); color: var(--text); }
.card-media { aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--bg-2); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.card-media img { width: 100%; height: 100%; object-fit: contain; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.04rem; line-height: 1.25; margin: 0 0 4px; }
.card-title a { color: inherit; text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.card-meta { font-size: .84rem; color: var(--text-muted); margin: 0 0 10px; }
.card-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card .badge-accent { display: block; text-align: left; margin-bottom: 10px; }

/* ---------- Generated covers (books without a photograph) ----------
   A cloth binding (or, for paperbacks, a printed card cover) drawn in CSS. Colour and design come
   from the slug via the cover_style filter, so a book always looks the same. Type is sized from
   the cover's own width (container units), so one cover reads from a 64px list thumbnail up to
   the edition hero. These are physical objects: the same colours in light and dark mode. */
.cloth {
  --cloth: #2E3B55; --ink: #EED9A6; --gilt: rgba(226, 186, 110, .82); --ink-soft: rgba(238, 217, 166, .76);
  --foil: linear-gradient(180deg, #F8E7B2 0%, #D9B467 45%, #B88A3E 62%, #F1D896 100%);
  position: relative; width: 100%; height: 100%; container-type: inline-size; overflow: hidden;
  display: grid; grid-template-rows: 1fr auto; padding: 14% 9% 9% 17%; text-align: center; color: var(--ink);
  background-color: var(--cloth);
  background-image:
    /* spine: shadow, hinge groove, highlight */
    linear-gradient(90deg, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .16) 4.5%, rgba(255, 255, 255, .13) 7%, rgba(0, 0, 0, .3) 8.2%, rgba(255, 255, 255, .06) 9.6%, rgba(0, 0, 0, 0) 15%),
    /* fore-edge and foot shading */
    linear-gradient(270deg, rgba(0, 0, 0, .28) 0, rgba(0, 0, 0, 0) 5%),
    linear-gradient(180deg, rgba(255, 255, 255, .09) 0, rgba(255, 255, 255, 0) 28%, rgba(0, 0, 0, 0) 72%, rgba(0, 0, 0, .22) 100%),
    /* rubbed corners */
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 13%),
    radial-gradient(circle at 100% 100%, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 12%),
    /* cloth weave and grain */
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .022) 0 1px, rgba(255, 255, 255, 0) 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .032) 0 1px, rgba(0, 0, 0, 0) 1px 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .28), inset 0 0 38px rgba(0, 0, 0, .38);
}
.cloth-deco { position: absolute; inset: 0; pointer-events: none; }
.cloth-body { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 0; }
.cloth-title {
  font-family: var(--font-display); font-weight: 700; font-size: max(7px, 11cqi); line-height: 1.1; letter-spacing: .005em;
  text-wrap: balance; overflow-wrap: anywhere; color: var(--ink);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden;
}
.cloth-s .cloth-title { font-size: max(8px, 13.5cqi); }
.cloth-l .cloth-title { font-size: max(7px, 9cqi); }
.cloth-xl .cloth-title { font-size: max(6px, 7.4cqi); -webkit-line-clamp: 6; line-clamp: 6; }
.cloth-author { margin-top: 6cqi; font: 600 max(5px, 4.6cqi) / 1.2 var(--font-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.cloth-imprint { align-self: end; font: 600 max(5px, 3.8cqi) / 1.2 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cloth-orn { display: none; }
/* Gold foil lettering on dark cloth */
.cloth:not(.cloth-light):not(.cloth-paper):not(.cloth-d2) .cloth-title { background-image: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .55)); }
/* Small covers: keep the title, drop the small print */
@container (max-width: 120px) { .cloth-imprint { display: none; } }
@container (max-width: 90px) { .cloth-author { display: none; } }

/* Cloths: period bookcloth colours. 10 to 12 are light buckrams, stamped in dark ink. */
.cloth-c0 { --cloth: #6E2A27; }  /* oxblood */
.cloth-c1 { --cloth: #23423A; }  /* library green */
.cloth-c2 { --cloth: #233656; }  /* navy buckram */
.cloth-c3 { --cloth: #6A4428; }  /* tan calf */
.cloth-c4 { --cloth: #3A2B4A; }  /* plum */
.cloth-c5 { --cloth: #3B4630; }  /* olive */
.cloth-c6 { --cloth: #1F4A4F; }  /* teal */
.cloth-c7 { --cloth: #2C2B2E; }  /* charcoal */
.cloth-c8 { --cloth: #7A3B1E; }  /* rust */
.cloth-c9 { --cloth: #3A4A5C; }  /* slate */
.cloth-c10 { --cloth: #C49A45; }  /* ochre buckram */
.cloth-c11 { --cloth: #9DAA88; }  /* sage linen */
.cloth-c12 { --cloth: #DCCFAF; }  /* cream linen */
.cloth-light { --ink: #2A2116; --ink-soft: rgba(42, 33, 22, .72); --gilt: rgba(42, 33, 22, .55); }
.cloth-light .cloth-title { text-shadow: 0 1px 0 rgba(255, 255, 255, .25); }

/* Design 0: double gilt rules at head and foot */
.cloth-d0 .cloth-deco::before, .cloth-d0 .cloth-deco::after { content: ""; position: absolute; left: 17%; right: 8%; height: 3px; border-top: 1px solid var(--gilt); border-bottom: 1px solid var(--gilt); }
.cloth-d0 .cloth-deco::before { top: 8%; }
.cloth-d0 .cloth-deco::after { bottom: 8%; }
.cloth-d0 { padding-top: 16%; padding-bottom: 16%; }

/* Design 1: gilt panel, a double frame */
.cloth-d1 .cloth-deco { inset: 6% 6% 6% 15%; border: 1px solid var(--gilt); border-radius: 1px; }
.cloth-d1 .cloth-deco::before { content: ""; position: absolute; inset: 3.5cqi; border: 1px solid var(--gilt); opacity: .55; }
.cloth-d1 { padding: 16% 13% 13% 21%; }

/* Design 2: printed paper label */
.cloth-d2 .cloth-body { align-self: start; margin-top: 8%; padding: 7cqi 6cqi 6cqi; width: 100%;
  background: linear-gradient(180deg, #F3EAD2, #E6D9B8); color: #2A2116; border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(80, 55, 25, .25), inset 0 0 0 2.6cqi #F0E5C9, inset 0 0 0 calc(2.6cqi + 1px) rgba(80, 55, 25, .35); }
.cloth-d2 .cloth-title { color: #2A2116; font-size: max(7px, 9.5cqi); }
.cloth-d2.cloth-s .cloth-title { font-size: max(8px, 11.5cqi); }
.cloth-d2.cloth-l .cloth-title { font-size: max(6px, 8cqi); }
.cloth-d2.cloth-xl .cloth-title { font-size: max(6px, 6.6cqi); }
.cloth-d2 .cloth-author { color: #6A5638; margin-top: 4cqi; }
.cloth-d2 { grid-template-rows: auto 1fr auto; }
.cloth-d2 .cloth-imprint { grid-row: 3; }

/* Design 3: blind-stamped frame with a gilt fleuron between title and author */
.cloth-d3 .cloth-deco { inset: 5% 5% 5% 14%; border: 1px solid rgba(0, 0, 0, .32); box-shadow: 0 1px 0 rgba(255, 255, 255, .09), inset 0 1px 0 rgba(255, 255, 255, .06); }
.cloth-light.cloth-d3 .cloth-deco { border-color: rgba(42, 33, 22, .3); }
.cloth-d3 .cloth-orn { display: block; position: relative; width: 46%; height: 1px; margin-top: 6cqi; background: linear-gradient(90deg, transparent, var(--gilt) 30%, var(--gilt) 70%, transparent); }
.cloth-d3 .cloth-orn::before { content: ""; position: absolute; left: 50%; top: 50%; width: 3.4cqi; height: 3.4cqi; min-width: 4px; min-height: 4px; background: var(--cloth); border: 1px solid var(--gilt); transform: translate(-50%, -50%) rotate(45deg); }
.cloth-d3 .cloth-author { margin-top: 5cqi; }
.cloth-d3 { padding: 15% 11% 11% 19%; }

/* Paperbacks: a printed card cover with colour bands, not cloth */
.cloth-paper {
  --ink: #1E1A14; --ink-soft: rgba(30, 26, 20, .7);
  grid-template-rows: 27% 1fr 20%; padding: 0 0 0 6%;
  background-color: #EFE8D8;
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, .22) 0, rgba(0, 0, 0, 0) 2.6%, rgba(255, 255, 255, .5) 3.2%, rgba(0, 0, 0, .06) 4.2%, rgba(0, 0, 0, 0) 6%),
    linear-gradient(180deg, var(--cloth) 0 27%, rgba(0, 0, 0, 0) 27% 80%, var(--cloth) 80%),
    linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 35%, rgba(0, 0, 0, 0) 75%, rgba(0, 0, 0, .1)),
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 10%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 0 0 24px rgba(60, 40, 10, .18);
}
.cloth-paper .cloth-deco::before { content: ""; position: absolute; left: 6%; right: 0; top: 27%; height: 2px; background: rgba(0, 0, 0, .12); }
.cloth-paper .cloth-body { grid-row: 2; padding: 0 9%; }
.cloth-paper .cloth-title { font-family: var(--font-ui); font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.cloth-paper .cloth-author { margin-top: 4cqi; color: var(--ink-soft); }
.cloth-paper .cloth-imprint { grid-row: 3; align-self: center; color: rgba(255, 248, 232, .9); opacity: 1; padding: 0 8%; }

.cover-frame { border-radius: var(--radius); overflow: hidden; background: var(--bg-2); aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line-soft); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); }
.cover-frame img { width: 100%; height: 100%; object-fit: contain; }

/* Segment / series tiles */
.tile { display: flex; flex-direction: column; gap: 6px; padding: 20px; min-height: 140px; background: linear-gradient(160deg, var(--surface), var(--bg-2)); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); position: relative; overflow: hidden; transition: border-color .2s ease, transform .2s ease; }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-2px); color: var(--text); }
.tile h3 { margin: 0; font-size: 1.15rem; }
.tile .tile-meta { color: var(--text-muted); font-size: .88rem; }
.tile .tile-arrow { margin-top: auto; color: var(--accent); font-size: .88rem; font-weight: 600; }
.tile::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); }

/* ---------- Featured panel ---------- */
.feature { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: center; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow); }
.feature h3 { font-size: 1.6rem; margin-bottom: 4px; }
.feature .stats-inline { display: flex; gap: 28px; flex-wrap: wrap; margin: 16px 0 20px; }
.stats-inline .figure { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-inline .label { display: block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }

.feature-badges { margin-bottom: 12px; }
.feature h3 a { color: inherit; text-decoration: none; }
.feature h3 a:hover { color: var(--accent-hi); }
.figure.accent { color: var(--accent); }
.section-head.centred { justify-content: center; text-align: center; }
.footer-blurb { margin: 12px 0 16px; max-width: 38ch; }

/* ---------- Plans ---------- */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 900px; margin: 0 auto; }
.plan { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; display: flex; flex-direction: column; }
.plan.pro { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: linear-gradient(170deg, color-mix(in srgb, var(--accent) 8%, transparent), var(--surface) 40%); }
.plan .ribbon { position: absolute; top: -12px; right: 24px; }
.plan h3 { font-size: 1.5rem; margin: 0 0 4px; }
.plan .price { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.plan .price small { font-family: var(--font-ui); font-size: .95rem; font-weight: 500; color: var(--text-muted); }
.plan .price-note { color: var(--text-muted); font-size: .88rem; min-height: 1.4em; }
.plan ul { list-style: none; padding: 0; margin: 18px 0 24px; display: grid; gap: 10px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; font-size: .94rem; }
.plan li svg { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--value); }
.plan li.locked { color: var(--text-faint); }
.plan li.locked svg { color: var(--text-faint); }
.plan .btn { margin-top: auto; }
.billing-toggle { display: flex; justify-content: center; margin: 0 auto 24px; }
.billing-toggle .seg { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.billing-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.billing-toggle label { padding: 7px 16px; border-radius: 999px; cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--text-muted); }
.billing-toggle .save { color: var(--value); font-size: .78rem; margin-left: 4px; }
#bill-monthly:checked ~ .billing-toggle label[for="bill-monthly"],
#bill-annual:checked ~ .billing-toggle label[for="bill-annual"] { background: var(--surface-3); color: var(--text); }
#bill-monthly:focus-visible ~ .billing-toggle label[for="bill-monthly"],
#bill-annual:focus-visible ~ .billing-toggle label[for="bill-annual"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.price-annual { display: none; }
#bill-annual:checked ~ .plans .price-annual { display: block; }
#bill-annual:checked ~ .plans .price-monthly { display: none; }

/* ---------- Detail page ---------- */
.breadcrumbs { font-size: .85rem; color: var(--text-faint); margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs span[aria-hidden] { color: var(--surface-3); }
.detail-head { display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: start; margin-bottom: 28px; }
.detail-head .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.detail-head h1 { font-size: clamp(2rem, 3.6vw, 2.8rem); margin-bottom: 4px; }
.detail-head h1 .sub { color: var(--text-muted); font-weight: 600; }
.detail-head .byline { color: var(--text-muted); margin-bottom: 16px; }
.detail-head .pills { margin-bottom: 16px; }
.verified { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text-muted); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 16px; }
.verified svg { width: 16px; height: 16px; color: var(--value); flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.community { color: var(--text-muted); font-size: .9rem; margin: 12px 0 0; }
.callout { display: flex; gap: 16px; align-items: center; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%); border: 1px solid var(--line-soft); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 16px 20px; margin: 0 0 28px; color: var(--text); text-decoration: none; }
.callout svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.callout strong { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.callout span { color: var(--text-muted); font-size: .9rem; }
.layout-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 20px; }
.panel h2 { font-size: 1.35rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.spec { width: 100%; border-collapse: collapse; font-size: .9rem; }
.spec th { text-align: left; font-weight: 500; color: var(--text-faint); padding: 9px 12px 9px 0; vertical-align: top; width: 42%; border-bottom: 1px solid var(--line-soft); font-family: var(--font-ui); letter-spacing: 0; text-transform: none; font-size: .9rem; }
.spec td { padding: 9px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }
.value-card .eyebrow { margin-bottom: 4px; }
.value-card .big { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1; }
.range { margin: 16px 0 6px; }
.range-track { position: relative; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--surface-3), var(--value) 60%, var(--accent)); }
.range-labels { display: flex; justify-content: space-between; font-size: .78rem; color: var(--text-faint); margin-top: 6px; }
.buy { border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: linear-gradient(170deg, color-mix(in srgb, var(--accent) 7%, transparent), var(--surface) 50%); }
.buy-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.disclosure { font-size: .8rem; color: var(--text-faint); margin: 0; }
.printing { scroll-margin-top: 80px; }
.printing h3 { margin: 0; }
.printing .state { color: var(--text-muted); font-weight: 600; }
.points { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.points li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); font-size: .92rem; }
.points .where { color: var(--accent); font-weight: 600; }
.points .indicates { display: block; color: var(--value); font-size: .82rem; margin-top: 2px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 20px; margin: 0 0 16px; }
.facts div { font-size: .92rem; }
.facts dt { color: var(--text-faint); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }
.facts dd { margin: 2px 0 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
table.data th { text-align: left; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
table.data a { color: var(--text); text-decoration-color: var(--surface-3); }
table.data a:hover { color: var(--accent); }
td.num, th.num, table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Prose (sanitised Markdown: no classes inside) ---------- */
.prose { max-width: 72ch; font-size: 1.02rem; }
.prose h2 { font-size: 1.5rem; margin: 1.6em 0 .5em; }
.prose h3 { font-size: 1.2rem; margin: 1.4em 0 .4em; }
.prose p, .prose li { color: var(--text-prose); }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--text); }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0 1.4em; font-size: .94rem; }
.prose th { text-align: left; color: var(--text-faint); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }

/* ---------- Series checklist ---------- */
.completion { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 24px; align-items: center; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px 22px; margin: 0 0 22px; }
.completion p { margin: 0; }
.tally { color: var(--text-muted); }
.tally strong { font-family: var(--font-display); font-size: 1.6rem; color: var(--accent); font-weight: 800; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--value), var(--accent)); border-radius: 999px; }
@media (prefers-reduced-motion: no-preference) { .progress span { animation: fill .7s ease-out both; transform-origin: left; } }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.checklist td.tick { width: 4em; text-align: center; color: var(--value); font-weight: 700; }
.checklist td:first-child { color: var(--text-faint); font-variant-numeric: tabular-nums; width: 5em; }
.checklist tr.owned td { background: color-mix(in srgb, var(--value) 5%, transparent); }

/* ---------- Collection dashboard ---------- */
.stats { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; margin: 0 0 32px; }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px 20px; }
.stat p { margin: 0; }
.stat-label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.stat:first-child .stat-value { color: var(--accent); }
.stat-value .to { font-family: var(--font-ui); font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.stat-note { font-size: .82rem; color: var(--text-faint); }
.key { font-size: .85rem; color: var(--text-muted); display: flex; gap: 14px; align-items: center; margin: 0 0 10px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.swatch.low { background: var(--chart-1); }
.swatch.high { background: var(--chart-2); }
.bars { list-style: none; padding: 0; margin: 0 0 32px; }
.bars li { display: grid; grid-template-columns: minmax(9em, 14em) 1fr minmax(9em, auto); gap: 6px 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.bar-track { display: flex; height: 12px; }
.bar-track span { display: block; height: 100%; }
.bar-low { background: var(--chart-1); }
.bar-range { background: var(--chart-2); margin-left: 2px; }
.bar-track span:last-child { border-radius: 0 4px 4px 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Forms ---------- */
.form-card { max-width: 480px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 28px; }
.form-card.wide { max-width: 720px; }
.isbn-form input[name=isbn] { font-size: 1.25rem; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.scan-video { width: 100%; max-width: 420px; border-radius: var(--radius); border: 1px solid var(--line); background: #000; margin-top: 12px; }
.printing-choices { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Messages, empty states ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.messages li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--value); padding: 11px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); animation: toast-in .35s cubic-bezier(.2, .7, .2, 1) both; transition: opacity .4s, transform .4s; }
.messages li svg { width: 18px; height: 18px; flex: none; color: var(--value); }
.messages li.error svg, .messages li.warning svg { color: var(--danger); }
.messages li.leaving { opacity: 0; transform: translateY(-4px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .messages li { animation: none; transition: none; } }
.messages li.warning, .messages li.error { border-left-color: var(--danger); }
.empty { text-align: center; padding: 40px 24px; border: 1px dashed var(--line); border-radius: var(--radius-lg); color: var(--text-muted); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.empty svg { width: 36px; height: 36px; color: var(--accent); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 46ch; margin: 0 auto 16px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--line-soft); padding: 48px 0 28px; color: var(--text-muted); font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 32px; margin-bottom: 32px; }
.footer-grid h4 { color: var(--text); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-grid a:not(.btn):not(.logo) { color: var(--text-muted); text-decoration: none; }
.footer-grid a:not(.btn):not(.logo):hover { color: var(--text); }
.footer-base { border-top: 1px solid var(--line-soft); padding-top: 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-faint); font-size: .82rem; }

/* ---------- Style guide ---------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.swatches figure { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.swatches .chip { height: 64px; }
.swatches figcaption { padding: 10px 12px; font-size: .82rem; }
.swatches code { background: none; padding: 0; color: var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .grid, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-head, .layout-split, .feature { grid-template-columns: minmax(0, 1fr); }
  .detail-head .cover-frame, .feature .cover-frame { max-width: 240px; }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:first-child { grid-column: 1 / -1; }
  .completion { grid-template-columns: minmax(0, 1fr); }
  .points li { grid-template-columns: 1fr; gap: 2px; }
  .bars li { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 520px) {
  .grid, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 10px; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-search button { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.hero-compact { padding-bottom: 40px; }
.printing-actions { margin-top: 16px; }
.layout-split > aside { position: sticky; top: 80px; }
@media (max-width: 860px) { .layout-split > aside { position: static; } }
.hero::before, .hero::after { max-width: 80vw; max-height: 80vw; }
@media (max-width: 520px) {
  .hero h1 { font-size: 2.35rem; }
  .hero .eyebrow { font-size: .62rem; letter-spacing: .1em; }
  .feature { padding: 18px; gap: 18px; }
  .feature .cover-frame { max-width: 180px; }
  .detail-head .cover-frame { max-width: 200px; }
  .actions .btn { flex: 1 1 auto; }
  .panel { padding: 16px; }
  .spec th { width: 46%; }
}

/* ---------- Layout system (templates/layouts) ---------- */
.page-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; margin: 6px 0 28px; }
.page-title-main { min-width: 0; flex: 1 1 520px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-actions:empty, .eyebrow:empty, .lede:empty, .byline:empty, .form-intro:empty, .form-after:empty, .badges:empty { display: none; }
.form-layout { max-width: 520px; margin: 24px auto; }
.form-layout.wide { max-width: 760px; }
.form-card h1 { font-size: 2rem; }
.form-intro { color: var(--text-muted); margin-bottom: 18px; }
.form-after { margin-top: 18px; color: var(--text-muted); font-size: .92rem; }
.form-after p { margin: 6px 0; }
.faq details { border-top: 1px solid var(--line-soft); padding: 12px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line-soft); }
.faq summary { cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-family: var(--font-ui); font-weight: 600; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 10px 0 0; color: var(--text-prose); }
.sources ul { margin: 0 0 12px; padding-left: 1.1em; color: var(--text-muted); font-size: .92rem; }
.sources li { margin-bottom: 4px; }
.related-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.related-item { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .15s ease; }
.related-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); }
.related-title { font-family: var(--font-display); font-weight: 700; }
.related-item .faint { font-size: .84rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 24px; }
.quick-answer { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 8%, transparent), var(--surface) 55%); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius-lg); padding: 20px 22px; margin: 0 0 24px; }
.quick-answer h2 { font-size: 1.2rem; margin-bottom: 12px; }
.quick-answer dl { margin: 0; display: grid; gap: 12px; }
.quick-answer dt { font-weight: 600; color: var(--text); }
.quick-answer dd { margin: 2px 0 0; color: var(--text-muted); }
.updated { margin-top: 18px; font-size: .86rem; }
.mt-0 { margin-top: 0; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; } .mb-0 { margin-bottom: 0; }

/* ---------- Form fields (templates/django/forms) ---------- */
.search-page { margin: 0 0 24px; max-width: 640px; }
.btn-block { width: 100%; }

/* ---------- Charts (pricing/charts.py + templates/partials/charts) ---------- */
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-label { fill: var(--text-faint); font-size: 12px; font-family: var(--font-ui); }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: color-mix(in srgb, var(--chart-2) 16%, transparent); stroke: none; }
.chart-point { stroke: var(--surface); stroke-width: 2; cursor: pointer; }
.chart-point:focus { outline: none; stroke: var(--text); }
.series-1 { stroke: var(--chart-1); fill: var(--chart-1); }
.series-2 { stroke: var(--chart-2); fill: var(--chart-2); }
.series-3 { stroke: var(--chart-3); fill: var(--chart-3); }
.chart-line.series-1, .chart-line.series-2, .chart-line.series-3 { fill: none; }
.series-median { stroke: var(--text); fill: var(--text); }
.chart-line.series-median { stroke-dasharray: 5 5; fill: none; opacity: .8; }
.chart-point.on-line { stroke-width: 1.5; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .84rem; color: var(--text-muted); margin-top: 8px; }
.chart-legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .swatch.series-1 { background: var(--chart-1); }
.chart-legend .swatch.series-2 { background: var(--chart-2); }
.chart-legend .swatch.series-3 { background: var(--chart-3); }
.chart-legend .swatch.series-median { background: var(--text); }
.chart-legend .swatch.band { background: color-mix(in srgb, var(--chart-2) 35%, transparent); }
.chart-table { margin-top: 10px; font-size: .88rem; }
.chart-table summary { cursor: pointer; color: var(--text-muted); }
.chart-table .table-wrap { margin-top: 8px; }
.chart-empty { position: relative; border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; color: var(--surface-3); background: color-mix(in srgb, var(--bg-2) 50%, transparent); }
.chart-empty svg { width: 100%; height: 110px; display: block; }
.chart-empty p { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; margin: 0; padding: 18px; color: var(--text-muted); font-size: .92rem; }
.chart-empty strong { color: var(--text); font-family: var(--font-display); font-size: 1.05rem; }
.chart-tip { position: absolute; z-index: 90; pointer-events: none; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; font-size: .82rem; box-shadow: var(--shadow); white-space: nowrap; }
.range-bars { list-style: none; padding: 0; margin: 0 0 6px; }
.range-bars li { display: grid; grid-template-columns: minmax(8em, 11em) 1fr minmax(8em, auto); gap: 4px 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: .92rem; }
.rb-track { position: relative; height: 10px; background: var(--surface-2); border-radius: 999px; }
.rb-bar { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--chart-1), var(--chart-2)); }
.rb-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 520px) { .range-bars li { grid-template-columns: 1fr auto; } .rb-track { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Dashboards, guides, report ---------- */
.stats-4 { grid-template-columns: 2fr 1fr 1fr 1.3fr; }
.stats-3 { grid-template-columns: 2fr 1fr 1fr; }
.stat-note.up { color: var(--value); }
.stat-note.down { color: var(--danger-text); }
.usage { background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 18px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.top-list { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; }
.top-list li { padding-left: 4px; }
.top-list li::marker { color: var(--accent); font-family: var(--font-display); font-weight: 700; }
.top-list a { display: block; color: var(--text); text-decoration: none; font-family: var(--font-display); font-weight: 700; margin-bottom: 4px; }
.top-list a:hover { color: var(--accent); }
.series-progress { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.series-progress li { display: grid; grid-template-columns: minmax(10em, 18em) 1fr auto; gap: 14px; align-items: center; }
.series-progress a { color: var(--text); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 0 0 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--text-faint); letter-spacing: .04em; }
.filters select { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; font: inherit; font-size: .9rem; min-width: 150px; }
.shelf-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.shelf-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.shelf-list li a:first-child { font-family: var(--font-display); font-weight: 700; color: var(--text); }
.shelf-list .btn { margin-left: auto; }
.article-split { grid-template-columns: 240px minmax(0, 1fr); }
.toc ol { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: .92rem; }
.toc a { color: var(--text-muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.guide-body h2 { scroll-margin-top: 80px; }
.report tfoot th, .report tfoot td { padding: 12px 14px; border-top: 2px solid var(--line); }
@media (max-width: 860px) {
  .stats-4 { grid-template-columns: 1fr 1fr; }
  .dash-grid, .article-split { grid-template-columns: minmax(0, 1fr); }
  .series-progress li { grid-template-columns: 1fr auto; }
  .series-progress .progress { grid-column: 1 / -1; grid-row: 2; }
}
@media print {
  :root, :root[data-theme] { --bg: #fff; --bg-2: #fff; --surface: #fff; --surface-2: #f2f2f2; --text: #111; --text-muted: #444; --text-faint: #555; --line: #ccc; --line-soft: #ddd; }
  body { background: #fff; color: #111; }
  .site-header, .site-footer, .breadcrumbs, .page-actions, .skip, .messages { display: none !important; }
  .table-wrap { border: 0; overflow: visible; }
  table.data th { background: #f2f2f2; color: #333; }
  a { color: #111; text-decoration: none; }
}

/* ---------- Staff SEO panel (?seo=1) ---------- */
.seo-panel { position: fixed; right: 16px; bottom: 16px; z-index: 95; width: min(420px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; background: var(--bg-2); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; font-size: .84rem; }
.seo-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.seo-panel-head a { margin-left: auto; }
.seo-score { font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.seo-score.good { color: var(--value); } .seo-score.ok { color: var(--accent); } .seo-score.bad { color: var(--danger-text); }
.seo-panel dl { margin: 0 0 10px; display: grid; gap: 6px; }
.seo-panel dt { color: var(--text-faint); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
.seo-panel dd { margin: 0; color: var(--text); word-break: break-word; }
.seo-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.seo-checks .pass { color: var(--value); } .seo-checks .fail { color: var(--danger-text); }
.seo-checks span { color: var(--text-faint); }
.mover .move { font-weight: 700; font-variant-numeric: tabular-nums; margin-top: auto; }
.mover .move.up { color: var(--value); } .mover .move.down { color: var(--danger-text); }
.brand-lg { font-size: 2rem; } .brand-lg svg { width: 44px; height: 44px; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"]::after { content: ""; display: block; height: 2px; margin-top: 3px; background: var(--accent); border-radius: 2px; }
.printing h4 { margin: 26px 0 12px; }
.printing h4:first-of-type { margin-top: 18px; }
.chart-table { margin-bottom: 6px; }
.panel .bars { margin-bottom: 0; }
.top-list .sub { display: block; font-family: var(--font-body, inherit); font-weight: 400; font-size: .82rem; color: var(--text-faint); margin: -2px 0 6px; }

/* ---------- Theme switch (footer) and density ---------- */
.theme-switch { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--text-faint); }
.theme-switch select { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 5px 8px; font: inherit; }
.theme-switch .btn { padding: 5px 10px; }
.js .theme-switch .btn { display: none; }
[data-density="compact"] { --radius-lg: 12px; }
[data-density="compact"] .section { margin-bottom: 36px; }
[data-density="compact"] .grid { gap: 14px; }
[data-density="compact"] .panel { padding: 16px 18px; }
[data-density="compact"] table.data td, [data-density="compact"] table.data th { padding-top: 7px; padding-bottom: 7px; }
.sw-bg { background: var(--bg); }
.sw-bg-2 { background: var(--bg-2); }
.sw-surface { background: var(--surface); }
.sw-surface-2 { background: var(--surface-2); }
.sw-line { background: var(--line); }
.sw-text { background: var(--text); }
.sw-text-muted { background: var(--text-muted); }
.sw-text-faint { background: var(--text-faint); }
.sw-accent { background: var(--accent); }
.sw-value { background: var(--value); }
.sw-flag { background: var(--flag); }
.sw-danger { background: var(--danger); }
.sw-chart-1 { background: var(--chart-1); }
.sw-chart-2 { background: var(--chart-2); }
.sw-chart-3 { background: var(--chart-3); }
.value-card .big.muted { color: var(--text-faint); }

/* ---------- Form system: every form on the site ---------- */
.stack .field, .form .field { margin: 0 0 18px; }
.field > label:not(.switch), .field legend, form.stack > p > label { display: block; font-size: .88rem; font-weight: 600; margin: 0 0 7px; color: var(--text); }
.field.is-required > label:not(.switch)::after { content: " *"; color: var(--accent); font-weight: 700; }
.field input:is([type=text], [type=email], [type=password], [type=number], [type=date], [type=search], [type=url], [type=tel]),
.field select, .field textarea, form.stack > p > :is(input, select, textarea) {
  width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; font: inherit; font-size: 1rem; line-height: 1.35; transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { min-height: 104px; resize: vertical; }
.field select { appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%); background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.field :is(input, select, textarea):hover { border-color: color-mix(in srgb, var(--line) 60%, var(--text-faint)); }
.field :is(input, select, textarea):focus-visible, form.stack > p > :is(input, select, textarea):focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); background: var(--surface); }
.field :is(input, select, textarea):disabled { opacity: .55; cursor: not-allowed; }
.field ::placeholder { color: var(--text-faint); opacity: 1; }
.field .helptext { display: block; color: var(--text-faint); font-size: .82rem; line-height: 1.45; margin-top: 6px; }
.field .helptext ul { margin: 4px 0 0; padding-left: 1.1em; }
.field.has-error :is(input, select, textarea) { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface-2)); }
.errorlist { list-style: none; padding: 0; margin: 7px 0 0; color: var(--danger-text); font-size: .86rem; font-weight: 500; }
.errorlist li::before { content: "! "; font-weight: 800; }
.form-errors { background: var(--danger-bg); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); border-left: 3px solid var(--danger); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 20px; color: var(--danger-text); font-size: .9rem; }
.form-errors .errorlist { margin: 0; }
.error-summary { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.error-summary a { color: var(--danger-text); }
.field fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field input[type=file] { width: 100%; color: var(--text-muted); font: inherit; font-size: .9rem; }
.field input[type=file]::file-selector-button { font: inherit; font-weight: 600; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; margin-right: 12px; cursor: pointer; }
/* Switches (every BooleanField) */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius); transition: border-color .15s; }
.switch:hover { border-color: var(--line); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { flex: none; position: relative; width: 38px; height: 22px; margin-top: 1px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); transition: background .18s, border-color .18s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform .18s cubic-bezier(.2, .7, .2, 1), background .18s; }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--on-accent); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.switch-text { display: grid; gap: 2px; }
.switch-label { font-weight: 600; font-size: .94rem; }
.switch .helptext { margin-top: 0; }
/* Radio cards (every RadioSelect) */
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.radio-card { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); cursor: pointer; transition: border-color .15s, background .15s; }
.radio-card input { accent-color: var(--accent); margin: 3px 0 0; }
.radio-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.radio-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-2)); }
.radio-card:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent); }
.radio-card-body { font-weight: 600; font-size: .92rem; }
/* Password show/hide */
.input-reveal { position: relative; }
.input-reveal input { padding-right: 72px !important; }
.reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: var(--text-muted); font: inherit; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.reveal:hover, .reveal[aria-pressed="true"] { color: var(--accent); }
/* Grouped fieldsets (copy form) */
.fieldset-group { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px 2px; margin: 0 0 18px; background: color-mix(in srgb, var(--bg-2) 50%, transparent); }
.fieldset-group > legend { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; padding: 0 6px; margin-left: -6px; color: var(--text); }
.fieldset-group .grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 520px) { .fieldset-group .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }

/* ---------- Auth pages (layouts/auth.html) ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 0; margin: 28px 0 56px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.auth-main { padding: 44px 48px; display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: clamp(2rem, 3.4vw, 2.5rem); margin: 6px 0 8px; }
.auth-card .btn-lg { margin-top: 4px; }
.auth-switch { padding-top: 16px; margin-top: 16px !important; border-top: 1px solid var(--line-soft); }
.fine-print { font-size: .8rem; color: var(--text-faint); margin: 12px 0 0; }
.auth-aside { position: relative; overflow: hidden; padding: 48px 48px 40px; background:
  radial-gradient(circle at 85% 110%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
  radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--value) 14%, transparent), transparent 50%), var(--bg-2);
  border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 14px; }
.auth-aside::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px); background-size: 20px 20px; pointer-events: none; }
.auth-aside > * { position: relative; }
.pilcrow { position: absolute !important; right: 18px; top: -46px; font-family: var(--font-display); font-weight: 800; font-size: 15rem; line-height: 1; color: var(--accent); opacity: .13; pointer-events: none; user-select: none; }
.auth-aside h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); line-height: 1.12; max-width: 15ch; margin: 0 0 6px; }
.rubric-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.rubric-list li { position: relative; padding-left: 1.5em; color: var(--text-muted); line-height: 1.5; }
.rubric-list li::before { content: "\00B6"; position: absolute; left: 0; top: 0; color: var(--accent); font-family: var(--font-display); font-weight: 800; }
.rubric-list b { color: var(--text); }
.auth-shelf { display: flex; align-items: flex-end; gap: 0; margin-top: auto; padding-top: 18px; height: 150px; border-bottom: 3px solid color-mix(in srgb, var(--accent) 55%, var(--line)); }
.auth-shelf img { width: 92px; height: 132px; object-fit: cover; border-radius: 4px 6px 6px 4px; margin-right: -14px; box-shadow: -6px 6px 18px -6px rgba(0, 0, 0, .7); transform: rotate(calc((var(--i) - 2) * 3deg)) translateY(calc(var(--i) * 1px)); transform-origin: bottom center; transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.auth-shelf:hover img { transform: rotate(0) translateY(-4px); margin-right: 4px; }
.auth-count { font-size: .9rem; color: var(--text-faint); margin: 4px 0 0; }
.auth-count b { color: var(--value); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-main { padding: 30px 22px; }
  .auth-aside { border-left: 0; border-top: 1px solid var(--line-soft); padding: 32px 22px; }
  .pilcrow { font-size: 10rem; top: -30px; }
}
@media (prefers-reduced-motion: reduce) { .auth-shelf img { transition: none; } }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 26px; align-items: start; }
.settings-nav { position: sticky; top: 80px; display: grid; gap: 14px; }
.settings-nav ul { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.settings-nav ul a { display: grid; gap: 1px; padding: 10px 12px; border-radius: var(--radius); color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.settings-nav ul a small { color: var(--text-faint); font-size: .78rem; }
.settings-nav ul a:hover { background: var(--surface-2); }
.settings-nav ul a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-left-color: var(--accent); }
.settings-nav ul a[aria-current="page"] span { color: var(--accent); font-weight: 700; }
.me { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.me div { display: grid; gap: 2px; min-width: 0; }
.me strong { font-family: var(--font-display); font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .faint { font-size: .84rem; }
.me .badge { justify-self: start; margin-top: 3px; }
.settings-main { display: grid; gap: 20px; }
.settings-panel h2 { font-size: 1.4rem; margin: 0 0 4px; }
.settings-panel > .muted { margin: 0 0 20px; }
.settings-panel form.stack { max-width: 560px; }
.settings-sub { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.email-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 10px; }
.notice { background: color-mix(in srgb, var(--flag) 10%, transparent); border: 1px solid color-mix(in srgb, var(--flag) 40%, transparent); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--line-soft)); }
.danger-zone h2 { color: var(--danger-text); }
.btn-danger { background: var(--danger); color: #1A0508; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-text); }
.avatar { display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 50%; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; color: var(--bg); background: var(--accent); }
.avatar-value { background: var(--value); } .avatar-flag { background: var(--flag); } .avatar-chart-3 { background: var(--chart-3); } .avatar-danger { background: var(--danger); }
.avatar-picks { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar-pick { position: relative; cursor: pointer; border-radius: 50%; padding: 3px; border: 2px solid transparent; }
.avatar-pick input { position: absolute; opacity: 0; }
.avatar-pick:has(input:checked) { border-color: var(--text); }
.avatar-pick:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.theme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.theme-card { position: relative; display: grid; gap: 6px; padding: 10px 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); cursor: pointer; transition: border-color .15s, transform .15s; }
.theme-card:hover { transform: translateY(-2px); }
.theme-card input { position: absolute; opacity: 0; }
.theme-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card:has(input:checked) .theme-name::after { content: " \2713"; color: var(--accent); }
.theme-card:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.theme-preview { display: grid; grid-template-rows: 14px 1fr; height: 104px; border-radius: 8px; overflow: hidden; background: var(--p-bg); border: 1px solid color-mix(in srgb, var(--p-text) 12%, transparent); }
.tp-bar { display: flex; align-items: center; gap: 4px; padding: 0 7px; background: color-mix(in srgb, var(--p-surface) 70%, var(--p-bg)); }
.tp-bar i { width: 9px; height: 7px; border-radius: 2px; background: var(--p-accent); }
.tp-bar b { width: 26px; height: 4px; border-radius: 2px; background: var(--p-text); opacity: .8; }
.tp-card { margin: 9px; padding: 9px; border-radius: 6px; background: var(--p-surface); display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-content: start; }
.tp-title { grid-column: 1 / -1; height: 7px; width: 70%; border-radius: 3px; background: var(--p-text); }
.tp-line { height: 4px; width: 90%; border-radius: 2px; background: color-mix(in srgb, var(--p-text) 45%, transparent); }
.tp-chip { grid-row: 2 / 4; grid-column: 2; align-self: center; width: 30px; height: 12px; border-radius: 999px; background: color-mix(in srgb, var(--p-value) 25%, transparent); border: 1px solid var(--p-value); }
.tp-btn { height: 12px; width: 44px; border-radius: 4px; background: var(--p-accent); }
.theme-name { font-weight: 700; padding: 0 4px; }
.theme-blurb { font-size: .8rem; color: var(--text-faint); padding: 0 4px; line-height: 1.4; }
.theme-try { position: absolute; right: 16px; top: 16px; font-size: .72rem; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .45); padding: 2px 7px; border-radius: 999px; text-decoration: none; opacity: 0; transition: opacity .15s; }
.theme-card:hover .theme-try, .theme-try:focus { opacity: 1; }
@media (max-width: 860px) {
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; }
  .settings-nav ul { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .settings-nav ul a small { display: none; }
}

/* ---------- Browse (catalogue/browse.html) ---------- */
.browse-bar { display: flex; gap: 10px; align-items: stretch; margin: 0 0 18px; }
.browse-input { position: relative; flex: 1; display: flex; align-items: center; }
.browse-input > svg { position: absolute; left: 18px; width: 20px; height: 20px; color: var(--text-faint); pointer-events: none; }
.browse-input input { width: 100%; font: inherit; font-size: 1.12rem; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 52px 16px 50px; transition: border-color .15s, box-shadow .15s; }
.browse-input input::placeholder { color: var(--text-faint); }
.browse-input input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.browse-bar .btn { padding-left: 26px; padding-right: 26px; }
.kbd { position: absolute; right: 14px; font: 600 .78rem var(--font-ui); color: var(--text-faint); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 7px; background: var(--bg-2); }
.browse-input input:focus ~ .kbd, .browse-input input:not(:placeholder-shown) ~ .kbd { display: none; }
.hub-areas { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; }
.hub-area { display: inline-flex; align-items: center; gap: 10px; padding: 9px 12px 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem; transition: border-color .15s, transform .15s; }
.hub-area b { font-size: .78rem; color: var(--text-faint); background: var(--surface-2); border-radius: 999px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.hub-area:hover { border-color: var(--accent); transform: translateY(-1px); color: var(--text); }
.hub-row { margin-bottom: 28px; }
.browse { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; transition: opacity .18s; }
.browse.is-loading { opacity: .55; }
.facets { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
.facets-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.facets-head h2 { font-size: 1.15rem; margin: 0; }
.facets-close { display: none; }
.link-quiet { font-size: .84rem; color: var(--text-muted); }
.facet { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.facet h3 { font: 700 .72rem/1.2 var(--font-ui); text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); margin: 0 0 8px; }
.facet ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.facet-opt { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .92rem; }
.facet-opt:hover { background: var(--surface); color: var(--text); }
.facet-opt .box { width: 16px; height: 16px; border: 1.5px solid var(--text-faint); border-radius: 4px; display: grid; place-items: center; transition: background .12s, border-color .12s; }
.facet-opt[role="radio"] .box { border-radius: 50%; }
.facet-opt.on .box { background: var(--accent); border-color: var(--accent); }
.facet-opt.on .box::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.facet-opt[role="radio"].on .box::after { width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--on-accent); transform: none; }
.facet-opt.on .lbl { font-weight: 700; }
.facet-opt .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-opt .n { font-size: .78rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.facet-opt.empty { opacity: .45; }
.facet-more summary { cursor: pointer; font-size: .84rem; color: var(--accent); padding: 6px 0 2px; list-style: none; }
.facet-more summary::-webkit-details-marker { display: none; }
.facet-more[open] summary { display: none; }
.facet-note { font-size: .76rem; color: var(--text-faint); margin: 6px 0 0; }
.results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.results-bar .count { margin: 0 auto 0 0; color: var(--text-muted); }
.results-bar .count b { color: var(--text); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.results-bar q { color: var(--text); font-weight: 600; }
.filters-button { display: none; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary svg { width: 14px; height: 14px; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px; padding: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; }
.menu-list a { padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .92rem; }
.menu-list a:hover { background: var(--surface-3); }
.menu-list a[aria-checked="true"] { color: var(--accent); font-weight: 700; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle a { padding: 6px 12px; font-size: .86rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.view-toggle a + a { border-left: 1px solid var(--line); }
.view-toggle a[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 12px; border-radius: 999px; font-size: .86rem; font-weight: 600; text-decoration: none; color: var(--text); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.chip span { font-size: 1.05rem; line-height: 1; color: var(--accent); }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip-clear { background: none; border-color: var(--line); color: var(--text-muted); padding-right: 12px; }
.notice.exact { display: flex; gap: 10px; align-items: center; }
.notice svg { width: 18px; height: 18px; flex: none; }
.browse-results .notice { margin: 0 0 16px; }
mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.results-list td { vertical-align: top; }
.rl-title { font-family: var(--font-display); font-weight: 700; color: var(--text); text-decoration: none; }
.rl-title:hover { color: var(--accent); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; color: var(--text-muted); }
.more-nav { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 26px 0 0; }
.show-more.is-loading { opacity: .6; pointer-events: none; }
.browse-empty svg { width: 34px; height: 34px; color: var(--text-faint); }
.owned-flag { position: absolute; z-index: 2; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 3px 8px 3px 6px; border-radius: 999px; color: var(--bg); background: var(--value); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.owned-flag svg { width: 13px; height: 13px; }
.owned-flag.wanted { background: var(--flag); }
.card { position: relative; }
@media (max-width: 900px) {
  .browse { grid-template-columns: minmax(0, 1fr); }
  .filters-button { display: inline-flex; }
  .facets { position: fixed; inset: 0; top: 0; z-index: 100; max-height: none; padding: 18px 20px 40px; background: var(--bg); transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .7, .2, 1); visibility: hidden; }
  .facets-toggle:checked ~ .facets { transform: none; visibility: visible; }
  .facets-close { display: inline-flex; }
  .browse-bar .btn { display: none; }
  .browse-input input { font-size: 1rem; padding-top: 14px; padding-bottom: 14px; }
  .kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) { .facets, .browse, .hub-area { transition: none; } }

/* ---------- Search suggestions (header, hero) ---------- */
.header-search, .hero-search { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 90; min-width: 320px; max-height: 70vh; overflow-y: auto; padding: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-align: left; }
.suggest-group { margin: 6px 8px 4px; font: 700 .68rem var(--font-ui); text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); }
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.suggest-item img, .suggest-icon { width: 28px; height: 38px; flex: none; object-fit: cover; border-radius: 3px; background: var(--surface-3); }
.suggest-icon { height: 28px; border-radius: 50%; position: relative; }
.suggest-icon::after { position: absolute; inset: 0; display: grid; place-items: center; font: 800 .8rem var(--font-display); color: var(--text-muted); }
.suggest-icon.author::after { content: "A"; } .suggest-icon.series::after { content: "#"; } .suggest-icon.area::after { content: "\00B6"; color: var(--accent); }
.suggest-icon.book { border-radius: 2px 4px 4px 2px; height: 38px; background: linear-gradient(90deg, rgba(0,0,0,.35) 0 4px, transparent 4px), color-mix(in srgb, var(--accent) 35%, var(--surface-3)); } .suggest-icon.book::after { content: ""; } .suggest-icon.search::after { content: "\2192"; color: var(--accent); }
.suggest-item > span:last-child { display: grid; min-width: 0; }
.s-main { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-sub { font-size: .78rem; color: var(--text-faint); }
.suggest-item:hover, .suggest-item.active { background: var(--surface-3); }
.suggest-item.active { box-shadow: inset 3px 0 0 var(--accent); }
.suggest-all { border-top: 1px solid var(--line-soft); margin-top: 4px; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.header-search { min-width: 190px; }
@media (min-width: 1081px) { .nav .nav-isbn { display: none; } }
.nav > a, .nav summary { white-space: nowrap; }

/* ---------- Colour options page (/palettes/) and preview bar ---------- */
.palette-families { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 30px; }
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 540px), 1fr)); gap: 22px; }
.palette { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); scroll-margin-top: 80px; }
.palette.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.palette.is-fav .pi-fav { color: var(--accent); }
.palette-sample { background: var(--bg); color: var(--text); padding: 0 0 18px; border-bottom: 1px solid var(--line-soft); }
.ps-header { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--bg-2); border-bottom: 1px solid var(--line-soft); }
.ps-header .logo { font-size: 1.45rem; }
.ps-nav { display: flex; gap: 12px; font-size: .84rem; color: var(--text-muted); margin-right: auto; }
.ps-on { color: var(--accent); font-weight: 700; }
.ps-body { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 18px 18px 0; }
.ps-cover { aspect-ratio: 3 / 4; border-radius: 6px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; text-align: center; padding: 10px; background: linear-gradient(90deg, rgba(0,0,0,.35) 0 8px, transparent 8px), #23423A; color: #EED9A6; font-family: var(--font-display); font-weight: 700; font-size: .9rem; box-shadow: 0 12px 24px -12px rgba(0,0,0,.8); }
.ps-cover small { font: 600 .55rem var(--font-ui); letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.ps-detail { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; }
.ps-detail h3 { margin: 0; font-size: 1.25rem; color: var(--text); }
.ps-year { color: var(--text-muted); font-weight: 600; }
.ps-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.ps-meta { margin: 0; font-size: .86rem; color: var(--text-muted); }
.ps-meta a { color: var(--accent); }
.ps-faint { margin: 0; font-size: .78rem; color: var(--text-faint); }
.ps-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ps-up { font-size: .8rem; font-weight: 700; color: var(--value); }
.ps-chart { display: flex; align-items: flex-end; gap: 6px; height: 40px; padding-top: 4px; border-bottom: 1px solid var(--line); }
.ps-chart i { flex: 1; border-radius: 3px 3px 0 0; }
.palette-info { padding: 16px 18px 18px; display: grid; gap: 10px; }
.pi-head { display: flex; align-items: center; gap: 10px; }
.pi-head h3 { margin: 0; font-size: 1.3rem; }
.pi-fav { margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 999px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--text-faint); cursor: pointer; }
.pi-fav svg { width: 18px; height: 18px; }
.pi-fav[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pi-fav[aria-pressed="true"] svg { fill: currentColor; }
.palette-info .muted { margin: 0; }
.pi-swatches { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.pi-swatches span { display: block; height: 30px; border-radius: 6px; border: 1px solid rgba(255,255,255,.12); }
.pi-swatches small { display: block; margin-top: 4px; font-size: .68rem; color: var(--text-faint); line-height: 1.3; }
.pi-swatches code { font-size: .66rem; }
.pi-checks { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pi-checks li { font-size: .74rem; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-muted); }
.pi-checks li.ok b { color: var(--value); }
.pi-checks li.bad b { color: var(--danger-text); }
.pi-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.shortlist { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.shortlist a { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--accent); color: var(--text); text-decoration: none; font-weight: 600; }
.palette-bar { position: fixed; z-index: 96; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; width: max-content; max-width: calc(100vw - 24px); padding: 10px 12px 10px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); font-size: .9rem; }
.pb-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 15%, transparent); }
@media (max-width: 640px) { .palette-bar { border-radius: var(--radius); } .ps-body { grid-template-columns: 80px minmax(0, 1fr); } .pi-swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pi-logo { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .74rem; color: var(--text-faint); }
.pi-logo span { margin-right: 4px; }
.pi-logo i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--text) 20%, transparent); }
.theme-preview.split { background: linear-gradient(115deg, var(--p-bg) 0 55%, var(--p-dark) 55% 100%); }
.logo-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.logo-tile { display: grid; place-items: center; gap: 10px; padding: 28px 18px 16px; border-radius: var(--radius); border: 1px solid var(--line-soft); }
.logo-tile small { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }

/* ---------- Browse, round two: a library index ---------- */
.browse-page .page-title { margin-bottom: 18px; }
.browse-page .page-title h1 { font-size: clamp(2rem, 3.6vw, 2.75rem); }
.browse-page .lede { max-width: 62ch; font-size: 1.02rem; }
.browse-page .browse-bar { margin-bottom: 10px; }
.search-tips { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 0 0 22px; font-size: .86rem; }
.search-tips > a { color: var(--text-muted); text-decoration: none; border-bottom: 1px dashed var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; padding-bottom: 1px; }
.search-tips > a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tips-more { margin-left: auto; }
.tips-more summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; }
.tips-more summary::-webkit-details-marker { display: none; }
.tips-more[open] { flex-basis: 100%; margin-left: 0; }
.tips-more dl { margin: 10px 0 0; padding: 14px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 22px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.tips-more dt { font-weight: 700; font-size: .84rem; }
.tips-more dd { margin: 2px 0 0; color: var(--text-muted); font-size: .84rem; }
.tips-more code, .search-tips code { font-size: .78rem; background: var(--surface-2); border-radius: 4px; padding: 1px 5px; }
.hub-areas { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; margin-bottom: 22px; mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent); padding-right: 48px; }
.hub-area { flex: none; }

/* Sticky results toolbar */
.results-bar { position: sticky; top: 60px; z-index: 30; margin: 0 -10px 14px; padding: 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.results-bar .count .faint { font-size: .9rem; }

/* Year range */
.year-range { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 6px; }
.year-range input { width: 100%; min-width: 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 8px; font: inherit; font-size: .9rem; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.year-range input::-webkit-outer-spin-button, .year-range input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.year-range input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.year-range .btn { padding: 7px 10px; }
.facets-done { display: none; margin-top: 18px; }

/* Series banner */
.series-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 14px 18px; margin: 0 0 18px; background: var(--surface); border: 1px solid var(--line-soft); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.series-banner strong { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.series-banner strong a { color: var(--text); text-decoration: none; }
.sb-progress { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: .9rem; }
.sb-progress .progress { width: 160px; }

/* Books view: one row per work, its editions as a ledger */
.work-list { display: grid; gap: 14px; }
.work-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 20px; padding: 18px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); transition: border-color .15s, box-shadow .15s; }
.work-row:hover { border-color: var(--line); box-shadow: var(--shadow); }
.wr-cover { display: block; align-self: start; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 22px -12px rgba(30, 20, 10, .55); }
.wr-cover .cover-frame { border: 0; border-radius: 0; box-shadow: none; height: 100%; }
.wr-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wr-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 18px; }
.wr-title { margin: 0; font-size: 1.32rem; line-height: 1.2; }
.wr-title a { color: var(--text); text-decoration: none; }
.wr-title a:hover { color: var(--accent); }
.wr-meta { margin: 4px 0 0; font-size: .9rem; color: var(--text-muted); }
.wr-meta a { color: var(--text-muted); }
.wr-value { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.wr-value-label { font: 700 .66rem var(--font-ui); text-transform: uppercase; letter-spacing: .14em; color: var(--text-faint); }
.wr-spot { display: flex; gap: 8px; margin: 12px 0 4px; padding: 8px 12px; font-size: .86rem; line-height: 1.45; color: var(--text-muted); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border-radius: var(--radius-sm); }
.wr-spot b { color: var(--text); }
.pilcrow-mark { font-family: var(--font-display); font-weight: 800; color: var(--logo-c); line-height: 1.3; }
.ledger { list-style: none; margin: 10px 0 0; padding: 0; }
.ledger-row { display: grid; grid-template-columns: auto minmax(24px, 1fr) auto 70px; align-items: baseline; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.ledger-row:first-child { border-top: 0; }
.lg-ed { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; color: var(--text); text-decoration: none; min-width: 0; }
.lg-ed:hover .lg-pub { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.lg-pub { font-weight: 600; }
.lg-year { font-variant-numeric: tabular-nums; font-weight: 700; }
.lg-bind { font-size: .84rem; color: var(--text-faint); }
.lg-first { font: 800 .62rem var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); border-radius: 4px; padding: 2px 5px; transform: translateY(-1px); }
.lg-dots { align-self: end; height: 0; margin-bottom: .42em; border-bottom: 2px dotted color-mix(in srgb, var(--text-faint) 55%, transparent); }
.lg-val { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.lg-money { font-weight: 700; color: var(--value); }
.lg-val small { font-size: .74rem; color: var(--text-faint); }
.lg-act { display: inline-flex; justify-content: flex-end; align-items: center; gap: 6px; }
.lg-flag svg { width: 18px; height: 18px; color: var(--value); display: block; }
.lg-want { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--text-faint); cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.lg-want svg { width: 16px; height: 16px; }
.lg-want:hover { color: var(--flag); border-color: var(--flag); }
.lg-want[aria-pressed="true"] { color: var(--flag); border-color: var(--flag); background: color-mix(in srgb, var(--flag) 12%, transparent); }
.lg-want[aria-pressed="true"] svg { fill: currentColor; }
.wr-more { display: inline-block; margin-top: 8px; font-size: .86rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.wr-more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Covers and table views */
.card-spot { margin: 6px 0 0; font-size: .78rem; line-height: 1.4; color: var(--text-faint); }
.card-spot span { color: var(--logo-c); font-weight: 800; }
.card-foot { flex-wrap: wrap; gap: 4px 8px; }
.card-sold { font-size: .74rem; color: var(--text-faint); }
.rl-spot { display: block; margin-top: 3px; font-size: .78rem; color: var(--text-faint); }

@media (max-width: 900px) {
  .facets-done { display: flex; position: sticky; bottom: 0; }
  .results-bar { top: 60px; }
  .work-row { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 14px; }
  .wr-value { align-items: flex-start; flex-direction: row; align-items: center; gap: 8px; }
  .ledger-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ed act" "val val"; row-gap: 2px; }
  .lg-ed { grid-area: ed; }
  .lg-dots { display: none; }
  .lg-val { grid-area: val; align-items: flex-start; text-align: left; flex-direction: row; gap: 8px; flex-wrap: wrap; }
  .lg-act { grid-area: act; }
  .sb-progress { margin-left: 0; }
  .tips-more { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .work-row { transition: none; } }

/* ---------- Guides ---------- */
.guide-feature { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; padding: 30px; margin: 4px 0 26px; background:
  radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%), var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.guide-feature h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 6px 0 10px; line-height: 1.12; }
.guide-feature h2 a { color: var(--text); text-decoration: none; }
.guide-feature h2 a:hover { color: var(--accent); }
.guide-feature p { color: var(--text-muted); }
.gf-meta { font-size: .86rem; }
.gf-contents { list-style: none; margin: 0; padding: 18px 20px; display: grid; gap: 2px; align-content: start; background: var(--bg-2); border-radius: var(--radius); border: 1px solid var(--line-soft); }
.gf-contents a { display: flex; gap: 12px; align-items: baseline; padding: 7px 4px; color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--line); font-size: .95rem; }
.gf-contents li:last-child a { border-bottom: 0; }
.gf-contents a:hover { color: var(--accent); }
.gf-n { font-family: var(--font-display); font-weight: 800; color: var(--logo-word); min-width: 1.2em; }
.guide-cats { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 8px; padding-bottom: 6px; scrollbar-width: thin; }
.guide-cats a { flex: none; display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; background: var(--surface); }
.guide-cats a b { font-size: .76rem; color: var(--text-faint); }
.guide-cats a:hover { border-color: var(--accent); }
.guide-section { scroll-margin-top: 80px; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.guide-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.guide-card h3 { margin: 0; font-size: 1.2rem; line-height: 1.25; }
.guide-card p { margin: 0 0 6px; color: var(--text-muted); font-size: .92rem; }
.guide-card .tile-arrow { margin-top: auto; color: var(--accent); font-weight: 600; font-size: .9rem; }
.guide-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.glossary-band, .practice-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; padding: 26px 28px; margin: 36px 0 0; border-radius: var(--radius-lg); border: 1px solid var(--line-soft); background: var(--surface); }
.glossary-band h2, .practice-band h2 { margin: 4px 0 6px; font-size: 1.5rem; }
.glossary-band p, .practice-band p { margin: 0; max-width: 60ch; }
.practice-band { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border-left: 3px solid var(--accent); }
.practice-band .actions { margin: 0; }

/* Guide page */
.guide-page .page-title .eyebrow a { color: inherit; text-decoration: none; }
.guide-page .page-title .eyebrow a:hover { color: var(--accent); }
.byline-row { font-size: .92rem; color: var(--text-faint); }
.guide-answer { max-width: 820px; }
.article-split { grid-template-columns: 240px minmax(0, 1fr); gap: 36px; align-items: start; }
.article-aside { position: sticky; top: 84px; }
.article-main { min-width: 0; max-width: 760px; }
.toc { padding: 0; }
.toc ol { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a { display: flex; gap: 10px; padding: 6px 8px; margin-left: -8px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; font-size: .9rem; line-height: 1.35; }
.toc a::before { content: counter(toc); font-family: var(--font-display); font-weight: 800; color: var(--logo-word); min-width: 1.1em; }
.toc a:hover { background: var(--surface); color: var(--text); }
.toc-glossary { font-size: .86rem; font-weight: 600; color: var(--accent); }
.toc-mobile { display: none; margin: 0 0 20px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.toc-mobile summary { cursor: pointer; padding: 12px 16px; font-weight: 700; list-style: none; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: "+"; float: right; color: var(--accent); font-weight: 800; }
.toc-mobile[open] summary::after { content: "\2212"; }
.toc-mobile ol { margin: 0; padding: 0 16px 14px 34px; display: grid; gap: 8px; }
.toc-mobile a { color: var(--text); }
.guide-body { font-size: 1.06rem; line-height: 1.7; }
.guide-body > p:first-child { font-size: 1.14rem; color: var(--text); }
.guide-body h2 { margin-top: 1.8em; font-size: 1.55rem; }
.guide-body table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95rem; display: block; overflow-x: auto; }
.guide-body th, .guide-body td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.guide-body th { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.guide-body code { font-size: .92em; background: var(--surface-2); border-radius: 4px; padding: 1px 6px; overflow-wrap: anywhere; }
a.term { color: inherit; text-decoration: underline dotted color-mix(in srgb, var(--accent) 70%, transparent); text-underline-offset: 4px; text-decoration-thickness: 2px; }
a.term:hover { color: var(--accent); }
.guide-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 34px 0 0; }
.guide-pager a { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.guide-pager a span { font-family: var(--font-ui); font-weight: 600; font-size: .8rem; }
.guide-pager .gp-next { text-align: right; grid-column: 2; }
.guide-pager a:hover { border-color: var(--accent); }

/* Glossary */
.glossary-tools { position: sticky; top: 60px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 0; margin-bottom: 8px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); }
.glossary-tools input { flex: 1 1 220px; max-width: 360px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; font: inherit; }
.glossary-tools input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.az { display: flex; flex-wrap: wrap; gap: 2px; }
.az a { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: var(--radius-sm); font-weight: 700; font-size: .86rem; color: var(--text-muted); text-decoration: none; }
.az a:hover { background: var(--surface); color: var(--accent); }
.glossary-letter { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 20px; padding: 14px 0; border-top: 1px solid var(--line-soft); scroll-margin-top: 130px; }
.gl-letter { margin: 0; font-size: 2.4rem; line-height: 1; color: var(--logo-word); }
.glossary-list { margin: 0; display: grid; gap: 14px; }
.gl-item { scroll-margin-top: 140px; padding: 10px 14px; margin: 0 -14px; border-radius: var(--radius); }
.gl-item:target { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.gl-item dt { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.gl-anchor { color: var(--text); text-decoration: none; }
.gl-anchor:hover { color: var(--accent); }
.gl-alias { font-family: var(--font-ui); font-weight: 500; font-size: .8rem; }
.gl-item dd { margin: 4px 0 0; color: var(--text-muted); }
.gl-item dd p { margin: 0; }
.gl-more { display: inline-block; margin-top: 4px; font-size: .86rem; font-weight: 600; color: var(--accent); text-decoration: none; }

@media (max-width: 860px) {
  .guide-feature { grid-template-columns: minmax(0, 1fr); padding: 22px; gap: 18px; }
  .article-split { grid-template-columns: minmax(0, 1fr); }
  .article-aside { display: none; }
  .toc-mobile { display: block; }
  .guide-pager { grid-template-columns: minmax(0, 1fr); }
  .guide-pager .gp-next { grid-column: 1; }
  .glossary-letter { grid-template-columns: minmax(0, 1fr); }
  .gl-letter { font-size: 1.8rem; margin-bottom: 4px; }
  .glossary-band, .practice-band { padding: 20px; }
  .guide-body { font-size: 1.02rem; }
}
.toc .toc-glossary::before { content: none; }
.toc .toc-glossary { padding-left: 0; margin-left: 0; }

/* ---------- Mobile audit fixes (checked at 390px) ---------- */
/* Decorative glows (hero, auth panel) may extend past the viewport; never let them cause sideways scroll. */
body { overflow-x: clip; }
@media (max-width: 860px) {
  /* The sort menu sits on the left of the toolbar on phones: open it to the right. */
  .sort-menu .menu-list { right: auto; left: 0; }
  /* Comfortable tap targets (24px and up) for small links. */
  .logo { padding: 6px 0; }
  .breadcrumbs a, .breadcrumbs span[aria-current] { display: inline-block; padding: 4px 0; }
  .search-tips > a, .tips-more summary { display: inline-block; padding: 5px 0; }
  .gl-more, .wr-more, .toc-glossary { display: inline-block; padding: 5px 0; }
  .theme-try { padding: 5px 9px; opacity: 1; }
}
/* Hero glows: up to 160px past the content, but never past the viewport edge (so no sideways
   scroll on any screen width). (100% - 100vw) / 2 is the gap between the content and the edge;
   8px allows for a desktop scrollbar. */
.hero::before { left: max(-160px, calc((100% - 100vw) / 2 + 8px)); width: min(520px, 100vw - 16px); }
.hero::after { right: max(-160px, calc((100% - 100vw) / 2 + 8px)); width: min(520px, 100vw - 16px); }
@media (max-width: 860px) {
  .settings-nav ul { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); padding-right: 36px; }
  .guide-cats { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); padding-right: 36px; }
}

/* ---------- Series index ---------- */
.your-series-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.ys-card { display: grid; gap: 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.ys-card:hover { border-color: var(--accent); }
.ys-name { font-family: var(--font-display); font-weight: 700; }
.ys-card .faint { font-size: .82rem; }
.series-tools { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; margin: 0 0 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.series-tools label { display: grid; gap: 4px; min-width: 0; }
.st-label { font: 700 .7rem var(--font-ui); text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); }
.series-tools select, .st-search input { width: 100%; min-width: 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; font: inherit; font-size: .94rem; }
.st-search { position: relative; display: flex !important; align-items: center; }
.st-search svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--text-faint); pointer-events: none; }
.st-search input { padding-left: 34px; }
.series-tools select:focus-visible, .st-search input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.series-az { margin: 4px 0 14px; gap: 2px; }
.series-az span { display: inline-grid; place-items: center; min-width: 30px; height: 30px; color: var(--line); font-weight: 700; font-size: .86rem; }
.series-az a[aria-current="true"] { background: var(--accent); color: var(--on-accent); }
.series-count { margin: 0 0 10px; color: var(--text-muted); }
.series-count b { color: var(--text); }
.series-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.series-list li + li { border-top: 1px solid var(--line-soft); }
.series-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 150px 20px; gap: 16px; align-items: center; padding: 14px 18px; color: var(--text); text-decoration: none; }
.series-row:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.series-row:hover .sr-arrow { color: var(--accent); transform: translateX(3px); }
.sr-main { display: grid; gap: 2px; min-width: 0; }
.sr-name { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; }
.sr-meta { font-size: .84rem; color: var(--text-faint); }
.sr-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sr-facts b { color: var(--text); font-weight: 600; }
.sr-progress { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: .8rem; }
.sr-arrow { color: var(--text-faint); transition: transform .15s, color .15s; }
.series-index-page:not(:has(.sr-progress)) .series-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 20px; }

/* ---------- Series page ---------- */
.series-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.stat-value.sm { font-size: 1.3rem; }
.stat-value.money, .money { color: var(--value); font-weight: 700; font-variant-numeric: tabular-nums; }
.series-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 18px; font-size: .92rem; }
.series-top .eyebrow { margin-right: 4px; }
.series-top a { color: var(--text); font-weight: 600; }
.series-top .sep { color: var(--text-faint); }
.series-progress-panel { display: block; margin-bottom: 16px; }
.spp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.spp-head .tally { margin: 0; }
.checklist-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.checklist-tools .st-search { flex: 1 1 220px; max-width: 360px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg a { padding: 8px 12px; font-size: .88rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a b { font-weight: 700; color: var(--text-faint); margin-left: 3px; }
.seg a[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg a[aria-pressed="true"] b { color: inherit; opacity: .8; }
.ranges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.ranges a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--text-muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.ranges a[aria-current="page"] { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.series-checklist .num-col { width: 4.5em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--logo-word); }
.series-checklist .title-col a { font-weight: 600; color: var(--text); }
.series-checklist .author { display: block; font-size: .82rem; margin-top: 2px; }
.series-checklist tr.owned td { background: color-mix(in srgb, var(--value) 7%, transparent); }
.series-checklist .tick { width: 64px; text-align: center; }
.owned-tick svg { width: 20px; height: 20px; color: var(--value); display: inline-block; vertical-align: middle; }

@media (max-width: 860px) {
  .series-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .series-tools .st-search { grid-column: 1 / -1; }
  .series-tools .btn { grid-column: 1 / -1; }
  .series-row, .series-index-page:not(:has(.sr-progress)) .series-row { grid-template-columns: minmax(0, 1fr) 20px; gap: 6px 12px; }
  .sr-facts, .sr-progress { grid-column: 1; }
  .sr-arrow { grid-row: 1; grid-column: 2; }
  /* Checklist rows become compact cards */
  .checklist-wrap { border: 0; overflow: visible; background: none; }
  .series-checklist, .series-checklist tbody, .series-checklist tr, .series-checklist td { display: block; }
  .series-checklist thead { display: none; }
  .series-checklist tr { display: grid; grid-template-columns: 3.4em auto minmax(0, 1fr) auto; grid-template-areas: "num title title tick" "num year value tick"; gap: 2px 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
  .series-checklist td { padding: 0; border: 0; }
  .series-checklist .num-col { grid-area: num; align-self: center; font-size: 1.05rem; width: auto; }
  .series-checklist .title-col { grid-area: title; }
  .series-checklist td[data-label="Year"] { grid-area: year; text-align: left; font-size: .84rem; color: var(--text-muted); }
  .series-checklist td[data-label="Value"] { grid-area: value; text-align: right; font-size: .84rem; }
  .series-checklist .tick { grid-area: tick; align-self: center; width: auto; }
  .series-checklist tr.owned { border-color: color-mix(in srgb, var(--value) 40%, var(--line-soft)); }
}
@media (max-width: 860px) {
  table.data.series-checklist td, table.data.series-checklist tr.owned td { padding: 0; border: 0; background: none; }
  table.data.series-checklist tr { align-items: center; }
  .series-stats { grid-template-columns: 1fr 1fr; }
  .series-stats .stat:first-child { grid-column: auto; }
  .series-stats .stat-value { font-size: 1.25rem; }
  .series-stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---------- Book and author heroes (work and author pages) ---------- */
.book-hero { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 32px; align-items: start; margin: 8px 0 28px; }
.bh-cover a, .bh-cover > .portrait { display: block; border-radius: 8px; overflow: hidden; box-shadow: 0 18px 36px -18px rgba(30, 20, 10, .6); }
.bh-cover .cover-frame { border: 0; border-radius: 0; box-shadow: none; }
.bh-main h1 { margin: 4px 0 4px; font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.05; }
.bh-main .eyebrow a { color: inherit; text-decoration: none; }
.bh-main .eyebrow a:hover { color: var(--accent); }
.bh-by { margin: 0 0 12px; font-size: 1.12rem; color: var(--text-muted); }
.bh-by a { color: var(--text); font-weight: 600; text-decoration-color: var(--line); text-underline-offset: 3px; }
.bh-main .lede { color: var(--text-muted); font-size: 1.05rem; max-width: 64ch; margin: 0 0 16px; }
.bh-facts { display: flex; flex-wrap: wrap; gap: 0; margin: 0; border-top: 1px solid var(--line-soft); }
.bh-facts > div { padding: 12px 22px 0 0; margin-right: 22px; border-right: 1px solid var(--line-soft); }
.bh-facts > div:last-child { border-right: 0; margin-right: 0; }
.bh-facts dt { font: 700 .66rem var(--font-ui); text-transform: uppercase; letter-spacing: .14em; color: var(--text-faint); }
.bh-facts dd { margin: 3px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.bh-facts dd a { color: var(--text); }
.bh-facts .money { color: var(--value); font-weight: 700; }
.portrait img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.portrait-credit { margin: 6px 0 0; font-size: .7rem; line-height: 1.35; color: var(--text-faint); }
.portrait-credit a { color: inherit; }
.portrait-fallback { display: grid; place-items: center; aspect-ratio: 1; font: 700 3rem var(--font-display); color: var(--logo-b); background: var(--logo-a); }
.spot-callout { margin: 0 0 8px; }
.ledger-head { margin: 22px 0 4px; font: 700 .72rem var(--font-ui); text-transform: uppercase; letter-spacing: .14em; color: var(--text-faint); }
.ledger-panel { padding: 4px 18px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.work-links { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.work-links a { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .15s; }
.work-links a:hover { border-color: var(--accent); }
.wl-title { font-family: var(--font-display); font-weight: 700; line-height: 1.25; }
.work-links .faint { font-size: .82rem; }
.small { font-size: .86rem; }
.author-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; font-size: .86rem; }
.author-links a { color: var(--text-muted); }
@media (max-width: 700px) {
  .book-hero { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; }
  .bh-main h1 { font-size: 1.75rem; }
  .bh-by { font-size: 1rem; }
  .bh-main .lede, .bh-facts { grid-column: 1 / -1; }
  .bh-facts > div { padding-right: 14px; margin-right: 14px; }
  .ledger-panel { padding: 2px 12px; }
}
.bh-cover .cloth { aspect-ratio: 3 / 4; height: auto; }
.portrait-figure { margin: 0; }
.portrait-figure .portrait, .bh-cover > .portrait { display: block; width: 100%; border-radius: 8px; overflow: hidden; box-shadow: 0 18px 36px -18px rgba(30, 20, 10, .6); }
@media (max-width: 700px) {
  .bh-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding-top: 10px; }
  .bh-facts > div { padding: 0; margin: 0; border: 0; }
  .bh-main .eyebrow { font-size: .62rem; }
  .portrait-credit { font-size: .62rem; }
}

/* ---------- Pro ---------- */
.pro-status { max-width: 640px; margin: 22px auto 0; text-align: left; }
.pro-stats .stats-inline { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 48px; text-align: center; }
.pro-stats .figure { font-size: 2rem; }
.compare th[scope="row"] { font-weight: 500; }
.compare td, .compare thead th:not(:first-child) { text-align: center; width: 120px; }
.compare .tick { width: 18px; height: 18px; color: var(--value); vertical-align: middle; }
@media (max-width: 600px) { .compare td, .compare thead th:not(:first-child) { width: 72px; } }
.compare tbody th { text-transform: none; letter-spacing: 0; font: 500 .95rem var(--font-ui); color: var(--text); white-space: normal; }
.compare { width: 100%; table-layout: fixed; }
.compare thead th:first-child { width: auto; }
@media (max-width: 600px) { .compare td, .compare thead th:not(:first-child) { width: 84px; font-size: .82rem; padding-left: 4px; padding-right: 4px; } .compare tbody th { font-size: .86rem; } }

/* ---------- Home ---------- */
.home-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: -8px auto 40px; max-width: 820px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.home-stats a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 8px; text-decoration: none; color: var(--text); border-left: 1px solid var(--line-soft); transition: background .15s; }
.home-stats a:first-child { border-left: 0; }
.home-stats a:hover { background: var(--surface-2); }
.home-stats .figure { font: 700 1.6rem var(--font-display); font-variant-numeric: tabular-nums; }
.home-stats .label { font: 700 .66rem var(--font-ui); text-transform: uppercase; letter-spacing: .14em; color: var(--text-faint); }
.author-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.author-tiles a { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 10px 14px; height: 100%; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.author-tiles a:hover { border-color: var(--accent); transform: translateY(-2px); }
.author-tiles img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 6px; box-shadow: 0 0 0 3px var(--surface-2); }
.at-name { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
.author-tiles .faint { font-size: .8rem; }
@media (max-width: 600px) {
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .home-stats a:nth-child(3) { border-left: 0; }
  .home-stats a:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .author-tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .author-tiles a { transition: none; } }
.unresearched { margin: 14px 0 18px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 4%, transparent); }
.unresearched h4 { margin-top: 0; }
.unresearched p { margin: 0 0 8px; }
.unresearched p:last-child { margin-bottom: 0; font-size: .88rem; }
.error-links { justify-content: center; margin-top: 18px; }
a.pill { text-decoration: none; color: var(--text); }
a.pill:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Collection ---------- */
.onboard { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: center; margin: 8px 0 40px; padding: 30px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 60%); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.onboard h2 { margin: 4px 0 8px; font-size: clamp(1.5rem, 3vw, 2rem); }
.onboard-search { margin: 18px 0 0; max-width: none; }
.onboard-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.onboard-steps a { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.onboard-steps a:hover { border-color: var(--accent); transform: translateX(3px); }
.onboard-steps strong { font-family: var(--font-display); }
.onboard-steps span:not(.step-n) { grid-column: 2; font-size: .86rem; color: var(--text-muted); }
.step-n { grid-row: span 2; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font: 700 1.05rem var(--font-display); color: var(--logo-b); background: var(--logo-a); }
@media (max-width: 800px) { .onboard { grid-template-columns: 1fr; padding: 20px; } }
@media (prefers-reduced-motion: reduce) { .onboard-steps a { transition: none; } }
@media (max-width: 640px) {
  table.stack-phone thead { display: none; }
  table.stack-phone, table.stack-phone tbody, table.stack-phone tr, table.stack-phone td { display: block; width: 100%; }
  table.stack-phone tr { padding: 12px 14px; border-top: 1px solid var(--line-soft); }
  table.stack-phone td { padding: 2px 0; border: 0; text-align: left; }
  table.stack-phone td[data-label]::before { content: attr(data-label) ": "; color: var(--text-faint); font-size: .82rem; }
  table.stack-phone td.num { text-align: left; }
}
.settings-logout { margin: 14px 0 0; }
/* Signed-in header: three buttons crowd the bar between the phone menu and wide screens.
   Log out is also on the settings page. */
@media (max-width: 1240px) and (min-width: 1141px) { .account form.inline { display: none; } }

/* Header collapses to the menu button below 1140px: the signed-in bar needs about 1,120px with Log out hidden. */
@media (max-width: 1140px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .site-header .menu-toggle { display: inline-flex; margin-left: auto; }
  .nav, .header-search, .account { display: none; width: 100%; max-width: none; margin: 0; }
  .site-header.open .nav, .site-header.open .header-search, .site-header.open .account { display: flex; flex-wrap: wrap; }
  .site-header:has(#nav-open:checked) .nav, .site-header:has(#nav-open:checked) .header-search, .site-header:has(#nav-open:checked) .account { display: flex; flex-wrap: wrap; }
  .dropdown-menu { position: static; box-shadow: none; margin-top: 6px; }
}
@media (max-width: 640px) {
  table.stack-phone tfoot tr { display: flex; flex-wrap: wrap; gap: 4px 12px; }
  table.stack-phone tfoot th, table.stack-phone tfoot td { display: inline; border: 0; padding: 0; }
}
@media print { table.stack-phone thead { display: table-header-group !important; } }

/* ---------- Authors index ---------- */
.author-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.author-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 14px; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s; }
.author-row:hover { border-color: var(--accent); }
.ar-portrait img, .ar-portrait .portrait-fallback { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; object-fit: cover; font-size: 1.2rem; }
.ar-main { display: flex; flex-direction: column; min-width: 0; }
.ar-name { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
.ar-meta { font-size: .8rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-facts { display: flex; flex-direction: column; align-items: flex-end; font-size: .78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.st-check { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
@media (max-width: 600px) { .author-list { grid-template-columns: 1fr; } .author-row { grid-template-columns: 40px minmax(0, 1fr) auto; } .author-row .sr-arrow { display: none; } .ar-portrait img, .ar-portrait .portrait-fallback { width: 40px; height: 40px; } }
@media (prefers-reduced-motion: reduce) { .author-row { transition: none; } }
.series-tools .st-check { display: flex; flex-direction: row; white-space: nowrap; align-items: center; align-self: end; padding-bottom: 10px; gap: 8px; }

/* ---------- Reviews ---------- */
.rv-summary { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; }
.rv-big { font: 700 2.4rem/1 var(--font-display); }
.rv-stars { position: relative; display: inline-block; width: 110px; height: 20px; background: linear-gradient(90deg, var(--line) 0 100%); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 110 20'%3E%3Cg fill='%23000'%3E%3Cpath id='s' d='M10 1l2.7 6 6.3.6-4.8 4.2 1.5 6.4L10 15l-5.7 3.2 1.5-6.4L1 7.6 7.3 7z'/%3E%3Cuse href='%23s' x='22.5'/%3E%3Cuse href='%23s' x='45'/%3E%3Cuse href='%23s' x='67.5'/%3E%3Cuse href='%23s' x='90'/%3E%3C/g%3E%3C/svg%3E") no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 110 20'%3E%3Cg fill='%23000'%3E%3Cpath id='s' d='M10 1l2.7 6 6.3.6-4.8 4.2 1.5 6.4L10 15l-5.7 3.2 1.5-6.4L1 7.6 7.3 7z'/%3E%3Cuse href='%23s' x='22.5'/%3E%3Cuse href='%23s' x='45'/%3E%3Cuse href='%23s' x='67.5'/%3E%3Cuse href='%23s' x='90'/%3E%3C/g%3E%3C/svg%3E") no-repeat; }
.rv-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.rv-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.rv-item { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.rv-item header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.rv-item h3 { margin: 0; font-size: 1.05rem; }
.rv-item-stars { color: var(--accent); letter-spacing: .08em; }
.rv-body { margin: 8px 0 6px; overflow-wrap: anywhere; }
.rv-meta { margin: 0; font-size: .82rem; }
.rv-write { margin-top: 18px; }
.rv-write h3 { margin-top: 0; }
.rv-state { padding: 8px 12px; border-radius: var(--radius-sm); font-size: .9rem; background: var(--surface-2); }
.rv-inline { margin: 6px 0 0; font-size: .92rem; }
.rv-inline a { color: var(--text-muted); text-decoration: none; }
.rv-inline span { color: var(--accent); }
.photo-figure .portrait img { aspect-ratio: 4 / 3; }
.portrait-caption { margin: 6px 0 0; font-size: .74rem; color: var(--text-muted); }
.wl-static { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }

/* ---------- The card catalogue (authors index and author pages) ----------
   A library catalogue room: drawer fronts for letters, ex-libris bookplates for featured authors,
   index cards (red top rule, punch hole) for each author, and a typed timeline of first editions. */
.catalogue-room { --card-rule: var(--logo-c); --brass: color-mix(in srgb, var(--accent-hi) 70%, #C9A45C); }
.cat-head { margin: 8px 0 18px; }
.cat-head h1 { margin: 4px 0 6px; font-size: clamp(2.2rem, 5vw, 3.4rem); }
.cat-head-letter { display: inline-grid; place-items: center; min-width: 1.4em; padding: 0 .2em; margin-left: .15em; font-style: italic; color: var(--accent); border-bottom: 3px solid var(--card-rule); }
.cat-head .lede { color: var(--text-muted); max-width: 62ch; margin: 0; }

/* Drawer fronts */
.drawers { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; margin: 0 0 30px; padding: 10px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), color-mix(in srgb, var(--accent) 30%, var(--surface-2)));
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .25); }
.drawer { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 7px 4px 8px; border-radius: 4px; text-decoration: none; color: var(--text);
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); box-shadow: 0 2px 0 rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .15s ease, box-shadow .15s ease; }
.drawer-label { min-width: 26px; padding: 1px 4px; text-align: center; font: 700 .9rem var(--font-display); background: color-mix(in srgb, var(--surface) 70%, #fff 0%); border: 2px solid var(--brass); border-radius: 2px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brass) 40%, transparent); }
.drawer-pull { width: 14px; height: 7px; border: 2px solid var(--brass); border-top: 0; border-radius: 0 0 8px 8px; }
a.drawer:hover { transform: translateY(2px); box-shadow: 0 0 0 rgba(0, 0, 0, .2); }
.drawer.is-open { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); transform: translateY(3px); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .25); }
.drawer.is-open .drawer-label { color: var(--accent); }
.drawer.is-empty { opacity: .38; }
a.drawer:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Ex-libris bookplates */
.bookplates { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.bookplate { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; height: 100%; padding: 16px 12px 14px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); outline: 1px solid var(--line-soft); outline-offset: -6px; border-radius: 3px; transition: transform .2s ease, box-shadow .2s ease; }
.bookplate:hover { transform: translateY(-3px) rotate(-.4deg); box-shadow: var(--shadow); }
.bp-frame { display: block; width: 92px; height: 92px; padding: 3px; border: 1px solid var(--brass); border-radius: 50%; background: var(--surface-2); }
.bp-frame img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; filter: sepia(.18) saturate(.9); }
.bp-exlibris { margin-top: 6px; font: 700 .6rem var(--font-ui); letter-spacing: .3em; text-transform: uppercase; color: var(--card-rule); }
.bp-name { font: italic 700 1.05rem/1.2 var(--font-display); }
.bp-meta { font-size: .76rem; color: var(--text-faint); }

/* Index cards */
.cat-tools { margin-top: 26px; }
.cat-cards { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.cat-card { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 16px 20px; text-decoration: none; color: var(--text);
  background: repeating-linear-gradient(180deg, transparent 0 25px, color-mix(in srgb, var(--accent) 7%, transparent) 25px 26px), var(--surface);
  border: 1px solid var(--line-soft); border-top: 2px solid var(--card-rule); border-radius: 3px; box-shadow: 0 1px 0 var(--line); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.cat-card:hover { transform: translateY(-2px); border-color: var(--line); box-shadow: var(--shadow); }
.cc-hole { position: absolute; left: 50%; bottom: 5px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
.cc-portrait img, .cc-portrait .portrait-fallback { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; object-fit: cover; font-size: 1.3rem; filter: sepia(.12); }
.cc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cc-heading { font: 700 .92rem/1.25 var(--font-ui); letter-spacing: .02em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-dates { font-weight: 500; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.cc-meta { font-size: .8rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1em; }
.cc-span { position: relative; display: block; height: 14px; margin-top: 5px; }
.cc-span::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; border-top: 1px dashed var(--line); }
.cc-span-bar { position: absolute; top: 4px; height: 5px; left: var(--l); width: var(--w); min-width: 5px; border-radius: 3px; background: var(--accent); }
.cc-span-text { position: absolute; right: 0; top: -2px; padding-left: 6px; font-size: .68rem; color: var(--text-faint); background: var(--surface); font-variant-numeric: tabular-nums; }
.cc-count { display: flex; flex-direction: column; align-items: flex-end; font-size: .78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cc-count b { font: 700 1.25rem/1 var(--font-display); color: var(--text); }
.cc-count small { font-size: .72rem; color: var(--text-faint); }

/* Author page: catalogue-card hero */
.cat-card-hero { position: relative; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 30px; align-items: start; margin: 8px 0 30px; padding: 28px 30px 34px;
  background: repeating-linear-gradient(180deg, transparent 0 31px, color-mix(in srgb, var(--accent) 6%, transparent) 31px 32px), var(--surface);
  border: 1px solid var(--line-soft); border-top: 3px solid var(--card-rule); border-radius: 4px; box-shadow: var(--shadow); }
.cat-card-hero .cc-hole { width: 12px; height: 12px; margin-left: -6px; bottom: 9px; }
.cch-portrait .bp-frame { width: 100%; height: auto; aspect-ratio: 1; padding: 5px; }
.cch-portrait .bp-empty { display: grid; place-items: center; }
.cch-portrait .bp-empty .portrait-fallback { width: 100%; height: 100%; border-radius: 50%; }
.bookplate-figure { margin: 0; }
.bookplate-figure .portrait-credit { text-align: center; }
.cch-heading { margin: 0; font: 600 .78rem var(--font-ui); letter-spacing: .12em; color: var(--text-muted); }
.cch-main h1 { margin: 2px 0 8px; font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.05; }
.cch-main .lede { margin: 0 0 16px; color: var(--text-muted); max-width: 60ch; }
.cch-main .bh-facts { margin-bottom: 12px; }

/* Biography as an essay */
.essay { max-width: 68ch; font-size: 1.06rem; line-height: 1.75; }
.essay > p:first-child::first-letter { float: left; margin: 6px 10px 0 0; font: 700 3.6rem/.8 var(--font-display); color: var(--accent); }

/* Collect cards */
.collect-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.collect-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line-soft); border-left: 3px solid var(--accent); border-radius: var(--radius); text-decoration: none; color: var(--text); }
a.collect-card:hover { border-color: var(--accent); }
.collect-card .cc-title { font: 700 1.12rem/1.25 var(--font-display); color: var(--text); text-decoration: none; }
.collect-card .money { color: var(--value); font-weight: 700; }
.cc-pubs { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: .9rem; }
.cc-pubs a { color: var(--text); }

/* First editions timeline */
.fe-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.fe-timeline::before { content: ""; position: absolute; left: 66px; top: 6px; bottom: 6px; border-left: 2px solid var(--line); }
.fe-timeline li { display: grid; grid-template-columns: 52px 30px minmax(0, 1fr); align-items: baseline; padding: 5px 0; }
.fe-year { font: 700 .95rem var(--font-display); font-variant-numeric: tabular-nums; text-align: right; color: var(--text-muted); }
.fe-dot { justify-self: center; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); position: relative; top: 1px; }
.fe-entry { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; text-decoration: none; color: var(--text); }
.fe-title { font-weight: 600; }
.fe-entry:hover .fe-title { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.fe-entry .money { color: var(--value); font-weight: 600; }

/* One orchestrated load: cards settle into place */
@media (prefers-reduced-motion: no-preference) {
  .bookplates li, .cat-cards li { animation: card-in .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(min(var(--i, 0), 12) * 35ms); }
  @keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) { .drawer, .bookplate, .cat-card { transition: none; } }

@media (max-width: 700px) {
  .drawers { grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 7px; }
  .drawer { padding: 5px 2px 6px; }
  .drawer-label { min-width: 0; width: 100%; font-size: .8rem; }
  .bookplates { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-cards { grid-template-columns: 1fr; }
  .cat-card { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; padding: 14px 12px 18px; }
  .cc-portrait img, .cc-portrait .portrait-fallback { width: 44px; height: 44px; }
  .cat-card-hero { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 18px 16px 26px; }
  .cch-main h1 { font-size: 1.8rem; }
  .cch-main .lede, .cch-main .bh-facts, .cch-main .author-links { grid-column: 1 / -1; }
  .fe-timeline::before { left: 50px; }
  .fe-timeline li { grid-template-columns: 40px 22px minmax(0, 1fr); }
  .fe-year { font-size: .82rem; }
}
@media (min-width: 1000px) { .drawers { grid-template-columns: repeat(28, minmax(0, 1fr)); gap: 5px; } .drawer-label { min-width: 0; width: 100%; padding: 1px 0; font-size: .85rem; } }
.cc-span { height: auto; margin-top: 6px; }
.cc-span::before { top: 2px; }
.cc-span-bar { top: 0; }
.cc-span-text { position: static; display: block; padding: 8px 0 0; background: none; }
.cover-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cover-credit { margin: 0; font-size: .72rem; line-height: 1.35; color: var(--text-faint); text-align: center; }
.cover-credit a { color: inherit; }

/* ---------- Guide media: credited figures, click-to-play video, diagrams ---------- */
.gm-figure, .gm-video, .gm-diagram { margin: 26px 0; }
.gm-figure img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--surface-2); }
.gm-figure figcaption, .gm-video figcaption, .gm-diagram figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; font-size: .86rem; color: var(--text-muted); }
.gm-credit { font-size: .74rem; color: var(--text-faint); }
.gm-credit a { color: inherit; }
.yt-facade { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 20% 10%, color-mix(in srgb, var(--accent) 30%, var(--surface-2)), var(--surface-2) 70%); }
.yt-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-play { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; padding: 20px;
  width: 100%; border: 0; background: none; color: var(--text); cursor: pointer; text-align: center; font: inherit; }
.yt-icon svg { width: 68px; height: 48px; fill: #C4302B; transition: transform .15s ease; }
.yt-icon .yt-tri { fill: #fff; }
.yt-play:hover .yt-icon svg, .yt-play:focus-visible .yt-icon svg { transform: scale(1.08); }
.yt-play:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.yt-text { display: flex; flex-direction: column; gap: 4px; max-width: 46ch; }
.yt-title { font: 700 1.08rem/1.3 var(--font-display); }
.yt-meta { font-size: .8rem; color: var(--text-muted); }
@media (prefers-reduced-motion: reduce) { .yt-icon svg { transition: none; } }

/* Diagrams: drawn with theme tokens so they work in light and dark */
.gm-diagram .dg { padding: 18px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow-x: auto; }
.gm-diagram svg { display: block; width: 100%; height: auto; font-family: var(--font-ui); }
.dg-ink { fill: var(--text); } .dg-muted { fill: var(--text-muted); } .dg-faint { fill: var(--text-faint); }
.dg-accent { fill: var(--accent); } .dg-flag { fill: var(--flag); } .dg-value { fill: var(--value); }
.dg-paper { fill: var(--surface-2); stroke: var(--line); } .dg-line { stroke: var(--line); fill: none; } .dg-rule { stroke: var(--accent); fill: none; stroke-width: 2; }
.dg-callout { stroke: var(--flag); fill: none; stroke-width: 1.5; stroke-dasharray: 4 3; }
.guide-card.has-image { padding-top: 0; overflow: hidden; }
.gc-image { display: block; width: calc(100% + 2 * var(--card-pad, 20px)); max-width: none; margin: 0 calc(-1 * var(--card-pad, 20px)) 12px; aspect-ratio: 16 / 9; object-fit: cover; height: auto; }
.gf-image { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius); margin-bottom: 14px; }
.sources li { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  /* Diagrams keep a readable size and scroll sideways inside their own box on phones. */
  .gm-diagram .dg { padding: 12px; -webkit-overflow-scrolling: touch; }
  .gm-diagram svg { min-width: 620px; }
  .gm-diagram .dg::after { content: "Swipe to see the whole diagram"; display: block; margin-top: 6px; font-size: .72rem; color: var(--text-faint); position: sticky; left: 0; }
}
