/* ============================================================
   David Becerra — Portfolio
   Design system: design-system/david-becerra-portfolio/MASTER.md
   v5.1 — "Blueprint": engineering drawing on warm paper.
     · near-monochrome: black does the structure
     · orange = one protagonist per screen (a page's first headline words, or
       the crane on Home) plus small brand marks — never fills, never body text
     · Geist for voice, Geist Mono for numbers / labels / drawing text
     · cards: 12px radius, 1px black border, 5px 5px 0 hard shadow
   All artwork is inline SVG in the HTML — no decorative image files.
   ============================================================ */

/* ------------------------------------------------------------
   01. Reset
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; color-scheme: light; }
img, svg { display: block; }
img { max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* ------------------------------------------------------------
   02. Tokens — edit colors, type and spacing here
   ------------------------------------------------------------ */
:root {
  --paper: #FAFAFA;
  --ink: #000000;
  --graphite: #242424;
  --steel: #5F5F5F;      /* secondary text — 6.4:1 on paper */
  --ash: #B3B3B3;        /* decorative lines only, never text */
  --orange: #F04A18;     /* emphasis only, ≥24px text */

  --font-sans: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --radius-card: 12px;
  --radius-sm: 4px;
  --radius-pill: 9999px;
  --shadow: 5px 5px 0 0 var(--ink);
  --shadow-lift: 7px 7px 0 0 var(--ink);

  --max: 1200px;
  --gutter: 32px;
  --nav-h: 64px;
  --section: 96px;
}

@media (max-width: 700px) {
  :root { --gutter: 20px; --section: 64px; }
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* graph-paper dot grid — applied to hero and alternate sections */
.dotgrid {
  background-color: var(--paper);
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.13) 1px, transparent 1.3px);
  background-size: 20px 20px;
  background-position: -10px -10px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; left: var(--gutter); top: -80px; z-index: 300;
  background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: var(--radius-pill); text-decoration: none;
}
.skip:focus { top: 8px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.panel-dark :focus-visible { outline-color: var(--paper); }

/* ------------------------------------------------------------
   03. Type
   ------------------------------------------------------------ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--orange);
  flex-shrink: 0;
}

.display {
  font-weight: 600;
  font-size: clamp(2.6rem, 5.6vw, 4.75rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.h2 {
  font-weight: 600;
  font-size: clamp(2rem, 3.8vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.h3 {
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.accent { color: var(--orange); }

.lede {
  font-size: 1.125rem;
  line-height: 1.56;
  color: var(--steel);
  max-width: 56ch;
}

.body-copy p { font-size: 1.0625rem; line-height: 1.55; color: var(--graphite); max-width: 64ch; }
.body-copy p + p { margin-top: 18px; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--steel); }

/* ------------------------------------------------------------
   04. Buttons, tags, chips
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 0 var(--orange); }

.btn-outline { background: transparent; color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--paper); }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* dark panel inverts buttons */
.panel-dark .btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.panel-dark .btn-outline { color: var(--paper); border-color: var(--paper); }
.panel-dark .btn-outline:hover { background: var(--paper); color: var(--ink); }

.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  padding: 6px 10px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper);
  white-space: nowrap;
}
.tag--solid { background: var(--ink); color: var(--paper); }   /* status chips: Open to work, Live */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.text-link {
  font-weight: 600;
  font-size: 15px;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.text-link:hover { text-decoration-color: var(--orange); }

/* ------------------------------------------------------------
   05. Navigation
   ------------------------------------------------------------ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.nav-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.logo svg { width: 28px; height: 28px; }

.nav-links { display: flex; gap: 28px; margin-left: auto; }
.nav-links a {
  font-size: 15px;
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.15s ease;
}
.nav-links a:hover { border-bottom-color: var(--ink); }
.nav-links a[aria-current="page"] { border-bottom-color: var(--orange); font-weight: 600; }

.nav-cta { padding: 8px 18px; min-height: 40px; }

.menu-btn {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
  place-items: center;
}
.menu-btn span,
.menu-btn span::before,
.menu-btn span::after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  position: relative;
  transition: transform 0.25s ease, background 0.2s ease;
}
.menu-btn span::before,
.menu-btn span::after { content: ""; position: absolute; left: 0; }
.menu-btn span::before { top: -5px; }
.menu-btn span::after { top: 5px; }
.menu-btn[aria-expanded="true"] span { background: transparent; }
.menu-btn[aria-expanded="true"] span::before { transform: translateY(5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span::after { transform: translateY(-5px) rotate(-45deg); }

.nav-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  padding: 8px var(--gutter) 24px;
  opacity: 0;
  transform: translateY(-6px);
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}
.nav-panel.is-open {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}
.nav-panel a:not(.btn) {
  display: flex;
  justify-content: space-between;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  padding: 14px 0;
  border-bottom: 1px solid var(--ink);
}
.nav-panel a[aria-current="page"]::after { content: "●"; color: var(--orange); font-size: 12px; align-self: center; }
.nav-panel .btn { margin-top: 20px; }

@media (max-width: 860px) {
  .nav-links, .nav-cta { display: none; }
  .menu-btn { display: grid; }
}
@media (min-width: 861px) {
  .nav-panel { display: none; }
}

/* ------------------------------------------------------------
   06. Home hero — text + spec sheet, then the elevation drawing
   ------------------------------------------------------------ */
.hero {
  border-bottom: 1px solid var(--ink);
  padding: 72px 0 var(--section);
}

.hero-grid { margin-bottom: 64px; }

.hero .display { margin-bottom: 24px; max-width: 12.5ch; }   /* three-line block */
.hero .lede { margin-bottom: 32px; max-width: 62ch; }

/* status line under the hero buttons (replaces the old announcement bar) */
.hero-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
}

