/* ------------------------------------------------------------------
   Recommendations bookshelf
   A head-on bookcase rendered with CSS 3D. One shelf per category,
   books stand spine-out; hover slides a book forward, click turns it
   to face you inside a detail view.
   ------------------------------------------------------------------ */

:root {
  --bg: #1f1719;
  --bg-deep: #171113;
  --text: #f4ede4;
  --text-2: #e3d9cd;
  --muted: #a69a90;
  --muted-2: #72675f;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #e2606a;
  --paper: #efe6d6;
  --paper-2: #e0d5c1;
  --wood-front-1: #5b4233;
  --wood-front-2: #3a2a21;
  --wood-front-3: #2a1d17;
  --wood-top-1: #2b1d17;
  --wood-top-2: #4a3628;
  --wood-top-3: #6d4f3d;
  --wood-under: #150f0d;
  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Mulish', 'Muli', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --s: 1;            /* book scale on the shelves */
  --rail: 0px;       /* left rail width when present */
  --row-h: 252px;    /* shelf row height (tallest book fits) */
  --plank-h: 14px;
  --plank-depth: 184px;
  --plank-z: 100px;
  --hint-h: 50px;
}

html { background: var(--bg); color-scheme: dark; }
html.is-ready { scroll-behavior: smooth; }
html.is-locked { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: rgba(226, 96, 106, 0.35); }

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; border-radius: 6px;
  background: var(--text); color: #1c1416; text-decoration: none;
  font: 600 13px/1 var(--sans);
}
.skip:focus { top: 12px; }

/* ---------- masthead / hero ---------- */

.masthead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 32px;
}
.masthead__brand {
  font: 500 17px/1 var(--serif);
  letter-spacing: 0.005em;
  text-decoration: none;
}
.masthead__brand em { font-style: italic; color: var(--muted); }
.masthead__link, .footer a {
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  transition: color 0.3s;
}
.masthead__link:hover, .footer a:hover { color: var(--text); }

.page { padding-left: var(--rail); }

.hero {
  max-width: 1000px; margin: 0 auto;
  padding: clamp(28px, 7vh, 84px) 24px clamp(28px, 6vh, 64px);
}
.hero h1 {
  margin: 0 0 16px;
  font: 400 clamp(46px, 6.4vw, 78px)/1 var(--serif);
  font-variation-settings: 'opsz' 72;
  letter-spacing: -0.018em;
}
.hero__lead {
  margin: 0;
  max-width: 44ch;
  font: 400 clamp(17px, 1.5vw, 20px)/1.5 var(--serif);
  color: var(--muted);
}
.hero__meta {
  margin: 26px 0 0;
  font: 500 11px/1 var(--sans);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------- category navigation ---------- */

.rail { display: none; }
.chips {
  position: sticky; top: 0; z-index: 20;
  margin: 0 0 12px;
  background: linear-gradient(180deg, rgba(31, 23, 25, 0.96), rgba(31, 23, 25, 0.86));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.chips__track {
  display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
  padding: 10px 16px;
  -webkit-overflow-scrolling: touch;
}
.chips__track::-webkit-scrollbar { display: none; }
.chips a {
  flex: 0 0 auto;
  padding: 8px 11px; border-radius: 999px;
  font: 600 11px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: color 0.3s, background 0.3s;
}
.chips a:hover { color: var(--text); }
.chips a.is-active { color: var(--text); background: rgba(255, 255, 255, 0.08); }

@media (min-width: 1100px) {
  :root { --rail: 230px; }
  .chips { display: none; }
  .rail {
    display: block; position: fixed; left: 34px; top: 50%;
    transform: translateY(-50%); z-index: 5; width: 180px;
  }
  .rail__title {
    margin: 0 0 12px 18px;
    font: 500 10px/1 var(--sans); letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--muted-2);
  }
  .rail__list { list-style: none; margin: 0; padding: 0; }
  .rail a {
    position: relative; display: block; padding: 4px 0 4px 18px;
    font: 500 11px/1.4 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--muted-2); text-decoration: none;
    transition: color 0.35s;
  }
  .rail a::before {
    content: ''; position: absolute; left: 0; top: 50%; height: 1px; width: 8px;
    background: currentColor; transition: width 0.4s var(--ease);
  }
  .rail a:hover { color: var(--muted); }
  .rail a.is-active { color: var(--text); }
  .rail a.is-active::before { width: 12px; }
}

