/* =========================================================================
   PERPUSTAKAAN — design system
   -------------------------------------------------------------------------
   Design persona: Myne (Ascendance of a Bookworm).
   The character's colours are the whole brief — "her hair was colored like
   the God of Darkness, while her eyes look like they came from the Goddess
   of Light." So: midnight-navy ink, gold-leaf accents, parchment paper,
   serif type, and her signature wooden hairpin as the brand mark.
   ========================================================================= */

/* ---------- tokens: candlelit paper ---------- */
:root {
  --bg:          #f3ebd9;
  --surface:     #fbf7ec;
  --surface-2:   #ebe0c6;
  --line:        #d8c8a4;
  --line-soft:   #e7dcc2;
  --text:        #16233a;
  --muted:       #53617a;
  --faint:       #8a8570;
  --gold:        #96741a;
  --gold-leaf:   #c9a227;
  --gold-soft:   rgba(201, 162, 39, .13);
  --gold-line:   rgba(150, 116, 26, .34);
  --on-gold:     #fdfaf1;
  --navy:        #1e3a5f;
  --navy-deep:   #0f1b2d;
  --shadow-sm:   0 1px 3px rgba(22, 35, 58, .07);
  --shadow-md:   0 10px 26px -8px rgba(22, 35, 58, .22);
  --shadow-book: 0 14px 30px -12px rgba(15, 27, 45, .42);

  --serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --sans:  'Outfit', 'Segoe UI', sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;

  --container: 1140px;
  --radius: 4px;
  --header-h: 66px;
}

/* ---------- tokens: night library ---------- */
html[data-theme='dark'] {
  --bg:          #0c1524;
  --surface:     #121d31;
  --surface-2:   #1a2740;
  --line:        #27364f;
  --line-soft:   #1e2b42;
  --text:        #f0e8d6;
  --muted:       #a7b1c3;
  --faint:       #7b8698;
  --gold:        #d9b64a;
  --gold-leaf:   #e3c264;
  --gold-soft:   rgba(217, 182, 74, .14);
  --gold-line:   rgba(217, 182, 74, .32);
  --on-gold:     #14100a;
  --navy:        #9dbbdd;
  --navy-deep:   #050a12;
  --shadow-sm:   0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md:   0 12px 30px -10px rgba(0, 0, 0, .65);
  --shadow-book: 0 18px 40px -14px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

/* Grid/flex items default to min-width:auto, which lets wide content (the
   DDC table, vertical spine labels) push the whole page sideways. Opt every
   layout track out of that so `overflow` on a child can actually do its job. */
.hero-grid > *,
.class-layout > *,
.author-layout > *,
.grid > *,
.controls > *,
.modal-body > * { min-width: 0; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* faint paper grain over the whole page */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(22, 35, 58, .045) 1px, transparent 0),
    radial-gradient(circle at 1px 1px, rgba(22, 35, 58, .03) 1px, transparent 0);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 4px 5px;
}
html[data-theme='dark'] body::before {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(240, 232, 214, .035) 1px, transparent 0),
    radial-gradient(circle at 1px 1px, rgba(240, 232, 214, .022) 1px, transparent 0);
}

body > * { position: relative; z-index: 1; }

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.01em; line-height: 1.12; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: 26px; }

.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }

/* small caps-ish label used across the chrome */
.label {
  font-family: var(--sans);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold);
}

.skip-link {
  position: absolute; left: 14px; top: -64px; z-index: 100;
  background: var(--gold-leaf); color: var(--on-gold);
  padding: 11px 18px; border-radius: 3px;
  font-family: var(--sans); font-size: 14px;
  transition: top .18s ease;
}
.skip-link:focus { top: 14px; }

:focus-visible { outline: 2px solid var(--gold-leaf); outline-offset: 3px; }

/* ===================== ornament ===================== */

.rule {
  display: flex; align-items: center; gap: 14px;
  color: var(--gold-leaf);
}
.rule::before, .rule::after {
  content: ''; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}
.rule svg { flex: none; opacity: .95; }