/* spec sheet — a small key/value readout card */
.spec {
  font-size: 15px;
}
.spec-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 20px;
  border-bottom: 1px solid var(--ink);
}
.spec dl { padding: 4px 20px 8px; }
.spec dl > div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--ash);
}
.spec dl > div:last-child { border-bottom: 0; }
.spec dt {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--steel);
  padding-top: 2px;
}
.spec dd { line-height: 1.4; }

/* ------------------------------------------------------------
   07. Cards — the one elevated surface
   ------------------------------------------------------------ */
.card {
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

a.card, .card--hover { transition: transform 0.18s ease, box-shadow 0.18s ease; }
a.card { display: block; text-decoration: none; }
a.card:hover, .card--hover:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lift); }

.card-pad { padding: 24px; }

/* ------------------------------------------------------------
   08. Drawing sheet — the Boston elevation + title block
   ------------------------------------------------------------ */
.sheet svg.elev { width: 100%; height: auto; }
.sheet .sheet-art { display: block; width: 100%; height: auto; }   /* the Home illustration (raster); the SVG rules above and below are unused since 2026-11-12 */

/* on narrow screens the drawing keeps a legible size and scrolls sideways
   inside its card, like panning a drawing sheet */
.sheet-scroll { overflow-x: auto; scrollbar-width: thin; }
@media (max-width: 760px) {
  .sheet svg.elev { width: 760px; max-width: none; }
  .sheet .sheet-art { width: 760px; max-width: none; }
}

.elev .ln   { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.elev .thin { fill: none; stroke: var(--ink); stroke-width: 0.8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.elev .hl   { fill: none; stroke: var(--orange); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.elev .dash { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 10 6; vector-effect: non-scaling-stroke; }
.elev .solid { fill: var(--paper); }
.elev text { font-family: var(--font-mono); font-size: 11px; fill: var(--ink); letter-spacing: 0.04em; }
.elev .callout circle { fill: var(--paper); stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.elev .callout text { font-size: 11px; font-weight: 500; text-anchor: middle; }

.titleblock {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 0.8fr 0.8fr;
  border-top: 1px solid var(--ink);
  font-family: var(--font-mono);
}
.titleblock > div { padding: 10px 16px; border-left: 1px solid var(--ink); }
.titleblock > div:first-child { border-left: 0; }
.titleblock span { display: block; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--steel); }
.titleblock strong { display: block; font-size: 13px; font-weight: 500; margin-top: 2px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--ink);
}
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend b {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-weight: 500;
  font-size: 11px;
}
.legend .hl-key { width: 18px; height: 0; border-top: 2px solid var(--orange); border-radius: 0; }

/* phones: project cell spans the top, the other four sit in a 2 × 2 grid
   (cells 2 and 4 in the left column, 3 and 5 in the right) */
@media (max-width: 760px) {
  .titleblock { grid-template-columns: 1fr 1fr; }
  .titleblock > div { border-left: 0; border-top: 1px solid var(--ink); }
  .titleblock > div:first-child { grid-column: 1 / -1; border-top: 0; }
  .titleblock > div:nth-child(odd):not(:first-child) { border-left: 1px solid var(--ink); }
}

/* ------------------------------------------------------------
   09. Sections, stats banner, split layouts
   ------------------------------------------------------------ */
.section { padding: var(--section) 0; border-bottom: 1px solid var(--ink); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px 40px;
  margin-bottom: 48px;
}
.section-head .lede { margin-top: 16px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.stats > div { padding: 28px 24px; }
.stats > div + div { border-left: 1px solid var(--ink); }
.stat-num {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(2.25rem, 4vw, 3.1rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 12px;
}
.stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--ink); }
}
@media (max-width: 460px) {
  .stats { grid-template-columns: 1fr; }
  .stats > div + div { border-left: 0; border-top: 1px solid var(--ink); }
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 48px 72px;
  align-items: start;
}
.split .h2 { margin-bottom: 24px; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

.quote {
  font-size: clamp(1.4rem, 2.2vw, 1.75rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.quote-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
  margin-top: 20px;
}

/* ------------------------------------------------------------
   10. Feature cards (projects) — line icon, title, body, tags
   ------------------------------------------------------------ */
.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}
.features--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 960px) {
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .features, .features--2 { grid-template-columns: 1fr; }
}

.feature { display: flex; flex-direction: column; height: 100%; }
.feature-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.icon { width: 44px; height: 44px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feature .h3 { margin-bottom: 10px; }
.feature p { color: var(--steel); line-height: 1.6; margin-bottom: 18px; }
.feature .tags { margin-top: 6px; margin-bottom: 16px; }   /* stay with the text; spare height collects at the bottom */
.feature .text-link { align-self: flex-start; }

.plans { display: grid; gap: 2px; margin-bottom: 18px; }
.plans a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px dashed var(--ash);
}
.plans a::after { content: "PDF ↓"; color: var(--steel); flex-shrink: 0; }
.plans a:hover { color: var(--orange); }

/* ------------------------------------------------------------
   11. Experience rows — no card, hairline separated
   ------------------------------------------------------------ */
.rows { border-top: 1px solid var(--ink); }
.row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 8px 48px;
  padding: 32px 0;
  border-bottom: 1px solid var(--ink);
}
.row-date {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  padding-top: 4px;
}
.row .h3 { margin-bottom: 4px; }
.row-org {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--steel);
  margin-bottom: 14px;
}
.row ul { display: grid; gap: 8px; max-width: 68ch; }
.row li {
  position: relative;
  padding-left: 18px;
  color: var(--graphite);
  line-height: 1.6;
}
.row li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 1.5px;
  background: var(--ink);
}
.row p { color: var(--graphite); line-height: 1.6; max-width: 68ch; }