/* ---------- bookcase & shelves ---------- */

.bookcase {
  max-width: 1000px; margin: 0 auto;
  padding: 8px 24px 40px;
}

.shelf {
  position: relative;
  margin: 0 0 54px;
  scroll-margin-top: 64px;
}
.shelf__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  margin: 0 0 2px;
}
.shelf__title {
  margin: 0;
  font: 500 clamp(22px, 2.2vw, 26px)/1.2 var(--serif);
  letter-spacing: -0.012em;
}
.shelf__count {
  font: 500 11px/1 var(--sans); letter-spacing: 0.16em;
  color: var(--muted-2);
}
.shelf__intro {
  flex-basis: 100%;
  margin: 2px 0 0;
  max-width: 78ch;
  font: 400 15px/1.55 var(--serif);
  color: var(--muted);
}

.shelf__scene {
  position: relative;
  padding: var(--hint-h) 0 46px;
  perspective: 2000px;
  perspective-origin: 50% 55%;
  contain: layout style;
}
.shelf__row {
  position: relative;
  display: flex; align-items: flex-end; gap: 5px;
  height: var(--row-h);
  padding: 0 40px 0 26px;
  transform-style: preserve-3d;
}
.shelf__hint {
  position: absolute; top: 0; left: 0;
  transform: translate(-50%, 6px);
  text-align: center; white-space: nowrap;
  pointer-events: none; opacity: 0;
  transition: opacity 0.3s, transform 0.5s var(--ease);
}
.shelf__hint.is-on { opacity: 1; transform: translate(-50%, 0); }
.shelf__hint b {
  display: block; font: 500 16px/1.2 var(--serif); letter-spacing: -0.005em;
}
.shelf__hint small {
  display: block; margin-top: 4px;
  font: 500 10px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}

/* the wooden plank: front face + top surface + underside */
.plank {
  position: absolute; left: 0; right: 0; top: 100%;
  height: var(--plank-h);
  transform: translateZ(var(--plank-z));
  transform-style: preserve-3d;
  background: linear-gradient(180deg, var(--wood-front-1), var(--wood-front-2) 45%, var(--wood-front-3));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 26px 40px -12px rgba(0, 0, 0, 0.75);
}
.plank__top {
  position: absolute; left: 0; right: 0; bottom: 100%;
  height: var(--plank-depth);
  transform-origin: 50% 100%;
  transform: rotateX(90deg);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 55%),
    linear-gradient(180deg, var(--wood-top-1), var(--wood-top-2) 62%, var(--wood-top-3));
  backface-visibility: hidden;
}
.plank__under {
  position: absolute; left: 0; right: 0; top: 100%;
  height: var(--plank-depth);
  transform-origin: 50% 0;
  transform: rotateX(-90deg);
  background: var(--wood-under);
  backface-visibility: hidden;
}

