/* ==========================================================================
   Joe Broadmeadow · "Noir Cinema"
   A dark stage, one light, each book lit in turn. Editorial serif display,
   neutral grotesk, tracked uppercase captions. Oxblood from the covers' blood drops,
   a cold steel from the police lights, and a per-series accent.
   ========================================================================== */

:root {
  --ink: #070708;
  --surface: #111113;
  --line: rgba(237, 231, 221, .12);
  --line-strong: rgba(237, 231, 221, .28);
  --text: #ede7dd;
  --text-2: #aaa49b;
  --text-3: #6f6b65;
  --bone: #ede7dd;
  --oxblood: #c4142f;
  --steel: #8fa3c4;
  --accent: var(--oxblood);
  --manila: #c9b48a;

  --serif: 'Instrument Serif', 'Didot', 'Times New Roman', serif;
  --sans: 'Geist', system-ui, -apple-system, sans-serif;
  /* small uppercase captions use the sans, tracked out */
  --mono: 'Geist', system-ui, sans-serif;

  --gutter: clamp(16px, 4.5vw, 72px);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --fast: 180ms;
  --med: 500ms;
}

body[data-chapter="3"] { --accent: #c8a253; }
body[data-chapter="5"] { --accent: #e8692c; }
body[data-chapter="6"] { --accent: #d99a52; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--oxblood); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.skip {
  position: fixed; left: 16px; top: 16px; z-index: 100; padding: 10px 16px;
  background: var(--bone); color: var(--ink); transform: translateY(-200%); transition: transform var(--fast);
}
.skip:focus { transform: none; }

/* ---------- fixed layers ---------- */
#stage { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; opacity: 0; transition: opacity 1.4s var(--ease-out); }
#stage.is-ready { opacity: 1; }
.grain {
  /* static: an animated full-screen grain reads as flicker and repaints every step */
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(130% 95% at 50% 40%, transparent 50%, rgba(0,0,0,.7) 100%); }
.no-webgl body { background: radial-gradient(70% 55% at 75% 35%, #1d0b10, var(--ink) 70%); }

.scroll-line { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 60; pointer-events: none; }
.scroll-line span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: background-color .6s; }

.stage-status {
  position: fixed; left: var(--gutter); bottom: 22px; z-index: 40; margin: 0;
  font: 400 .72rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
  transition: opacity .6s;
}
.stage-status:empty, .stage-status.is-done { opacity: 0; }

/* ---------- header ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 32px;
  padding: 18px var(--gutter);
  transition: transform .6s var(--ease-out), background-color .4s, box-shadow .4s;
}
/* no backdrop blur: blurring the live 3D canvas costs a full pass every frame */
.nav.is-solid { background: rgba(7,7,8,.86); box-shadow: 0 1px 0 var(--line); }
.nav.is-hidden { transform: translateY(-110%); }
.nav > .btn { justify-self: end; grid-column: -2 / -1; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-strong); font: 400 1.25rem/1 var(--serif); letter-spacing: .02em;
}
.brand__name { font: 500 .78rem var(--sans); letter-spacing: .22em; text-transform: uppercase; }
.nav__links { display: flex; gap: 30px; justify-self: end; margin-right: 8px; }
.nav__links a { position: relative; font: 400 .85rem var(--sans); text-decoration: none; color: var(--text-2); transition: color var(--fast); }
.nav__links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -5px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform var(--med) var(--ease-out); }
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__links a:hover::after, .nav__links a.is-active::after { transform: scaleX(1); transform-origin: left; }

/* ---------- layout ---------- */
main { position: relative; z-index: 2; }
.chapter { position: relative; min-height: 125vh; display: flex; align-items: center; padding: 140px 0; }
.wrap { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap--wide { max-width: 1400px; margin: 0 auto; }
.col { width: min(590px, 46%); }
.chapter[data-side="left"] .col { margin-right: auto; }
.chapter[data-side="right"] .col { margin-left: auto; margin-right: clamp(0px, 3vw, 40px); }
.hero { min-height: 100svh; padding-top: 120px; }
.hero .col { width: min(720px, 56%); margin: 0; }
.josh { display: block; min-height: 0; height: 440vh; padding: 0; }
.josh .sticky { position: sticky; top: 0; height: 100svh; display: flex; align-items: center; padding-top: 60px; }
.shelf { min-height: 0; display: block; padding: 160px 0 120px; }
.closing { min-height: 115vh; }

/* ---------- type ---------- */
.eyebrow, .label {
  display: flex; align-items: center; gap: 14px; margin: 0 0 28px;
  font: 500 .72rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--text-2);
}
.label { color: var(--accent); transition: color .6s; }
.eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--oxblood); box-shadow: 0 0 14px var(--oxblood); animation: siren 4s ease-in-out infinite; }
@keyframes siren { 0%, 100% { background: var(--oxblood); box-shadow: 0 0 14px var(--oxblood); } 50% { background: var(--steel); box-shadow: 0 0 14px var(--steel); } }
.display {
  margin: 0 0 32px; font: 400 clamp(3.6rem, 8.4vw, 9.2rem)/.92 var(--serif);
  letter-spacing: -.022em; text-wrap: balance;
}
.display em, .title em { font-weight: 400; letter-spacing: -.01em; padding-right: .04em; }
.display em, .title em, .footer__mark em { font-style: italic; color: var(--accent); transition: color .6s; }
.display em { color: var(--oxblood); }
.title {
  margin: 0 0 30px; font: 400 clamp(2.6rem, 4.9vw, 4.9rem)/1 var(--serif);
  letter-spacing: -.015em; text-wrap: balance;
}
.title--xl { font-size: clamp(3.2rem, 7.2vw, 7.6rem); }
.lede { margin: 0 0 40px; max-width: 33em; font-size: 1.125rem; line-height: 1.7; font-weight: 350; color: var(--text-2); text-wrap: pretty; }
.lede strong, .bio__text strong { font-weight: 500; color: var(--text); }
.lede--sm { font-size: 1.02rem; margin-bottom: 30px; }