@media (max-width: 700px) {
  .row { grid-template-columns: 1fr; padding: 26px 0; }
}

/* skills lists inside cards */
.list { display: grid; }
.list li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--ash);
  line-height: 1.45;
}
.list li:last-child { border-bottom: 0; }
.list small { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--steel); margin-top: 2px; }

.card-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 24px;
  border-bottom: 1px solid var(--ink);
  display: flex;
  justify-content: space-between;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
}

/* About: portrait stacked above the quick-facts card */
.about-side { display: grid; gap: 28px; align-content: start; }
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-bottom: 1px solid var(--ink);
}
.portrait figcaption {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 16px;
}
.portrait figcaption span:last-child { color: var(--steel); }
@media (max-width: 900px) {
  .about-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 560px) {
  .about-side { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   12. Photography — "through the lens" strip
   ------------------------------------------------------------ */
.frames {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 960px) {
  .frames { grid-template-columns: 1fr 1fr; }
}

.frame img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-bottom: 1px solid var(--ink);
  filter: grayscale(0.15);
  transition: filter 0.3s ease;
}
.frame:hover img { filter: none; }
.frame figcaption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 14px;
}
.frame figcaption span:last-child { color: var(--steel); }

/* ------------------------------------------------------------
   13. Dark panel (CTA)
   ------------------------------------------------------------ */
.panel-dark {
  background: var(--ink);
  color: var(--paper);
  padding: var(--section) 0;
}
.panel-dark .lede { color: #C9C9C9; }
.panel-dark .eyebrow { color: var(--paper); }

/* ------------------------------------------------------------
   14. Sub-page header
   ------------------------------------------------------------ */
.page-head {
  border-bottom: 1px solid var(--ink);
  padding: 72px 0 72px;
}
.page-head-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
}
.sheet-no { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.06em; color: var(--steel); }
.page-head .display { max-width: 16ch; margin-bottom: 24px; }


/* ------------------------------------------------------------
   15. Contact
   ------------------------------------------------------------ */