/* ===================== header ===================== */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 22px; }

.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  color: var(--gold);
  border: 1px solid var(--gold-line);
  background: var(--gold-soft);
  border-radius: 50%;
  transition: transform .25s ease;
}
.brand:hover .brand-mark { transform: rotate(-8deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: .01em; }
.brand-sub {
  font-family: var(--sans); font-size: 10px; font-weight: 500;
  letter-spacing: .17em; text-transform: uppercase; color: var(--faint);
}

.header-nav { display: flex; gap: 2px; }
.header-nav a {
  padding: 7px 13px; font-family: var(--sans); font-size: 13.5px;
  color: var(--muted); border-radius: 3px;
  transition: color .18s ease, background .18s ease;
}
.header-nav a:hover { color: var(--gold); background: var(--gold-soft); }

.header-tools { display: flex; gap: 6px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 11px; cursor: pointer;
  background: transparent; border: 1px solid var(--line);
  border-radius: 3px; color: var(--muted);
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: .1em;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.tool:hover { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.tool-icon { width: 34px; padding: 0; justify-content: center; }
html[data-theme='light'] .icon-moon,
html[data-theme='dark'] .icon-sun { display: none; }

/* ===================== hero ===================== */

.hero { padding-top: 72px; }

.hero-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 60px; align-items: center; }

.kicker { margin-bottom: 20px; }
.kicker .label { display: inline-flex; align-items: center; gap: 9px; }
.kicker .label::before {
  content: ''; width: 22px; height: 1px; background: var(--gold-leaf);
}

h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.1rem);
  font-weight: 500; line-height: 1.06;
  letter-spacing: -0.022em;
}
h1 em {
  font-style: italic; color: var(--gold);
  text-shadow: 0 1px 0 color-mix(in srgb, var(--gold-leaf) 22%, transparent);
}

.lead {
  margin-top: 22px; max-width: 44ch;
  font-size: 19px; line-height: 1.66; color: var(--muted);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 20px; cursor: pointer; border-radius: 3px;
  border: 1px solid transparent;
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.btn-primary { background: var(--gold-leaf); color: var(--on-gold); border-color: var(--gold-leaf); }
.btn-primary:hover { transform: translateY(-2px); background: var(--gold); border-color: var(--gold); }
.btn-ghost { background: transparent; border-color: var(--gold-line); color: var(--gold); }
.btn-ghost:hover { background: var(--gold-soft); }

/* --- gilded shelf --- */
.shelf-figure { margin: 0; }
.shelf {
  display: flex; align-items: flex-end; justify-content: center; gap: 5px;
  height: 186px; padding: 16px 18px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-book);
}
.spine {
  flex: 1 1 0; min-width: 0; max-width: 40px;
  position: relative; cursor: pointer;
  border-radius: 2px 2px 0 0;
  display: flex; justify-content: center; padding-top: 11px;
  background: linear-gradient(180deg, var(--spine-a), var(--spine-b));
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .1), 0 1px 2px rgba(0, 0, 0, .18);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1), filter .22s ease;
}
.spine:hover { transform: translateY(-7px); filter: brightness(1.12); }
.spine::before {
  content: ''; position: absolute; left: 0; right: 0; top: 30px; height: 2px;
  background: var(--gold-leaf); opacity: .78;
}
.spine::after {
  content: ''; position: absolute; left: 0; right: 0; top: 36px; height: 1px;
  background: var(--gold-leaf); opacity: .38;
}
.spine span {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--sans); font-size: 9.5px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: rgba(255, 255, 255, .95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-height: 100%; margin-top: 8px;
}
.shelf-board {
  height: 11px; border-radius: 0 0 3px 3px;
  background: linear-gradient(180deg, #6b4f2a, #4a3519);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .28);
}
html[data-theme='dark'] .shelf-board { background: linear-gradient(180deg, #57402099, #2b1f10); }
.shelf-figure figcaption {
  margin-top: 14px; text-align: center;
  font-size: 15px; font-style: italic; color: var(--faint);
}

/* --- stats --- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 22px; margin: 62px 0 0; padding: 26px 0 0;
  border-top: 1px solid var(--line);
}
.stats div { display: flex; flex-direction: column; gap: 6px; }
.stats dt { font-family: var(--sans); font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.stats dd { margin: 0; font-size: 34px; font-weight: 500; line-height: 1; color: var(--gold); }
.stats dd small { font-size: 15px; color: var(--faint); margin-left: 4px; }

/* ===================== sections ===================== */

.section {
  padding: 76px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 14px);
}
#catalog { border-top: none; padding-top: 76px; }

.section-head { margin-bottom: 30px; max-width: 72ch; }
.section-head .label { display: block; margin-bottom: 12px; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); font-weight: 500; }
.section-note { margin-top: 14px; font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 60ch; }
.minor {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--faint);
  margin-bottom: 18px;
}