/* bookend after the last book */
.bookend {
  position: relative; flex: 0 0 auto;
  width: 6px; height: 128px; margin-left: 12px;
  transform-style: preserve-3d;
}
.bookend__front, .bookend__side {
  position: absolute; left: 50%; top: 50%;
  backface-visibility: hidden;
}
.bookend__front {
  width: 6px; height: 128px; margin: -64px 0 0 -3px;
  transform: translateZ(46px);
  background: linear-gradient(180deg, #4a4a4f, #232326);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset;
}
.bookend__side {
  width: 92px; height: 128px; margin: -64px 0 0 -46px;
  transform: rotateY(-90deg) translateZ(3px);
  background: linear-gradient(90deg, #2a2a2e, #3d3d42 40%, #303035);
}

/* ---------- the book ---------- */

.book {
  --H: calc(var(--h) * var(--s));
  --W: calc(var(--w) * var(--s));
  --T: calc(var(--t) * var(--s));
  position: relative; flex: 0 0 auto;
  width: var(--T); height: var(--H);
  margin: 0; padding: 0; border: 0; background: none;
  cursor: pointer;
  transform-style: preserve-3d;
  -webkit-tap-highlight-color: transparent;
}
.book:focus-visible { outline: none; }
.book { transition: transform 0.5s var(--ease); }
.book.room-l { transform: translateX(-4px); }
.book.room-r { transform: translateX(4px); }
.shelf__row .book:focus-visible .f--spine { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Restored keyboard focus keeps its ring without restarting a returned book's preview. */
.b3 {
  position: absolute; left: 50%; top: 0;
  width: var(--W); height: var(--H);
  margin-left: calc(var(--W) / -2);
  transform-style: preserve-3d;
  transform: rotateY(90deg);
  transition: transform 0.6s var(--ease);
}
.shelf__row .book:not(.is-returned):hover .b3,
.shelf__row .book:not(.is-returned):not(.is-restored-focus):focus-visible .b3 { transform: translateZ(34px) rotateY(90deg); }
.book.is-away .b3 { visibility: hidden; }

.f {
  position: absolute; left: 50%; top: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.f--front, .f--back {
  width: var(--W); height: var(--H);
  margin: calc(var(--H) / -2) 0 0 calc(var(--W) / -2);
}
.f--front { transform: translateZ(calc(var(--T) / 2)); background: var(--bg-c); }
.f--back  {
  transform: rotateY(180deg) translateZ(calc(var(--T) / 2));
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.18)), var(--bg-c);
}
.f--spine, .f--edge {
  width: var(--T); height: var(--H);
  margin: calc(var(--H) / -2) 0 0 calc(var(--T) / -2);
}
.f--spine {
  transform: rotateY(-90deg) translateZ(calc(var(--W) / 2));
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.32), rgba(255, 255, 255, 0.07) 26%, rgba(255, 255, 255, 0.07) 74%, rgba(0, 0, 0, 0.32)),
    var(--bg-c);
  color: var(--ink-c);
  transition: box-shadow 0.6s var(--ease), filter 0.5s;
}
.shelf__row .book:not(.is-returned):hover .f--spine,
.shelf__row .book:not(.is-returned):not(.is-restored-focus):focus-visible .f--spine { box-shadow: 0 30px 40px -8px rgba(0, 0, 0, 0.7); filter: brightness(1.06); }
.f--edge {
  transform: rotateY(90deg) translateZ(calc(var(--W) / 2));
  background: repeating-linear-gradient(90deg, var(--paper-2) 0 calc(1px * var(--s)), var(--paper) calc(1px * var(--s)) calc(3px * var(--s)));
}
.f--top {
  width: var(--W); height: var(--T);
  margin: calc(var(--T) / -2) 0 0 calc(var(--W) / -2);
  transform: rotateX(90deg) translateZ(calc(var(--H) / 2));
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0) 12%),
    repeating-linear-gradient(180deg, var(--paper-2) 0 calc(1px * var(--s)), var(--paper) calc(1px * var(--s)) calc(3px * var(--s)));
}
/* contact shadow on the plank, 1px above its surface so it never z-fights */
.f--shadow {
  width: calc(var(--W) * 1.2); height: calc(var(--T) * 2.6);
  margin: calc(var(--T) * -1.3) 0 0 calc(var(--W) * -0.6);
  transform: rotateX(90deg) translateZ(calc(var(--H) / -2 + 1px));
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 68%);
  opacity: 0; transition: opacity 0.5s;
  pointer-events: none;
}
.shelf__row .book:not(.is-returned):hover .f--shadow,
.shelf__row .book:not(.is-returned):not(.is-restored-focus):focus-visible .f--shadow { opacity: 1; }
/* thin papers have white spines and edges; no cloth */
.kind-paper .f--spine { background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(0,0,0,0) 40%, rgba(0,0,0,.18)), var(--paper); color: #3b3632; }
.kind-paper .f--back { background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(0,0,0,.08)), #f6f1e8; }