.contact-list a {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  transition: background 0.15s ease;
}
.contact-list a:last-child { border-bottom: 0; }
.contact-list a:hover { background: rgba(0, 0, 0, 0.04); }
.contact-list .k {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
}
.contact-list .v { font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.contact-list .arrow { font-family: var(--font-mono); }

@media (max-width: 560px) {
  .contact-list a { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .contact-list .k { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------
   16. Beyond — one-photo slider
   ------------------------------------------------------------ */
.slider { --slide-w: min(74%, calc(64vh * 1.5)); --gap: 28px; }

.slider-viewport {
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  padding: 4px 0 12px;   /* room for the hard shadow */
}
.slider-viewport.is-dragging { cursor: grabbing; }

.slider-track {
  display: flex;
  gap: var(--gap);
  will-change: transform;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.slider-track.no-anim { transition: none; }

.slide {
  flex: 0 0 var(--slide-w);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  opacity: 0.35;
  transition: opacity 0.5s ease;
  scroll-margin-top: calc(var(--nav-h) + 32px);   /* #frame-NN links land below the sticky nav */
}
.slide.is-active { opacity: 1; }
.slide img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #EDEDED;
  border-bottom: 1px solid var(--ink);
  -webkit-user-drag: none;
  pointer-events: none;
}
.slide figcaption {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 12px 16px;
}
.slide figcaption span:last-child { color: var(--steel); }

.slider-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 28px;
}
.slider-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.slider-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.slider-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.slider-btn:disabled { opacity: 0.3; cursor: default; }
.slider-counter { font-family: var(--font-mono); font-size: 14px; min-width: 5.5rem; text-align: center; }

.slider-thumbs {
  position: relative;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 28px;
  padding: 4px 2px 10px;
  scrollbar-width: thin;
}
.slider-thumbs button {
  flex-shrink: 0;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.slider-thumbs button:hover { opacity: 0.85; }
.slider-thumbs button.is-active { opacity: 1; border-color: var(--ink); }
.slider-thumbs img { width: 72px; height: 48px; object-fit: cover; }

@media (max-width: 640px) {
  .slider { --slide-w: 88%; --gap: 14px; }
}

/* ------------------------------------------------------------
   17. Footer
   ------------------------------------------------------------ */
.footer { padding: 64px 0 28px; }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 0.7fr));
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--ink);
}
.footer .logo { margin-bottom: 16px; }
.footer p { color: var(--steel); max-width: 42ch; line-height: 1.6; }
.footer h2 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.footer ul { display: grid; gap: 8px; }
.footer ul a { text-decoration: none; font-size: 15px; }
.footer ul a:hover { text-decoration: underline; text-underline-offset: 4px; }
.footer-base {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-top: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--steel);
}

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------
   18. Motion hooks
   · Hero entrance is pure CSS: it starts on first paint and never waits
     for a script (items are numbered with style="--i:N" for the stagger).
   · Everything below the fold is revealed by GSAP on scroll. An inline
     script in <head> adds .js-motion before first paint, and removes it
     after 4 s if GSAP never loads, so content can't stay hidden.
   ------------------------------------------------------------ */
.reveal, .reveal-item { opacity: 1; }
.js-motion .reveal:not(.hero-reveal), .js-motion .reveal-item { opacity: 0; }

.hero-reveal {
  animation: hero-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-reveal { animation: none; }
  .js-motion .reveal, .js-motion .reveal-item { opacity: 1 !important; transform: none !important; }
  .slider-track, .slide, .nav-panel { transition: none !important; }
  html { scroll-behavior: auto; }
}

/* tighter band for a single component (stats banner) */
.section--tight { padding: 56px 0; }

/* dimmed neighbour slides: hide the caption instead of showing unreadable text */
.slide:not(.is-active) figcaption { visibility: hidden; }

/* ------------------------------------------------------------
   19. Loading screen — basic and smooth
   Hidden unless the <head> script adds .show-loader (first page of a
   browser session, JS on, no reduced-motion preference). The bar is a
   CSS transform animation, so it runs on the compositor and never stutters.
   ------------------------------------------------------------ */
.loader { display: none; }

.show-loader body { overflow: hidden; }
.show-loader .hero-reveal { animation: none; opacity: 0; }  /* hero animation starts fresh when the loader lifts */
.hero-done .hero-reveal { animation: none; opacity: 1; }     /* safety net: never leave the hero invisible */

.show-loader .loader {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 500;
  background-color: var(--paper);
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.13) 1px, transparent 1.3px);
  background-size: 20px 20px;
  cursor: pointer;
  transition: opacity 0.45s ease;
}
.loader.is-done { opacity: 0; pointer-events: none; }

