/* Crashers — explanation site.
   The tokens are the app's own (design/reference/tokens.css), copied so the
   explanation looks like the thing it explains: warm paper, exactly one
   terracotta accent, Bodoni Moda for the lines that matter and Karla for
   everything functional. One theme, no dark palette — same rule as the app. */

:root {
  --ink: #17130F;
  --ink-2: #4A4038;
  --ink-3: #574C42;
  --muted: #6B5C4C;
  --muted-2: #8A7B6B;
  --muted-3: #A2907C;
  --muted-4: #B0A190;
  --paper: #FAF6EF;
  --paper-2: #F3EADA;
  --sand: #F0E8DA;
  --rule: #E5DCCC;
  --border: #DCD2C2;
  --accent: #B4442A;
  --accent-ink: #FFF8EF;

  --font-display: 'Bodoni Moda', Didot, 'Times New Roman', serif;
  --font-ui: Karla, 'Helvetica Neue', Helvetica, sans-serif;

  --gutter: 22px;
  --measure: 720px;
}

* { box-sizing: border-box; }

/* Bodoni Moda is a Didone: the thinner its strokes, the higher the optical-size
   axis goes, and Chrome drives that axis straight off the font size. At heading
   sizes it pushes the hairlines below a pixel, so they render as broken grey
   ghosts of themselves. Pinning the axis keeps the thin strokes solid. */
h1, h2, .brand, blockquote, .stats dd, .transcript .t,
.figure text, [style*="Bodoni"] {
  font-optical-sizing: none;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-3);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ structure */

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: var(--measure); }

header.site {
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  background: rgba(250, 246, 239, .93);
  backdrop-filter: blur(8px);
  z-index: 10;
}

header.site .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 62px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 23px;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}

.brand svg { display: block; flex: 0 0 auto; }

nav.site { display: flex; gap: 4px; flex-wrap: wrap; }

nav.site a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}

nav.site a:hover { color: var(--ink); border-color: var(--border); }
nav.site a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

main { padding: 54px 0 90px; }

footer.site {
  border-top: 1px solid var(--rule);
  padding: 34px 0 64px;
  color: var(--muted-2);
  font-size: 15px;
}

footer.site a { color: var(--muted); }

/* ----------------------------------------------------------------- type */

h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(38px, 6.4vw, 66px);
  line-height: 1.04;
  color: var(--ink);
  margin: 0 0 18px;
  letter-spacing: -0.005em;
}

h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.14;
  color: var(--ink);
  margin: 68px 0 16px;
}

h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  margin: 38px 0 10px;
  letter-spacing: 0.005em;
}

.eyebrow {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-3);
  margin: 0 0 14px;
}

.lede {
  font-size: clamp(20px, 2.4vw, 24px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: var(--measure);
}

p { margin: 0 0 18px; max-width: var(--measure); }

a { color: var(--accent); }

strong { color: var(--ink-2); font-weight: 700; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  font-size: 0.9em;
  background: var(--paper-2);
  border-radius: 5px;
  padding: 1.5px 6px;
  color: var(--ink-2);
}

ul, ol { max-width: var(--measure); padding-left: 22px; margin: 0 0 20px; }
li { margin-bottom: 9px; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 56px 0; }

blockquote {
  margin: 22px 0;
  padding: 2px 0 2px 22px;
  border-left: 3px solid var(--accent);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  line-height: 1.45;
  color: var(--ink);
  max-width: var(--measure);
}

/* --------------------------------------------------------------- pieces */

.video-frame {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  margin: 30px 0 14px;
}

.video-frame video { display: block; width: 100%; height: auto; }

.note {
  border: 1px solid var(--border);
  background: var(--paper-2);
  border-radius: 14px;
  padding: 22px 26px;
  margin: 26px 0;
  max-width: var(--measure);
}

.note.accent { border: 2px solid var(--accent); background: var(--accent-ink); }
.note > :last-child { margin-bottom: 0; }

.note h3 { margin-top: 0; }

.figure { margin: 34px 0 40px; }

.figure svg { display: block; width: 100%; height: auto; }

.figure figcaption {
  font-size: 15px;
  color: var(--muted-2);
  margin-top: 12px;
  max-width: var(--measure);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 2px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  margin: 30px 0;
}

.stats div { background: var(--paper); padding: 20px 22px; }
.stats dt { font-size: 14px; color: var(--muted-2); margin-bottom: 4px; }
.stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--ink);
  line-height: 1.1;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 26px 0;
  font-size: 16.5px;
}

th, td {
  text-align: left;
  padding: 11px 14px 11px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-3);
}

td:last-child, th:last-child { padding-right: 0; }

.tag {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
}

.tag.on { border-color: var(--accent); color: var(--accent); }

.transcript { max-width: var(--measure); }

.transcript section {
  border-top: 1px solid var(--rule);
  padding: 20px 0;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 20px;
}

.transcript .t {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--muted-3);
  font-variant-numeric: tabular-nums;
}

.transcript h4 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.transcript p { margin: 0; color: var(--ink-3); }

.steps { counter-reset: step; list-style: none; padding: 0; max-width: 860px; }

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 62px;
  margin-bottom: 30px;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 18px;
  display: grid;
  place-items: center;
}

.steps h3 { margin: 0 0 6px; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  position: static;
  display: inline-block;
  margin: 10px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
}

@media (max-width: 640px) {
  main { padding: 34px 0 64px; }
  h2 { margin-top: 50px; }
  .transcript section { grid-template-columns: 1fr; gap: 6px; }
  .stats dd { font-size: 29px; }
  table { font-size: 15.5px; }
}

/* Diagrams and wide tables get small on a phone; let them scroll sideways
   rather than shrink their labels into illegibility. The selector is `.scroll`
   rather than `.figure.scroll` so a bare <div class="scroll"> around a table
   gets the same treatment - a three-column table is the same problem as a
   1160-wide diagram, and it should not need a second rule. */
@media (max-width: 760px) {
  .scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .scroll svg { width: 720px; max-width: none; }
  .scroll table { min-width: 620px; }
  .scroll::after {
    content: "scroll sideways →";
    display: block;
    font-size: 13px;
    color: var(--muted-3);
    margin-top: 6px;
  }
}