/* hinge groove on the front cover */
.f--front::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.38) 0, rgba(255, 255, 255, 0.14) 2%, rgba(0, 0, 0, 0.16) 4.5%, rgba(0, 0, 0, 0) 9%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 45%);
}
.kind-paper .f--front::after { background: linear-gradient(90deg, rgba(0,0,0,.14), rgba(0,0,0,0) 4%); }

/* ---------- spine typography ---------- */

.sp {
  /* laid out at the shelf's own pixel geometry, then scaled: the enlarged copy is the same drawing, glyph for glyph */
  position: absolute; left: 0; top: 0;
  width: calc(100% / var(--s)); height: calc(100% / var(--s));
  transform: scale(var(--s)); transform-origin: 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 10px 0 8px;
  box-sizing: border-box;
}
.sp__text {
  writing-mode: vertical-rl;
  text-orientation: sideways;
  display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-start;
  gap: 2px;
  max-height: calc(100% - 22px);
  overflow: hidden;
}
.sp__title {
  flex: 0 1 auto; min-width: 0; min-height: 0;
  font: 500 12px/1.05 var(--serif);
  letter-spacing: 0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp__source {
  flex: 0 0 auto;
  max-height: 55%;
  font: 500 8.5px/1.1 var(--sans);
  letter-spacing: 0.12em; text-transform: uppercase;
  opacity: 0.72;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp__mark {
  flex: 0 0 auto; position: relative;
  width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid currentColor; opacity: 0.7;
  box-sizing: border-box;
}
.sp__mark::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px; border-radius: 50%;
  background: currentColor;
}
.is-thin .sp { display: none; }
.is-slim .sp { padding: 8px 0 6px; }
.is-slim .sp__title { font-size: 9px; }
.is-slim .sp__source, .is-slim .sp__mark { display: none; }
.is-mid .sp__source { display: none; }
.is-mid .sp__title { font-size: 11px; }
.is-thick .sp__title { font-size: 12.5px; }
/* long titles on thick spines wrap to two lines rather than ellipsizing */
.is-thick .sp--long .sp__source { display: none; }
.is-thick .sp--long .sp__title {
  white-space: normal; font-size: 11.5px; line-height: 1.12;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  text-overflow: clip;
}
.kind-essays .sp__title, .kind-course .sp__title { font-weight: 600; }

/* ---------- cover faces ---------- */

.cv { display: block; }
.cv img { width: 100%; height: 100%; object-fit: cover; }
.cv--page { background: #fbf8f2; }
.cv--page img { object-fit: cover; object-position: top center; }

.cv--type {
  --fs: calc(var(--W) * 0.075);
  font-size: var(--fs);
  color: var(--ink-c);
  display: flex; flex-direction: column;
  padding: 1.2em 1.1em 1.1em 1.3em;
  box-sizing: border-box;
}
.cv--type::before {
  content: ''; position: absolute; inset: 0.7em 0.65em 0.65em 0.85em;
  border: 1px solid currentColor; opacity: 0.32; pointer-events: none;
}
.cv__kind {
  font: 600 0.5em/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase;
  opacity: 0.8;
}
.cv__title {
  margin-top: 0.75em;
  font: 500 1.28em/1.08 var(--serif);
  font-variation-settings: 'opsz' 40;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.cv__title.t-l { font-size: 1.12em; }
.cv__title.t-m { font-size: 0.98em; }
.cv__title.t-s { font-size: 0.86em; line-height: 1.16; }
.cv__media {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 0.9em 0 0.6em;
}
.cv__media img {
  width: auto; height: auto; max-width: 62%; max-height: 100%;
  object-fit: contain; border-radius: 0.2em;
}
.cv__media--banner img {
  max-width: 100%; max-height: 64%;
  border-radius: 0.2em;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 0.4em 1em -0.4em rgba(0, 0, 0, 0.5);
}
.cv__media--logo img {
  box-shadow: 0 0.5em 1.2em -0.5em rgba(0, 0, 0, 0.55);
}
.cv__foot {
  margin-top: auto;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 0.6em;
  padding-top: 0.6em;
}
.cv__source {
  font: 500 0.62em/1.3 var(--sans); letter-spacing: 0.04em;
  opacity: 0.86;
}
.cv__mark {
  flex: 0 0 auto; position: relative;
  width: 1.3em; height: 1.3em; border-radius: 50%;
  border: 1px solid currentColor; opacity: 0.75;
  box-sizing: border-box;
}
.cv__mark::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 0.34em; height: 0.34em; margin: -0.17em 0 0 -0.17em; border-radius: 50%;
  background: currentColor;
}
.cv--noimg .cv__title { margin-top: 1.4em; }

/* ---------- detail view ---------- */

.detail {
  position: fixed; inset: 0; z-index: 50;
  overflow-y: auto; overscroll-behavior: contain;
  --s: 2;
}
.detail[hidden] { display: none; }
.detail__backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 13, 15, 0.84);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  opacity: 0; transition: opacity 0.5s;
}
.detail.is-in .detail__backdrop { opacity: 1; }
.detail__close {
  position: fixed; top: 20px; right: 24px; z-index: 3;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(31, 23, 25, 0.55);
  color: var(--text); cursor: pointer;
  display: grid; place-items: center;
  opacity: 0; transition: opacity 0.4s 0.15s, background 0.3s, transform 0.3s var(--ease);
}
.detail.is-in .detail__close { opacity: 1; }
.detail__close:hover { background: rgba(255, 255, 255, 0.12); transform: rotate(90deg); }