/* hero intro: CSS so first paint is never blocked by JS */
.js .hero-in { animation: heroIn 1.2s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 110ms + 120ms); }
/* starts at .01, not 0, so the headline still counts as painted for LCP */
@keyframes heroIn { from { opacity: .01; transform: translateY(26px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.facts { list-style: none; display: flex; flex-wrap: wrap; margin: 56px 0 0; padding: 26px 0 0; border-top: 1px solid var(--line); gap: 0; }
.facts li { padding-right: 34px; margin-right: 34px; border-right: 1px solid var(--line); }
.facts li:last-child { border: 0; margin: 0; padding: 0; }
.facts strong { display: block; margin-bottom: 6px; font: 400 1.9rem/1.05 var(--serif); letter-spacing: -.01em; }
.facts span { font: 500 .66rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }

.scroll-hint {
  position: absolute; left: var(--gutter); bottom: 34px; display: flex; align-items: center; gap: 14px; text-decoration: none;
  font: 400 .7rem var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--text-3);
}
.scroll-hint i { position: relative; width: 64px; height: 1px; background: var(--line); overflow: hidden; }
.scroll-hint i::after { content: ''; position: absolute; inset: 0; background: var(--text); transform: translateX(-100%); animation: hint 2.4s var(--ease-io) infinite; }
@keyframes hint { 60%, 100% { transform: translateX(100%); } }

/* ==========================================================================
   Buttons
   ========================================================================== */
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 56px; padding: 0 30px; border: 0; cursor: pointer; text-decoration: none;
  font: 500 .92rem/1 var(--sans); letter-spacing: .01em; color: var(--text); background: none;
  isolation: isolate; -webkit-tap-highlight-color: transparent;
}
.btn-sm { min-height: 42px; padding: 0 20px; font-size: .82rem; }

/* text roll: JS wraps the label in two stacked copies */
.btn__roll { display: grid; height: 1.25em; line-height: 1.25em; overflow: hidden; }
.btn__roll > span { grid-area: 1 / 1; transition: transform var(--med) var(--ease-out); }
.btn__roll > span + span { transform: translateY(105%); }
.btn:hover .btn__roll > span:first-child, .btn:focus-visible .btn__roll > span:first-child { transform: translateY(-105%); }
.btn:hover .btn__roll > span + span, .btn:focus-visible .btn__roll > span + span { transform: none; }

/* 1. Primary: a bone pill flooded with oxblood from wherever the pointer enters */
.btn-primary { padding: 0 10px 0 30px; border-radius: 999px; background: var(--bone); color: var(--ink); overflow: hidden; transition: color .4s var(--ease-out); }
.btn-sm.btn-primary { padding: 0 20px; }
.btn-primary::before {
  content: ''; position: absolute; left: var(--x, 50%); top: var(--y, 50%); z-index: -1;
  width: 260%; aspect-ratio: 1; border-radius: 50%; background: var(--accent);
  transform: translate(-50%, -50%) scale(0); transition: transform .7s var(--ease-out), background-color .6s;
}
.btn-primary:hover, .btn-primary:focus-visible { color: #fff; }
.btn-primary:hover::before, .btn-primary:focus-visible::before { transform: translate(-50%, -50%) scale(1); }
.btn__icon { position: relative; width: 38px; height: 38px; border-radius: 50%; background: var(--ink); overflow: hidden; flex: none; transition: transform .5s var(--ease-out); }
.btn__icon::before, .btn__icon::after {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ede7dd' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / 16px no-repeat;
  transition: transform .5s var(--ease-out);
}
.btn__icon::after { transform: translateX(-120%); }
.btn-primary:hover .btn__icon { transform: scale(1.06); }
.btn-primary:hover .btn__icon::before { transform: translateX(120%); }
.btn-primary:hover .btn__icon::after { transform: none; }

/* 2. Frame: viewfinder crop marks that close into a full frame */
.btn-frame {
  --c: rgba(237, 231, 221, .7); --l: 12px;
  background:
    linear-gradient(var(--c), var(--c)) left top / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 1px var(--l) no-repeat;
  transition: background-size .6s var(--ease-out), color var(--fast);
}
.btn-frame::after { content: ''; position: absolute; inset: 0; z-index: -1; background: rgba(237,231,221,.06); opacity: 0; transition: opacity .4s; }
.btn-frame:hover, .btn-frame:focus-visible {
  background-size: 51% 1px, 1px 51%, 51% 1px, 1px 51%, 51% 1px, 1px 51%, 51% 1px, 1px 51%;
}
.btn-frame:hover::after { opacity: 1; }

/* 3. Link: hairline that redraws left to right */
.btn-link { min-height: 44px; padding: 0 2px; gap: 10px; color: var(--text); }
.btn-link::before { content: ''; position: absolute; left: 0; right: 0; bottom: 8px; height: 1px; background: var(--line-strong); }
.btn-link::after { content: ''; position: absolute; left: 0; right: 0; bottom: 8px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .6s var(--ease-out); }
.btn-link:hover::after, .btn-link:focus-visible::after { transform: scaleX(1); transform-origin: left; }

/* ---------- about ---------- */
/* photo beside the opening line, the rest of the bio full width beneath */
.bio { display: grid; grid-template-columns: minmax(180px, 48%) 1fr; gap: 34px 34px; margin-bottom: 56px; align-items: end; }
.bio__text { display: contents; }
.bio__text p:not(.bio__lead) { grid-column: 1 / -1; }
.bio__text .bio__lead { margin: 0 0 40px; }
.portrait { position: relative; margin: 0; }
.portrait picture { display: block; aspect-ratio: 600 / 765; overflow: hidden; background: #111; }
.portrait__colour { position: absolute; inset: 0; opacity: 0; transition: opacity 1s var(--ease-out); }
.portrait img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease-out); }
.portrait:hover .portrait__colour { opacity: 1; }
.portrait:hover img { transform: scale(1.03); }
.portrait::after { /* a thin frame offset behind the photo */
  content: ''; position: absolute; inset: 14px -14px -14px 14px; z-index: -1; border: 1px solid var(--line-strong);
}
.portrait figcaption { margin-top: 26px; font: 500 .66rem/1.5 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.bio__text p { margin: 0 0 16px; font-weight: 350; color: var(--text-2); text-wrap: pretty; }
.bio__text .bio__lead { font: 400 1.75rem/1.22 var(--serif); color: var(--text); }
.bio__text em { color: var(--text); }

.timeline { list-style: none; margin: 0 0 56px; padding: 0; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 112px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); transition: background-color .4s; }
.timeline li:hover { background: linear-gradient(90deg, rgba(237,231,221,.035), transparent); }
.timeline time { font: 400 1.45rem/1.2 var(--serif); color: var(--text); }
.timeline li:hover time { color: var(--accent); }
.timeline p { margin: 0; font-size: .98rem; font-weight: 350; color: var(--text-2); }
.timeline em { color: var(--text); }
.offduty { padding: 28px 30px; border: 1px solid var(--line); background: rgba(14,14,16,.82); }
.offduty .label { margin-bottom: 12px; }
.offduty p:last-child { margin: 0; font-weight: 350; color: var(--text-2); text-wrap: pretty; }
.offduty em { color: var(--text); }

/* ---------- Josh Williams feature ---------- */
.feature { padding: 30px 0 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.feature__pips { display: flex; gap: 8px; }
.feature__pips i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line-strong); transition: background-color .4s, border-color .4s, transform .4s var(--ease-out); }
.feature__pips i.is-on { background: var(--accent); border-color: var(--accent); transform: scale(1.25); }
.feature__title { margin: 16px 0 10px; font: 400 clamp(2.3rem, 3.8vw, 3.4rem)/1.02 var(--serif); letter-spacing: -.01em; }
.feature__tag { margin: 0 0 26px; color: var(--text-2); font-weight: 350; min-height: 3.3em; }
.ticks { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; }
.ticks a { display: inline-flex; gap: 8px; padding: 8px 0; text-decoration: none; font: 400 .78rem var(--sans); color: var(--text-3); transition: color var(--fast); }
.ticks a:hover { color: var(--text); }
.ticks a.is-active { color: var(--text); }
.ticks a.is-active span { color: var(--accent); }