.loader-center {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(280px, 72vw);
  animation: loader-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.loader.is-done .loader-center { transform: translateY(-6px); transition: transform 0.45s ease; }

.loader-logo { width: 44px; height: 44px; margin-bottom: 10px; }
.loader-name { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.loader-role {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 18px;
}

.loader-track {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}
.loader-fill {
  height: 100%;
  background: var(--ink);
  transform-origin: left center;
  will-change: transform;
  animation: loader-fill 1.1s cubic-bezier(0.3, 0.6, 0.2, 1) both;
}
/* when the page is ready: finish the last stretch quickly */
.loader.is-done .loader-fill { animation: loader-fill-end 0.3s ease-out both; }

@keyframes loader-in   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes loader-fill { from { transform: scaleX(0); } to { transform: scaleX(0.92); } }
@keyframes loader-fill-end { from { transform: scaleX(0.92); } to { transform: scaleX(1); } }

/* ------------------------------------------------------------
   20. Maps page — scroll chapters and the atlas (book, plates, index)
   Content: maps/plates.js · script: maps.js · see maps/README.md
   ------------------------------------------------------------ */
.maps-section { padding: 64px 0 104px; border-bottom: 1px solid var(--ink); }

/* ----- 20.2 The open book ----- */
.book { position: relative; margin-right: 150px; }
.spread {
    display: grid; grid-template-columns: minmax(0, .6fr) minmax(0, 1.1fr);
    background: var(--paper); border: 1px solid var(--ink); border-radius: 18px;
    /* hard-edged page block: three more leaves under the open one */
    box-shadow: 3px 3px 0 var(--paper), 4px 4px 0 var(--ink), 7px 7px 0 var(--paper), 8px 8px 0 var(--ink), 11px 11px 0 var(--paper), 12px 12px 0 var(--ink);
    position: relative;
}
.spread::after { /* the gutter */
    content: ""; position: absolute; top: 0; bottom: 0; left: 35.3%; width: 56px; transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, rgba(0,0,0,.06) 46%, rgba(0,0,0,.15) 50%, rgba(0,0,0,.06) 54%, transparent);
    pointer-events: none;
}
.page-l { padding: 40px 32px 52px 40px; position: relative; display: flex; flex-direction: column; }
.page-l .txt { margin-bottom: 28px; }
.page-r { padding: 28px 28px 52px 36px; position: relative; }
/* David reads the map, at the foot of the left page. Decorative; in flow, so open sections push him down instead of overlapping */
.maps-david { margin-top: auto; width: auto; height: 104px; align-self: flex-start; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.folio { position: absolute; bottom: 18px; font-family: var(--font-mono); font-size: 11px; color: var(--steel); }
.page-l .folio { left: 40px; } .page-r .folio { right: 28px; }

/* ----- 20.3 Left page: one thing loud, the rest on request ----- */
.txt.is-in { animation: txt-in .55s cubic-bezier(.22,1,.36,1) both; }
@keyframes txt-in { from { opacity: 0; transform: translateY(8px); } }
.txt-no { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--steel); }
.txt-no::before { content: ""; width: 8px; height: 8px; background: var(--orange); }
.txt-no b { color: var(--ink); font-weight: 500; }
.txt-title { font-size: clamp(2rem, 3.1vw, 2.75rem); font-weight: 600; line-height: 1.02; letter-spacing: -.035em; margin-bottom: 18px; text-wrap: balance; }
.txt-sum { color: var(--ink); font-size: 1.04rem; line-height: 1.58; }
.fact { border-left: 3px solid var(--ink); padding: 2px 0 2px 16px; margin: 26px 0 28px; font-size: .97rem; line-height: 1.5; color: var(--graphite); }
.fact .k { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--steel); margin-bottom: 6px; }

.more { border-top: 1px solid var(--ink); }
.more:last-of-type { border-bottom: 1px solid var(--ink); }
.more summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    list-style: none; cursor: pointer; padding: 13px 0;
    font-family: var(--font-mono); font-size: 12px; letter-spacing: .07em; text-transform: uppercase;
}
.more summary::-webkit-details-marker { display: none; }
.more summary .count { color: var(--steel); margin-left: 8px; }
.more summary::after { content: "+"; font-size: 17px; line-height: 1; transition: transform .25s ease; }
.more[open] summary::after { transform: rotate(45deg); }
.more summary:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.more > :not(summary) { animation: txt-in .35s ease both; padding-bottom: 12px; }
.insights li { display: grid; grid-template-columns: 26px 1fr; gap: 4px; padding: 8px 0; border-top: 1px dashed var(--ash); font-size: .92rem; line-height: 1.48; color: var(--steel); }
.insights .n { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink); padding-top: 3px; }
.insights b { color: var(--ink); font-weight: 600; }
.kv > div { display: grid; grid-template-columns: 104px 1fr; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--ash); font-size: .9rem; line-height: 1.4; }
.kv dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--steel); padding-top: 2px; }
.tbc { font-family: var(--font-mono); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; border: 1px dashed var(--ink); border-radius: var(--radius-pill); padding: 1px 7px; margin-left: 6px; white-space: nowrap; }

/* ----- 20.4 Right page: two plates and a thin divider -----
   Each plate is one <img>, created the first time it is needed.
   .is-top is laid over .is-under from the left; --reveal (0–100%)
   says how far. The script writes it at most once per frame. */