.detail__panel {
  position: relative; z-index: 2;
  width: min(1180px, 100%); min-height: 100%;
  margin: 0 auto; box-sizing: border-box;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 40px; align-items: center;
  padding: 56px 56px 56px 48px;
}
.detail__stage {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 540px;
  perspective: 2000px;
  perspective-origin: 50% 50%;
}
.detail__stage::before {
  content: ''; position: absolute; inset: 10% 8%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
  opacity: 0; transition: opacity 0.8s;
}
.detail.is-in .detail__stage::before { opacity: 1; }

.detail .book {
  --ry: 26deg; --rx: 0deg;
  cursor: default; width: var(--W);
  transition: none;
}
/* the flights are driven by the Web Animations API; at rest the pointer tilt drives these variables */
.detail .b3 {
  transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateY(var(--ry)) rotateX(var(--rx));
  transition: none;
}
.detail .f--front {
  box-shadow: 0 50px 70px -24px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.detail .f--spine { box-shadow: none; }
/* the detail copy's spine is the shelf copy's, scaled by --s: no overrides, so the two are identical at the hand-off */

.detail__text {
  max-width: 500px;
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.55s 0.15s, transform 0.7s 0.15s var(--ease);
}
.detail.is-in .detail__text { opacity: 1; transform: none; }
.detail__eyebrow {
  margin: 0 0 16px;
  font: 600 11px/1 var(--sans); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted);
}
.detail__eyebrow span + span::before { content: '\00a0\00b7\00a0'; color: var(--muted-2); }
.detail__title {
  margin: 0 0 10px;
  font: 500 clamp(30px, 3.3vw, 44px)/1.08 var(--serif);
  font-variation-settings: 'opsz' 60;
  letter-spacing: -0.018em;
  text-wrap: balance;
}
.detail__source {
  margin: 0 0 22px;
  font: italic 400 19px/1.35 var(--serif);
  color: var(--muted);
}
.detail__source:empty { display: none; }
.detail__blurb {
  font: 400 18px/1.58 var(--serif);
  font-variation-settings: 'opsz' 18;
  color: var(--text-2);
}
.detail__blurb p { margin: 0 0 1em; }
.detail__blurb p:last-child { margin-bottom: 0; }
.detail__blurb a {
  color: var(--text);
  text-decoration: underline; text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 255, 255, 0.35); text-underline-offset: 3px;
  transition: text-decoration-color 0.3s, color 0.3s;
}
.detail__blurb a:hover { color: #fff; text-decoration-color: var(--accent); }

.detail__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 28px;
}
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 18px; border-radius: 7px;
  background: var(--text); color: #1a1315;
  font: 600 13px/1 var(--sans); letter-spacing: 0.03em;
  text-decoration: none;
  transition: background 0.3s, transform 0.4s var(--ease), box-shadow 0.4s;
}
.btn svg { width: 12px; height: 12px; }
.btn:hover { background: #fff; transform: translateY(-1px); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.6); }
.btn:focus-visible { outline-offset: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 14px; border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text); text-decoration: none;
  font: 500 12px/1 var(--sans);
  transition: border-color 0.3s, background 0.3s;
}
.chip svg { width: 10px; height: 10px; opacity: 0.6; }
.chip:hover { border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.05); }
.detail__also {
  flex-basis: 100%;
  margin: 8px 0 0;
  font: 500 10px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-2);
}