/* ---------- covers (CSS fallback until the drawn or real cover loads) ---------- */
.cover {
  position: relative; display: block; aspect-ratio: 2/3; overflow: hidden;
  background: #111; box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 24px 50px -18px rgba(0,0,0,.9);
}
.cover[data-series="josh"] { background: linear-gradient(160deg, #1b1b1d, #050505); }
.cover[data-series="hawk"] { background: linear-gradient(160deg, #13224a, #08112a); }
.cover[data-series="true"] { background: linear-gradient(160deg, #262626, #0d0d0d); }
.cover[data-series="dragon"] { background: radial-gradient(70% 50% at 50% 35%, #4a2412, #061a17 70%); }
.cover[data-series="trail"] { background: linear-gradient(#2a3a30, #c46a33 55%, #162019 56%); }
.cover[data-series="kids"] { background: #f2c14e; }
.cover__title { position: absolute; inset: auto 9% 12%; font: 400 1.5rem/1 var(--serif); color: var(--bone); text-align: center; }
.cover[data-series="kids"] .cover__title { color: #1f2a44; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: coverIn .8s var(--ease-out) both; }
@keyframes coverIn { from { opacity: 0; } }
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.4), rgba(255,255,255,.1) 4%, transparent 9%), linear-gradient(115deg, transparent 40%, rgba(255,255,255,.07) 50%, transparent 60%); pointer-events: none; }

/* ---------- lists (true crime, dragon) ---------- */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list__item { position: relative; display: grid; grid-template-columns: 76px 1fr; gap: 22px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.list__item::before { content: ''; position: absolute; left: -18px; top: 22px; bottom: 22px; width: 1px; background: var(--accent); transform: scaleY(0); transition: transform .5s var(--ease-out); }
.list__item:hover::before { transform: scaleY(1); }
.list__item { perspective: 700px; }
.b3d--thumb { width: 76px; align-self: start; --th: 7px; }
.list__item:hover .b3d--thumb { --ry: -32deg; --lift: -4px; }
.list h3 { margin: 0 0 6px; font: 400 1.7rem/1.1 var(--serif); letter-spacing: -.015em; }
.list__by { margin: 0 0 8px !important; font: 500 .64rem/1.5 var(--sans) !important; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3) !important; }
.list p { margin: 0 0 12px; font-size: .95rem; font-weight: 350; color: var(--text-2); }
.list__links { display: flex; gap: 22px; margin: 0 !important; }
.list__links a { position: relative; font: 500 .8rem var(--sans); text-decoration: none; color: var(--text); padding-bottom: 3px; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 1px no-repeat, linear-gradient(var(--line-strong), var(--line-strong)) 0 100% / 100% 1px no-repeat; transition: background-size .5s var(--ease-out); }
.list__links a:hover { background-size: 100% 1px, 100% 1px; }
.tag { display: inline-block; margin-left: 8px; padding: 4px 8px; vertical-align: middle; border: 1px solid var(--accent); border-radius: 999px; font: 400 .6rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

/* ---------- trail ---------- */
.odometer { display: flex; align-items: baseline; gap: 16px; margin: -4px 0 22px; }
.odometer__n { font: italic 400 clamp(3.6rem, 7.6vw, 6.6rem)/1 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums; }
.odometer__u { font: 400 .74rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }

/* ---------- shelf ---------- */
.shelf__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 40px; margin-bottom: 56px; }
.shelf__head .title { margin: 0; }
/* filing-cabinet tabs: the selected folder tab is manila and sits proud of the rail */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px; padding: 0 4px; border-bottom: 1px solid var(--line-strong); }
.filters button {
  position: relative; min-height: 40px; padding: 0 22px; border: 0; margin-bottom: -1px; cursor: pointer;
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 100%, 0 100%); border-radius: 6px 6px 0 0;
  background: rgba(237,231,221,.06); color: var(--text-2); font: 500 .76rem var(--sans); letter-spacing: .06em;
  transition: color var(--fast), background-color .3s, transform .4s var(--ease-out);
}
.filters button:hover { color: var(--text); background: rgba(237,231,221,.12); transform: translateY(-2px); }
.filters button[aria-pressed="true"] { min-height: 46px; background: var(--manila); color: #1d1810; font-family: 'Special Elite', var(--mono); letter-spacing: .02em; transform: none; }
.shelf__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 56px 32px; }
.book[hidden] { display: none; }
.book a { display: block; text-decoration: none; perspective: 1100px; cursor: pointer; }
.book a:hover .b3d, .book a:focus-visible .b3d { --ry: -30deg; --lift: -14px; }
.book__title { transition: color .4s; }
.book a:hover .book__title { color: var(--accent); }

/* ---------- 3D books: a cover with real page edges and a spine ---------- */
.b3d {
  --th: 22px; --ry: -16deg; --rx: 0deg; --lift: 0px; --spine: #111;
  position: relative; display: block; transform-style: preserve-3d;
  transform: translateY(var(--lift)) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .9s var(--ease-out);
}
.b3d > .cover { transform: translateZ(calc(var(--th) / 2)); }
.b3d__pages, .b3d__spine { position: absolute; top: 1.4%; bottom: 1.4%; width: var(--th); }
.b3d__pages { /* the page block, seen past the cover's right edge */
  right: 0; transform-origin: right center; transform: translateZ(calc(var(--th) / 2)) rotateY(-90deg);
  background: linear-gradient(90deg, rgba(0,0,0,.35), transparent 30%, transparent 70%, rgba(0,0,0,.25)), repeating-linear-gradient(90deg, #e6dcc5 0 1px, #c4b89c 1px 2px);
}
.b3d__spine { top: 0; bottom: 0; left: 0; transform-origin: left center; transform: translateZ(calc(var(--th) / 2)) rotateY(90deg); background: linear-gradient(90deg, rgba(255,255,255,.08), transparent 40%, rgba(0,0,0,.4)), var(--spine); }
.b3d::after { /* contact shadow on the shelf */
  content: ''; position: absolute; left: 4%; right: -6%; bottom: -16px; height: 26px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0,0,0,.75), transparent); transform: translateZ(-30px);
}
.b3d[data-series="josh"] { --spine: #1b1b1d; }
.b3d[data-series="hawk"] { --spine: #0f1c3d; }
.b3d[data-series="true"] { --spine: #222; }
.b3d[data-series="dragon"] { --spine: #0b2a24; }
.b3d[data-series="trail"] { --spine: #33261b; }
.b3d[data-series="kids"] { --spine: #d9a93a; }

/* ---------- police tape across a chapter boundary ---------- */
.tape { position: absolute; left: 0; right: 0; top: 0; height: 0; z-index: 3; overflow-x: clip; pointer-events: none; }
.tape__strip {
  position: absolute; left: -10vw; width: 120vw; top: -26px; height: 46px; display: flex; align-items: center; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.18), transparent 40%, rgba(0,0,0,.18)), #d8b13a;
  box-shadow: 0 18px 30px -12px rgba(0,0,0,.85), 0 2px 0 rgba(0,0,0,.25);
  transform: rotate(-3deg);
}
.tape__strip--b { top: 6px; height: 38px; transform: rotate(2.2deg); filter: brightness(.82); }
.tape__strip span { display: block; white-space: nowrap; font: 400 1.05rem/1 Anton, Archivo, sans-serif; letter-spacing: .18em; text-transform: uppercase; color: #141210; will-change: transform; }
.tape__strip--b span { font-size: .9rem; }

/* ---------- redaction: a bar that peels off a key phrase when it comes into view ---------- */
.redact { position: relative; color: var(--text); }
.js .redact::after {
  content: ''; position: absolute; left: -.12em; right: -.12em; top: .08em; bottom: .02em;
  background: linear-gradient(180deg, rgba(255,255,255,.12), transparent), var(--bone);
  transform-origin: right center; transition: transform 1s var(--ease-io);
}
.js .redact.is-open::after { transform: scaleX(0); }

/* ---------- case file: book detail opened from the shelf ---------- */
.casefile {
  width: min(980px, calc(100vw - 32px)); max-width: none; max-height: none; padding: 0; border: 0; overflow: visible;
  background: none; color: var(--text);
}
.casefile::backdrop { background: rgba(4,4,5,.8); }
.casefile__sheet {
  position: relative; display: grid; grid-template-columns: minmax(200px, 38%) 1fr; gap: 48px; align-items: center;
  margin-top: 30px; padding: 64px 56px 52px; border: 1px solid var(--line); background: radial-gradient(120% 90% at 20% 0%, #1b1a1c, #0d0d0f 60%);
  box-shadow: 0 50px 120px -30px rgba(0,0,0,.95);
}
.casefile__tab { /* the manila folder tab */
  position: absolute; left: 40px; top: -36px; margin: 0; padding: 9px 26px 10px; background: var(--manila); color: #1d1810;
  font: 400 .9rem 'Special Elite', var(--mono); letter-spacing: .08em; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 100%, 0 100%); border-radius: 6px 6px 0 0;
}
.casefile__close {
  position: absolute; right: 16px; top: 16px; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; background: transparent;
  transition: border-color var(--fast), transform .5s var(--ease-out);
}
.casefile__close::before, .casefile__close::after { content: ''; position: absolute; left: 13px; right: 13px; top: 21px; height: 1px; background: var(--text); transform: rotate(45deg); }
.casefile__close::after { transform: rotate(-45deg); }
.casefile__close:hover { border-color: var(--line-strong); transform: rotate(90deg); }
.casefile__book { perspective: 1400px; padding: 10px 30px 30px 10px; }
.b3d--lg { --th: 34px; --ry: -24deg; --rx: 4deg; }
.casefile__stamp { /* rubber stamp with the series name */
  display: inline-block; margin: 0 0 26px; padding: 6px 14px; border: 2px solid var(--oxblood); border-radius: 4px; color: var(--oxblood);
  font: 400 .95rem 'Special Elite', var(--mono); letter-spacing: .12em; text-transform: uppercase; transform: rotate(-6deg); opacity: .9;
}
.casefile__title { margin: 0 0 8px; font: 400 clamp(2.4rem, 4.6vw, 4rem)/1 var(--serif); letter-spacing: -.01em; }
.casefile__sub { margin: 0 0 20px; font: italic 400 1.35rem/1.3 var(--serif); color: var(--text-2); }
.casefile__sub:empty { display: none; }
.casefile .lede { margin-bottom: 30px; }
.book__series { display: block; margin-top: 18px; font: 400 .68rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.book__title { display: block; margin-top: 4px; font: 400 1.6rem/1.05 var(--serif); }

/* ---------- closing / press ---------- */
.press { margin-top: 64px; padding: 26px 28px 18px; border: 1px solid var(--line); background: rgba(14,14,16,.86); }
.press__label { margin: 0 0 12px; font: 400 .7rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.press__bio { margin: 0 0 8px; font: 400 1.5rem/1.35 var(--serif); color: var(--text); }

/* ---------- footer ---------- */
.footer { position: relative; z-index: 2; padding: 70px 0 44px; border-top: 1px solid var(--line); background: var(--ink); }
.footer__inner { display: grid; grid-template-columns: 1fr auto; gap: 30px 40px; align-items: end; }
.footer__mark { margin: 0; font: 400 clamp(2.6rem, 5.4vw, 4.8rem)/.95 var(--serif); letter-spacing: -.02em; }
.footer__links { display: flex; flex-wrap: wrap; gap: 26px; }
.footer__links a { font: 400 .85rem var(--sans); text-decoration: none; color: var(--text-2); }
.footer__links a:hover { color: var(--text); }
.footer__small { grid-column: 1 / -1; margin: 0; font: 400 .7rem var(--mono); letter-spacing: .04em; color: var(--text-3); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nav { grid-template-columns: auto 1fr auto; }
  .nav__links { display: none; }
}
/* large monitors: a slightly wider text column inside the capped layout */
@media (min-width: 1600px) {
  .col { width: min(640px, 46%); }
  .lede { font-size: 1.2rem; }
}
/* stacked layout: keep in step with STACKED in js/data.js */
@media (max-width: 599px), (max-width: 1199px) and (max-aspect-ratio: 11/10) {
  body { font-size: 1rem; }
  .nav { gap: 16px; padding: 14px var(--gutter); }
  .brand__name { display: none; }
  .chapter { min-height: 0; padding: 60vh 0 80px; align-items: flex-end; }
  .hero { min-height: 100svh; padding: 46svh 0 96px; }
  .col, .hero .col, .chapter[data-side="right"] .col { width: 100%; margin: 0; }
  .col { padding: 48px 4px 0; background: linear-gradient(180deg, transparent, rgba(7,7,8,.88) 120px); margin: 0 -4px; }
  .hero .col { padding-top: 0; background: linear-gradient(180deg, transparent, rgba(7,7,8,.7) 30%); }
  .display { font-size: clamp(3.6rem, 16vw, 5.4rem); }
  .facts li { padding-right: 18px; margin-right: 18px; }
  .facts { gap: 18px 0; }
  .facts strong { font-size: 1.5rem; }
  .display { letter-spacing: -.018em; }
  .josh { height: 470vh; }
  .josh .sticky { align-items: flex-end; padding: 0 0 18px; }
  .josh .col { background: linear-gradient(180deg, transparent, rgba(7,7,8,.9) 60px); padding-top: 40px; }
  .josh .label, .josh .title, .josh .lede, .josh .ticks { display: none; }
  .feature { padding-top: 22px; border-top: 0; }
  .feature__tag { min-height: 0; }
  .bio { grid-template-columns: 1fr; gap: 40px; }
  .portrait { width: 72%; }
  .timeline li { grid-template-columns: 84px 1fr; gap: 14px; }
  .offduty { padding: 22px 20px; }
  .shelf { padding-top: 110px; }
  .shelf__grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 36px 16px; }
  .closing { padding-top: 55vh; }
  .cta-row .btn-primary { flex: 1 1 100%; justify-content: space-between; }
  .scroll-hint { display: none; }
  .footer__inner { grid-template-columns: 1fr; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .filters button { flex: none; }
  .casefile__sheet { grid-template-columns: 1fr; gap: 28px; padding: 54px 22px 30px; max-height: calc(100svh - 70px); overflow: auto; }
  .casefile__book { width: 58%; margin: 0 auto; }
  .casefile__tab { top: 0; left: 22px; padding: 8px 20px; border-radius: 0 0 6px 6px; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 10px 100%); }
  .tape__strip { height: 36px; top: -20px; }
  .tape__strip--b { height: 30px; top: 4px; }
  .tape__strip span { font-size: .85rem; }
}
/* stacked on a tablet: keep a readable measure and give the photo room */
@media (min-width: 600px) and (max-width: 1199px) and (max-aspect-ratio: 11/10) {
  .col, .hero .col, .chapter[data-side="right"] .col { max-width: 660px; }
  /* the backing behind the text spans the screen, not just the column */
  .col, .hero .col, .josh .col { background: none; }
  .chapter > .wrap:not(.wrap--wide), .josh .wrap { background: linear-gradient(180deg, transparent, rgba(7,7,8,.88) 120px); }
  .chapter.hero > .wrap { background: linear-gradient(180deg, transparent, rgba(7,7,8,.7) 30%); }
  .display { font-size: clamp(5rem, 12vw, 7rem); }
  .bio { grid-template-columns: 300px 1fr; align-items: end; }
  .portrait { width: 100%; }
  .cta-row .btn-primary { flex: 0 0 auto; }
}
/* side-by-side on a small laptop or landscape tablet: a little more room for text */
@media (max-width: 1199px) and (min-aspect-ratio: 11/10) {
  .col { width: min(560px, 50%); }
  .bio { grid-template-columns: 40% 1fr; gap: 28px; }
  .bio__text .bio__lead { font-size: 1.5rem; }
}
/* laptops with little height (1280x720, 1366x768): tighten vertical rhythm */
@media (min-height: 561px) and (max-height: 820px) and (min-aspect-ratio: 11/10) {
  .hero { padding-top: 96px; }
  .display { font-size: clamp(3.6rem, 7vw, 7rem); margin-bottom: 24px; }
  .lede { margin-bottom: 30px; }
  .facts { margin-top: 36px; padding-top: 20px; }
  .josh .title { font-size: clamp(2.4rem, 4.1vw, 3.7rem); margin-bottom: 18px; }
  .josh .lede { margin-bottom: 8px; font-size: 1rem; }
  .feature { padding: 18px 0 16px; }
  .feature__title { margin-top: 10px; }
  .feature__tag { margin-bottom: 18px; min-height: 0; }
}
/* short landscape screens (phones on their side): side-by-side, but compact */
@media (max-height: 560px) and (min-aspect-ratio: 11/10) {
  .nav { padding-top: 10px; padding-bottom: 10px; }
  .brand__name { display: none; }
  .chapter { min-height: 0; padding: 90px 0; }
  .hero { min-height: 100svh; padding: 76px 0 40px; }
  .col { width: min(520px, 52%); }
  .hero .col { width: min(560px, 58%); }
  .display { font-size: clamp(2.6rem, 7.5vw, 3.9rem); margin-bottom: 16px; }
  .title, .title--xl { font-size: clamp(2.1rem, 5vw, 3rem); margin-bottom: 16px; }
  .lede { font-size: 1rem; margin-bottom: 22px; }
  .eyebrow, .label { margin-bottom: 14px; }
  .facts { margin-top: 24px; padding-top: 16px; }
  .facts strong { font-size: 1.35rem; }
  .scroll-hint { display: none; }
  .btn { min-height: 48px; }
  .josh .sticky { padding-top: 54px; }
  .josh .lede, .josh .ticks { display: none; }
  .feature { padding: 14px 0; }
  .feature__title { margin: 8px 0 4px; font-size: 1.9rem; }
  .feature__tag { min-height: 0; margin-bottom: 14px; font-size: .95rem; }
  .bio { grid-template-columns: 190px 1fr; }
  .shelf__grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .eyebrow::before, .scroll-hint i::after { animation: none; }
  .js .hero-in { animation-name: fadeIn; }
  @keyframes fadeIn { from { opacity: 0; } }
  .btn, .b3d { transition-duration: .2s; }
  .js .redact::after { display: none; }
}

/* ==========================================================================
   Phone edition: thumb-first patterns, not the desktop layout shrunk down.
   Same query as STACKED in js/data.js.
   ========================================================================== */
.dock, .jcards, .hero__touch, .casefile__grab, .shelf__hint, .on-phone { display: none; }

@media (max-width: 599px), (max-width: 1199px) and (max-aspect-ratio: 11/10) {
  /* header keeps only the mark; the dock carries navigation */
  .nav > .btn, .scroll-line, .on-wide { display: none; }
  .on-phone { display: inline; }
  .stage-status { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .footer { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

  /* ---------- dock ---------- */
  .dock {
    position: fixed; z-index: 55; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
    display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 22px;
    background: rgba(13,13,15,.94); box-shadow: 0 24px 50px -16px rgba(0,0,0,.9);
    transform: translateY(calc(100% + 24px)); transition: transform .6s var(--ease-out);
  }
  .dock.is-in { transform: none; }
  .dock__row { display: flex; align-items: center; gap: 8px; padding: 7px 7px 7px 8px; }
  .dock__chapter {
    flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 6px; border: 0; background: none; cursor: pointer;
    color: var(--text); font: 500 .74rem var(--sans); letter-spacing: .16em; text-transform: uppercase; text-align: left;
  }
  .dock__ring { width: 32px; height: 32px; flex: none; transform: rotate(-90deg); }
  .dock__ring circle { fill: none; stroke: var(--line); stroke-width: 2.5; }
  .dock__ring .dock__ring-fill { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 94.25; stroke-dashoffset: 94.25; transition: stroke .6s; }
  .dock__name { position: relative; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .dock__name span { display: inline-block; }
  .dock__chev { width: 9px; height: 9px; margin-right: 6px; border-right: 1.5px solid var(--text-2); border-top: 1.5px solid var(--text-2); transform: rotate(-45deg) translateY(2px); transition: transform .5s var(--ease-out); }
  .dock.is-open .dock__chev { transform: rotate(135deg) translateY(2px); }
  .dock__sheet { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .55s var(--ease-out); }
  .dock.is-open .dock__sheet { grid-template-rows: 1fr; }
  .dock__list { min-height: 0; overflow: hidden; list-style: none; margin: 0; padding: 0 8px; }
  .dock__list li:first-child { padding-top: 10px; }
  .dock__list button {
    width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--line);
    background: none; color: var(--text-2); font: 400 1.55rem/1 var(--serif); text-align: left; cursor: pointer;
  }
  .dock__list li:last-child button { border-bottom: 0; }
  .dock__list button.is-current { color: var(--text); }
  .dock__list button.is-current::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); align-self: center; }

  /* ---------- hero: drag the book ---------- */
  .hero { touch-action: pan-y; }
  .hero__touch {
    position: absolute; right: var(--gutter); top: 22px; z-index: 51; display: flex; align-items: center; gap: 10px; margin: 0;
    padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(7,7,8,.6);
    font: 500 .64rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--text-2); white-space: nowrap;
    transition: opacity .6s;
  }
  .hero__touch i { position: relative; width: 22px; height: 1px; background: var(--line-strong); }
  .hero__touch i::after { content: ''; position: absolute; top: -3px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: touchHint 2.2s var(--ease-io) infinite; }
  .hero.is-touched .hero__touch { opacity: 0; }

  /* ---------- Josh Williams: swipe the story, the 3D shelf turns ---------- */
  .josh { height: auto; }
  .josh .sticky { position: relative; height: auto; display: block; padding: 58vh 0 56px; }
  .josh .label { display: flex; }
  .josh .title, .josh .lede { display: block; }
  .josh .feature, .josh .ticks { display: none; }
  .josh .lede { margin-bottom: 24px; }
  .jcards {
    display: flex; gap: 12px; margin: 0 calc(-1 * var(--gutter) - 4px); padding: 4px calc(var(--gutter) + 4px) 14px;
    overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: calc(var(--gutter) + 4px); scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .jcards::-webkit-scrollbar { display: none; }
  .jcard {
    flex: 0 0 84%; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 18px;
    border: 1px solid var(--line); background: linear-gradient(160deg, rgba(30,28,30,.92), rgba(12,12,14,.94));
    transform: scale(.94); opacity: .55; transform-origin: left center; transition: transform .5s var(--ease-out), opacity .5s, border-color .5s;
  }
  .jcard.is-on { transform: none; opacity: 1; border-color: rgba(196,20,47,.55); }
  .jcard__series { margin: 0; font: 500 .62rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
  .jcard__title { margin: 0; font: 400 2rem/1.02 var(--serif); }
  .jcard__tag { margin: 0 0 6px; font-size: .95rem; font-weight: 350; color: var(--text-2); }
  .jcard__links { display: flex; gap: 20px; margin: auto 0 0; }
  .jcard__links a { min-height: 44px; display: inline-flex; align-items: center; font: 500 .82rem var(--sans); color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
  .jcard__links a:first-child { border-color: var(--accent); }

  /* ---------- shelf: a coverflow you swipe ---------- */
  .shelf__grid {
    display: flex; gap: 0; margin: 0 calc(-1 * var(--gutter)); padding: 30px 0 10px;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .shelf__grid::-webkit-scrollbar { display: none; }
  .shelf__grid::before, .shelf__grid::after { content: ''; flex: 0 0 23vw; }
  .book { flex: 0 0 54vw; scroll-snap-align: center; padding: 0 3vw; }
  .book__series, .book__title { text-align: center; }
  .shelf__hint { display: block; margin: 10px 0 0; text-align: center; font: 500 .62rem var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); }

  /* ---------- case file: a bottom sheet ---------- */
  .casefile { width: 100%; max-width: 100%; max-height: 100%; margin: auto 0 0; inset: auto 0 0 0; }
  .casefile__sheet {
    margin: 0; border-radius: 22px 22px 0 0; border-bottom: 0; padding: 46px 22px calc(26px + env(safe-area-inset-bottom));
    max-height: 90svh; overflow: auto; overscroll-behavior: contain;
  }
  .casefile__grab { display: block; position: absolute; left: 0; right: 0; top: 0; height: 40px; z-index: 2; touch-action: none; cursor: grab; }
  .casefile__grab::before { content: ''; display: block; width: 44px; height: 4px; margin: 10px auto 0; border-radius: 2px; background: var(--line-strong); }
  .casefile__tab { top: 22px; }
  .casefile__close { top: 18px; }
  .casefile__book { width: 52%; padding-top: 18px; }
}
@media (hover: hover) { .hero__touch { display: none !important; } }
@keyframes touchHint { 50% { transform: translateX(15px); } }
@media (min-width: 600px) and (max-width: 1199px) and (max-aspect-ratio: 11/10) {
  .book { flex-basis: 34vw; }
  .shelf__grid::before, .shelf__grid::after { flex-basis: 33vw; }
  .jcard { flex-basis: 58%; }
  .casefile__book { width: 36%; }
}