.stage {
    --reveal: 100%;
    position: relative; overflow: hidden;
    aspect-ratio: 1900 / 2040; background: #1A1A1A;
    touch-action: pan-y; cursor: ew-resize; user-select: none; -webkit-user-select: none;
}
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; display: none; -webkit-user-drag: none; }
.stage img.is-under, .stage img.is-leaving { display: block; z-index: 1; }
.stage img.is-under.is-fading { animation: under-in .35s ease both; z-index: 2; }
@keyframes under-in { from { opacity: 0; } }
.stage img.is-top { display: block; z-index: 3; clip-path: inset(0 calc(100% - var(--reveal)) 0 0); }
.divider { position: absolute; z-index: 4; top: 0; bottom: 0; left: var(--reveal); width: 1px; margin-left: -.5px; background: rgba(250,250,250,.9); pointer-events: none; transition: opacity .3s ease; }
.divider::after { /* the grip: small at rest, a little larger while in use */
    content: ""; position: absolute; top: 50%; left: 50%; width: 5px; height: 34px; margin: -17px 0 0 -2.5px;
    background: var(--paper); border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.35);
    transition: transform .25s cubic-bezier(.22,1,.36,1);
}
.stage:hover .divider::after, .stage.is-held .divider::after, .stage:focus-within .divider::after { transform: scale(1.5, 1.25); }
.stage[data-side="top"] .divider, .stage[data-side="under"] .divider { opacity: .45; }
.stage .sr-range { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; width: 100%; height: 22px; margin: 0; opacity: 0; cursor: ew-resize; }
.stage:has(.sr-range:focus-visible) { outline: 2px solid var(--orange); outline-offset: 3px; }

/* layer names and the two views, above the map */
.mapbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border: 1px solid var(--ink); border-radius: 10px; padding: 5px 5px 5px 18px; margin-bottom: 14px; }
.mapbar-layers { display: flex; align-items: center; min-width: 0; font-size: 13.5px; font-weight: 500; }
.mapbar-layers span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mapbar-layers i { flex: none; width: 1px; height: 16px; background: var(--ink); margin: 0 20px; }
.mapbar-modes { display: flex; gap: 8px; flex: none; }
.mapbar-modes button { font: inherit; font-size: 13px; font-weight: 500; min-height: 36px; padding: 0 16px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); border-radius: var(--radius-pill); cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.mapbar-modes button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.mapbar-modes button:not([aria-pressed="true"]):hover { background: var(--ink); color: var(--paper); }
.mapbar-modes button:focus-visible, .open-full:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.open-full { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 16px; font-size: 13px; font-weight: 500; color: var(--ink); text-decoration: none; border: 1px solid var(--ink); border-radius: var(--radius-pill); white-space: nowrap; transition: background-color .2s ease, color .2s ease; }
.open-full:hover { background: var(--ink); color: var(--paper); }