.detail__pager {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid var(--line);
}
.detail__pager:empty { display: none; }
.pager {
  flex: 1 1 0; min-width: 0;
  padding: 4px 0; border: 0; background: none; cursor: pointer;
  text-align: left; color: var(--muted);
  transition: color 0.3s;
}
.pager--next { text-align: right; }
.pager:hover { color: var(--text); }
.pager small {
  display: block; margin-bottom: 4px;
  font: 500 10px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-2);
}
.pager span {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 500 15px/1.3 var(--serif);
}

.footer { max-width: 1000px; margin: 0 auto; padding: 24px 24px 56px; }
.footer p { margin: 0; }
.footer__dot { color: var(--muted-2); margin: 0 6px; }

/* ---------- responsive ---------- */

@media (max-width: 1280px) {
  .detail { --s: 1.7; }
}
@media (max-width: 900px) {
  .detail { --s: 1.5; }
  .detail__panel { grid-template-columns: 1fr; gap: 12px; padding: 72px 28px 48px; }
  .detail__stage { min-height: 420px; }
  .detail__text { max-width: 560px; }
}
@media (max-width: 1099px) {
  .shelf__scene {
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .shelf__scene::-webkit-scrollbar { display: none; }
  .shelf__row { width: max-content; min-width: 100%; box-sizing: border-box; }
  .book { scroll-snap-align: center; }
}
@media (max-width: 600px) {
  :root { --s: 0.8; --row-h: 202px; --hint-h: 12px; --plank-depth: 170px; --plank-z: 86px; }
  .masthead { padding: 18px 20px; }
  .masthead__brand em { display: none; }
  .hero { padding-left: 20px; padding-right: 20px; }
  .bookcase { padding-left: 0; padding-right: 0; }
  .shelf__head, .shelf__intro { padding: 0 20px; }
  .shelf__row { padding: 0 32px 0 20px; }
  .shelf__hint { display: none; }
  .shelf__scene { padding-bottom: 36px; }
  .plank { left: 0; right: 0; }
  .detail { --s: 1.25; }
  .detail__panel { padding: 64px 22px 40px; }
  .detail__stage { min-height: 360px; }
  .detail__close { top: 14px; right: 16px; width: 40px; height: 40px; }
  .detail__blurb { font-size: 17px; }
  .footer { padding: 16px 20px 48px; }
}
@media (hover: none) {
  .shelf__row .book:not(.is-returned):hover .b3 { transform: rotateY(90deg); }
  .shelf__row .book:not(.is-returned):hover .f--spine { box-shadow: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  html.is-ready { scroll-behavior: auto; }
  .b3, .f--spine, .f--shadow, .book, .shelf__hint, .detail__backdrop, .detail__text, .detail__close, .detail__stage::before, .btn, .chip, .rail a, .rail a::before {
    transition: none !important;
  }

}