/* ===================== controls ===================== */

.controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.search {
  flex: 1 1 280px; display: flex; align-items: center; gap: 11px;
  height: 46px; padding: 0 15px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 3px; color: var(--faint);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search input {
  flex: 1; min-width: 0; height: 100%;
  background: transparent; border: 0; outline: 0;
  font-family: var(--serif); font-size: 17px; color: var(--text);
}
.search input::placeholder { color: var(--faint); font-style: italic; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; cursor: pointer; border-radius: 999px;
  background: transparent; border: 1px solid var(--line);
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip .count { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.chip:hover { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.chip[aria-pressed='true'] {
  background: var(--gold-leaf); border-color: var(--gold-leaf); color: var(--on-gold);
}
.chip[aria-pressed='true'] .count { color: var(--on-gold); opacity: .7; }

.result-count {
  margin: 20px 0 18px;
  font-size: 16px; font-style: italic; color: var(--faint);
}

/* ===================== book grid ===================== */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 26px 22px; }

.card {
  position: relative;
  display: flex; flex-direction: column; text-align: left;
  padding: 0; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-book); border-color: var(--gold-line); }

/* whole card is the click target; the external link sits above it */
.card-open {
  position: absolute; inset: 0; z-index: 1;
  padding: 0; margin: 0; cursor: pointer;
  background: transparent; border: 0; border-radius: 0;
  font: inherit; color: transparent;
}
.card-open:focus-visible { outline: 2px solid var(--gold-leaf); outline-offset: -4px; }
.card a { position: relative; z-index: 2; }

.cover {
  position: relative; aspect-ratio: 3 / 4; overflow: hidden;
  background: var(--navy-deep);
  display: flex; flex-direction: column;
}
.cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s cubic-bezier(.4, 0, .2, 1);
}
.card:hover .cover img { transform: scale(1.045); }
.cover::after {
  content: ''; position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1px var(--gold-line), inset 0 -60px 70px -60px rgba(15, 27, 45, .75);
  pointer-events: none;
}

/* typographic fallback cover */
.cover.type {
  padding: 20px 20px 22px;
  background:
    radial-gradient(120% 80% at 50% 0%, #1b3358 0%, var(--navy-deep) 62%),
    var(--navy-deep);
  color: #f0e6d2;
}
.cover.type::before {
  content: ''; position: absolute; inset: 10px;
  border: 1px solid var(--gold-line);
  outline: 1px solid transparent; outline-offset: 3px;
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, .12);
  pointer-events: none;
}
.cover.type .t-cat {
  position: relative; font-family: var(--sans); font-size: 9px; font-weight: 600;
  letter-spacing: .19em; text-transform: uppercase; color: var(--gold-leaf);
}
.cover.type .t-title {
  position: relative; display: block; margin-top: auto; padding-right: 4px;
  font-size: 25px; line-height: 1.14; letter-spacing: -0.012em;
  text-wrap: balance;
}
/* illuminated initial — the manuscript reference, and it fills the void */
.cover.type .t-title::first-letter {
  float: left; font-size: 2.85em; line-height: .82;
  padding: .04em .09em 0 0; color: var(--gold-leaf); font-weight: 500;
}
.cover.type .t-ornament {
  position: absolute; left: 50%; top: 33%;
  transform: translateX(-50%); color: var(--gold-leaf); opacity: .7;
}
.cover.type .t-author {
  position: relative; margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--gold-line);
  font-family: var(--sans); font-size: 9.5px; font-weight: 500;
  letter-spacing: .19em; text-transform: uppercase; color: rgba(240, 230, 210, .62);
}