/* who is on each side of the divider */
.pair { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--ink); font-size: 13.5px; }
.pair .num { font-family: var(--font-mono); font-size: 11px; color: var(--steel); margin-right: 8px; }
.pair-a { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pair-b { display: flex; align-items: center; gap: 8px; color: var(--steel); min-width: 0; }
.pair-b span { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.pair-b select {
    appearance: none; -webkit-appearance: none; min-width: 0; max-width: 220px;
    font: inherit; font-weight: 600; color: var(--ink); text-overflow: ellipsis;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 2px center;
    border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; padding: 3px 18px 3px 0; cursor: pointer;
}
.pair-b select:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

/* ----- 20.5 Index: page tabs with a thumbnail, on the book's edge ----- */
.rail { position: absolute; left: 100%; top: 0; bottom: 0; width: 138px; margin-left: 12px; display: flex; flex-direction: column; padding-top: 24px; }
.rail-index {
    display: flex; justify-content: space-between; align-items: center; flex: none;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
    background: none; border: 0; border-bottom: 1px solid var(--ink); padding: 0 2px 9px 12px; margin-bottom: 10px; cursor: pointer; color: var(--ink);
}
.rail-index span { color: var(--steel); }
.rail-index:hover { color: var(--steel); }
.rail-index:focus-visible, .rtab:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.rail-list {
    display: flex; flex-direction: column; gap: 5px; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: none; padding-bottom: 28px;
    -webkit-mask-image: linear-gradient(#000 calc(100% - 36px), transparent); mask-image: linear-gradient(#000 calc(100% - 36px), transparent);
}
.rail-list::-webkit-scrollbar { display: none; }
.rtab {
    flex: none; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 9px;
    background: var(--paper); border: 1px solid var(--ink); border-left: 0; border-radius: 0 8px 8px 0;
    font: inherit; text-align: left; color: var(--ink); cursor: pointer; padding: 5px 8px 5px 6px;
    transition: transform .25s cubic-bezier(.22,1,.36,1), background-color .2s ease, color .2s ease;
}
.rtab:hover { transform: translateX(4px); }
.rtab img { width: 34px; height: 44px; object-fit: cover; background: #1A1A1A; border-radius: 2px; display: block; }
.rtab .t { display: grid; gap: 1px; min-width: 0; line-height: 1.15; }
.rtab .num { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; color: var(--steel); }
.rtab b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtab[aria-selected="true"] { background: var(--ink); color: var(--paper); transform: translateX(4px); }
.rtab[aria-selected="true"] .num { color: #BDBDBD; }
.rtab.is-under { box-shadow: inset 3px 0 0 var(--ink); }
.rtab.is-under .num::after { content: " · under"; }

/* full contents, for when the rail is not enough */
.toc { border: 1px solid var(--ink); border-radius: var(--radius-card); box-shadow: var(--shadow); background: var(--paper); color: var(--ink); padding: 0; width: min(920px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 48px)); margin: auto; }
.toc::backdrop { background: rgba(0,0,0,.5); }
.toc[open] { display: flex; flex-direction: column; animation: txt-in .3s ease both; }
.toc-head { display: flex; align-items: baseline; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--ink); flex: none; }
.toc-head h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -.02em; }
.toc-head span { font-family: var(--font-mono); font-size: 12px; color: var(--steel); text-transform: uppercase; letter-spacing: .06em; }
.toc-head button { margin-left: auto; font: inherit; font-size: 14px; background: none; border: 1px solid var(--ink); border-radius: var(--radius-pill); padding: 5px 14px; cursor: pointer; }
.toc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 22px; overflow-y: auto; }
.toc-grid button { display: grid; gap: 8px; width: 100%; font: inherit; text-align: left; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; }
.toc-grid img { width: 100%; height: auto; aspect-ratio: 240 / 315; object-fit: cover; background: #1A1A1A; border: 1px solid var(--ink); border-radius: 4px; transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease; }
.toc-grid button:hover img, .toc-grid button:focus-visible img { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.toc-grid button:focus-visible { outline: none; }
.toc-grid .num { font-family: var(--font-mono); font-size: 11px; color: var(--steel); letter-spacing: .06em; }
.toc-grid b { display: block; font-size: 14px; font-weight: 600; line-height: 1.25; }
.toc-grid [aria-current="true"] img { box-shadow: 4px 4px 0 var(--orange); }

/* ----- 20.6 Chapters above the book: three scroll effects, CSS only -----
   (a) .fill   text goes from grey to ink, word by word. The script
               (section G) wraps each word in <span class="w" style="--i:N">;
               one animation moves --fill from 0 to 1 on the paragraph.
   (b) .ch-stick  the chapter title stays under the nav while its
               chapter scrolls past (plain position: sticky).
   (c) .plx    the picture is taller than its frame and drifts while
               the frame crosses the screen. Never put this on .stage:
               the two plates there must stay aligned.
   Without support for scroll-driven animations, or with reduced
   motion, the resting state shows: black text and still pictures. */
@property --fill { syntax: "<number>"; inherits: true; initial-value: 1; }
@keyframes fill-text { from { --fill: 0; } to { --fill: 1; } }
@keyframes plx-drift { from { transform: translateY(-9%); } to { transform: translateY(9%); } }
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        .fill { animation: fill-text linear both; animation-timeline: view(); animation-range: cover 16% cover 52%; }
        .fill .w { color: color-mix(in srgb, var(--ink) calc(clamp(0, var(--fill) * var(--n) - var(--i), 1) * 100%), var(--ash)); }
        .plx img { animation: plx-drift linear both; animation-timeline: view(); animation-range: cover; will-change: transform; }
    }
}
.chapter { padding: 88px 0; border-bottom: 1px solid var(--ink); }
.ch-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 2fr); gap: 56px; }
.ch-stick { position: sticky; top: calc(var(--nav-h) + 40px); align-self: start; }
.ch-no { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
.ch-no::before { content: ""; width: 8px; height: 8px; background: var(--orange); }
.ch-title { font-size: clamp(1.6rem, 2.6vw, 2.25rem); font-weight: 600; line-height: 1.05; letter-spacing: -.03em; margin-top: 12px; }
.ch-body { display: grid; gap: 40px; }
.ch-big { font-size: clamp(1.55rem, 2.75vw, 2.5rem); font-weight: 500; line-height: 1.22; letter-spacing: -.025em; text-wrap: pretty; }
.ch-mid { font-size: clamp(1.2rem, 1.9vw, 1.6rem); font-weight: 500; line-height: 1.32; letter-spacing: -.018em; text-wrap: pretty; }
.ch-body .kv > div { grid-template-columns: 120px 1fr; padding: 8px 0; font-size: .95rem; }
/* clip, not hidden: hidden would make the frame a scroller and freeze the drift */
.plx { position: relative; overflow: clip; background: #1A1A1A; border: 1px solid var(--ink); border-radius: 6px; aspect-ratio: 16 / 7; }
.plx img { position: absolute; left: 0; top: -12%; width: 100%; height: 124%; object-fit: cover; object-position: 50% 6%; }
.ch-cap { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--steel); }
.atlas-intro { margin-bottom: 44px; }

/* ----- 20.7 Phone: one column, the index becomes a strip ----- */
@media (max-width: 900px) {
    .chapter { padding: 56px 0; }
    .ch-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .ch-stick { position: static; }   /* the nav hides and returns on phones; a second sticky bar would fight it */
    .ch-title { font-size: 1.5rem; margin-top: 6px; }
    .ch-body { gap: 28px; }
    .plx { aspect-ratio: 2 / 1; }     /* no taller: the title baked into the plate would enter the frame */
    .plx img { object-position: 50% 0; }
    .atlas-intro { margin-bottom: 28px; }
    .book { margin-right: 0; display: flex; flex-direction: column; gap: 14px; }
    .rail { position: static; order: -1; width: auto; margin: 0 calc(var(--gutter) * -1); padding: 0; flex-direction: row; align-items: stretch; }
    .rail-index { border: 1px solid var(--ink); border-radius: 8px; padding: 0 12px; margin: 0 8px 0 var(--gutter); gap: 6px; }
    .rail-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 0 var(--gutter) 0 0; scroll-snap-type: x proximity; -webkit-mask-image: none; mask-image: none; }
    .rtab { border: 1px solid var(--ink); border-radius: 8px; width: 148px; scroll-snap-align: start; }
    .rtab:hover, .rtab[aria-selected="true"] { transform: none; }
    .rtab.is-under { box-shadow: inset 0 -3px 0 var(--ink); }
    .spread { grid-template-columns: minmax(0, 1fr); box-shadow: var(--shadow); }
    .spread::after { display: none; }
    .page-r { order: -1; padding: 16px 16px 44px; border-bottom: 1px solid var(--ink); }
    .page-l { padding: 26px 20px 52px; }
    .maps-david { display: none; }
    .mapbar { padding-left: 14px; }
    .mapbar-modes button, .open-full { min-height: 44px; }
    .mapbar-layers i { margin: 0 12px; }
    .page-l .folio { left: 20px; } .page-r .folio { right: 16px; }
    .pair-b select { max-width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
    .rtab, .divider::after, .toc-grid img, .mapbar-modes button, .open-full { transition: none; }
    .txt.is-in, .more > :not(summary), .toc[open], .stage img.is-under.is-fading { animation: none; }
}

/* ------------------------------------------------------------
   21. Runa — the site's cat (black-and-white web version)
   She touches existing geometry: a card border, the footer rule. Never a box
   of her own, never fixed to the screen. Decorative only: alt="", aria-hidden,
   no pointer events, static. Brief: kept outside the repository.
   Art: mascot/web/runa/ (transparent WebP, about 2x the display size)
   ------------------------------------------------------------ */
.runa { position: absolute; z-index: 2; display: block; height: auto; pointer-events: none; user-select: none; -webkit-user-drag: none; }

/* rest on the footer rule: the rule is her floor */
.footer-grid { position: relative; }
.runa--footer-rest { width: clamp(86px, 7.5vw, 104px); right: 0; bottom: 0; margin-bottom: -2px; }

/* phones: the cards stack, so there is no room above a card. Content wins. */
@media (max-width: 680px) {
  .runa--footer-rest { width: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .runa { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------
   22. Home — compact CTA in the hero, walking David at Selected work
   Decorative art: alt="", aria-hidden, no pointer events, static. The layout is complete without it.
   ------------------------------------------------------------ */
/* "You don't have time? Click here →": a pill on the hero's right on wide screens, in flow under the status line otherwise */
.hero-grid { position: relative; }
.cta-pill { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; margin-top: 20px; padding: 6px 20px 6px 16px; border: 1px solid var(--ink); border-radius: var(--radius-pill); font-size: 15px; color: var(--steel); }
.cta-pill svg { width: 30px; height: 26px; flex: none; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cta-pill a { color: var(--ink); font-weight: 600; text-decoration: none; }
.cta-pill .u { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.cta-pill a:hover .u { text-decoration-color: var(--orange); }
@media (min-width: 1100px) { .cta-pill { position: absolute; right: 0; bottom: 66px; margin: 0; } }

/* walking David: left gutter beside the first project card, feet near the bottom of the card row.
   Only where the gutter is wide enough; otherwise hidden. */
.features { position: relative; }
.david { position: absolute; right: calc(100% + 18px); bottom: 8px; width: 96px; height: auto; display: none; pointer-events: none; user-select: none; -webkit-user-drag: none; }
@media (min-width: 1400px) { .david { display: block; } }