.card-body { padding: 15px 17px 17px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card-cat {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 10px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
}
.card-cat .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.card-title { font-size: 20px; line-height: 1.22; }
.card-blurb {
  font-size: 16.5px; line-height: 1.5; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--faint);
}
.card-link { color: var(--gold); display: inline-flex; align-items: center; gap: 5px; font-family: var(--sans); font-size: 11.5px; font-weight: 600; letter-spacing: .05em; }
.card.is-link:hover .card-foot { border-top-color: var(--gold-line); }

.empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 16px;
  padding: 44px; background: var(--surface);
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}
/* `display:flex` above beats the UA rule for [hidden], so restate it */
.empty[hidden] { display: none; }

/* ===================== classification ===================== */

.class-layout { display: grid; grid-template-columns: 1fr 1.02fr; gap: 44px; align-items: start; }

.bench { display: grid; grid-template-columns: 1fr 40px; gap: 9px 12px; align-items: center; padding: 9px 0; }
.bench-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bench-head .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.bench-name { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bench-track { grid-column: 1 / -1; height: 11px; background: var(--surface-2); border-radius: 2px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line-soft); }
.bench-fill { height: 100%; border-radius: 2px; transition: width .6s cubic-bezier(.4, 0, .2, 1); }
.bench-val { font-family: var(--mono); font-size: 12px; color: var(--faint); text-align: right; }

.table-scroll {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.class-table { width: 100%; border-collapse: collapse; min-width: 440px; }
.class-table th {
  text-align: left; padding: 14px 16px;
  border-bottom: 1px solid var(--gold-line);
  font-family: var(--sans); font-size: 10px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
  white-space: nowrap;
}
.class-table td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); font-size: 16.5px; vertical-align: top; }
.class-table tr:last-child td { border-bottom: 0; }
.class-table .num { text-align: right; font-family: var(--mono); color: var(--muted); }
.class-table .code { font-family: var(--mono); font-size: 13.5px; white-space: nowrap; color: var(--gold); }
.class-table .field { color: var(--muted); font-size: 15.5px; }
.cell-cat { display: flex; align-items: center; gap: 9px; }
.cell-cat .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.foot-note { margin-top: 18px; font-size: 16px; font-style: italic; color: var(--faint); max-width: 56ch; }

/* ===================== author ===================== */

.author-layout { display: grid; grid-template-columns: 300px 1fr; gap: 44px; align-items: start; }
.author-card { margin: 0; }
.portrait {
  border: 1px solid var(--gold-line);
  border-radius: 2px; overflow: hidden;
  background: var(--navy-deep);
  box-shadow: var(--shadow-book);
}
.portrait img { display: block; width: 100%; height: auto; }
.author-card figcaption { padding-top: 18px; }
.author-name { font-size: 24px; }
.author-role {
  margin-top: 6px; font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
}
.author-note {
  margin-top: 8px; font-family: var(--sans); font-size: 11px;
  color: var(--faint); letter-spacing: .02em;
}
.prose { font-size: 18px; line-height: 1.72; color: var(--muted); max-width: 64ch; }
.prose.dropcap::first-letter {
  float: left; font-size: 3.5em; line-height: .82;
  padding: .05em .11em 0 0; color: var(--gold); font-weight: 500;
}
.tag-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 26px; }
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--gold-line); background: var(--gold-soft);
  font-family: var(--sans); font-size: 12px; color: var(--muted);
}
.tag .dot { width: 7px; height: 7px; border-radius: 50%; }

/* ===================== footer ===================== */

.site-footer { border-top: 1px solid var(--line); padding: 40px 0 48px; }
.footer-inner { display: flex; flex-direction: column; gap: 10px; }
.footer-line { font-size: 17px; }
.footer-line strong { color: var(--gold); font-weight: 600; }
.footer-dim { font-size: 15.5px; font-style: italic; color: var(--faint); max-width: 66ch; }

/* ===================== modal ===================== */

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 14, 24, .68); backdrop-filter: blur(4px); }
.modal-panel {
  position: relative; width: min(940px, 100%);
  max-height: 88dvh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-book);
  animation: rise .24s cubic-bezier(.4, 0, .2, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.modal-close {
  position: absolute; top: 15px; right: 15px; z-index: 2;
  width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 3px; color: var(--muted);
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.modal-close:hover { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.modal-body { padding: 34px; display: grid; grid-template-columns: 216px 1fr; gap: 36px; }
.detail-cover { box-shadow: var(--shadow-book); }
.detail-title { font-size: 2rem; line-height: 1.14; }
.detail-sub { margin-top: 10px; font-size: 18px; line-height: 1.5; color: var(--muted); }
.detail-tags { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 20px; }

.kv { display: grid; grid-template-columns: 88px 1fr; gap: 10px 18px; margin: 24px 0 0; }
.kv dt {
  font-family: var(--sans); font-size: 9.5px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--faint); padding-top: 4px;
}
.kv dd { margin: 0; font-size: 17px; }

.detail-block { margin-top: 30px; }
.detail-block .label { display: block; margin-bottom: 11px; }
.chapter-list { list-style: none; margin: 0; padding: 0; position: relative; counter-reset: ch; }
.chapter-list li {
  position: relative; padding: 0 0 14px 26px;
  font-size: 17.5px; color: var(--muted); counter-increment: ch;
}
.chapter-list li::before {
  content: counter(ch, lower-roman);
  position: absolute; left: 0; top: 1px;
  font-family: var(--mono); font-size: 10.5px; color: var(--gold);
}
.chapter-list::before {
  content: ''; position: absolute; left: 4px; top: 8px; bottom: 8px;
  width: 1px; background: var(--gold-line);
}
.takeaway-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.takeaway-list li { display: grid; grid-template-columns: 20px 1fr; gap: 12px; font-size: 17.5px; line-height: 1.55; color: var(--muted); }
.takeaway-list svg { margin-top: 5px; color: var(--gold); }

.modal-cta { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ===================== responsive ===================== */

@media (max-width: 980px) {
  .class-layout { grid-template-columns: 1fr; gap: 36px; }
  .author-layout { grid-template-columns: 1fr; gap: 26px; }
  /* collapse the plate to a small portrait beside the name */
  .author-card { display: flex; align-items: center; gap: 20px; }
  .author-card figcaption { padding-top: 0; }
  .portrait { width: 132px; flex: none; }
  .portrait img { width: 132px; height: 132px; object-fit: cover; object-position: 50% 24%; }
  .hero-grid { grid-template-columns: 1fr; gap: 46px; }
  .shelf { height: 148px; }
}

@media (max-width: 780px) {
  .container { padding-inline: 20px; }
  .header-nav { display: none; }
  .hero { padding-top: 46px; }
  h1 { font-size: clamp(2.1rem, 9vw, 3rem); }
  .lead { font-size: 17.5px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 44px; }
  .stats dd { font-size: 28px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px 16px; }
  .section { padding: 54px 0; }
  .modal-body { grid-template-columns: 1fr; padding: 24px; gap: 24px; }
  .detail-cover { max-width: 190px; }
  .author-card { flex-direction: row; }
}

@media (max-width: 460px) {
  .grid { grid-template-columns: 1fr; }
  .shelf { height: 118px; padding: 12px 12px 0; }
  .spine span { font-size: 8px; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .author-card { flex-direction: column; align-items: flex-start; gap: 14px; }
  .author-card figcaption { padding-top: 0; }
  .portrait { width: 150px; }
  .portrait img { width: 150px; height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
