:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6470;
  --border: #e3e0d8;
  --accent: #0b6e4f;
  --accent-contrast: #ffffff;
  --code-bg: #f1efe9;
  --todo-bg: #fff3c4;
  --todo-text: #6b4e00;
  --todo-border: #e0c060;
  --content-width: 44rem;
  --wide-width: 68rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --surface: #181b1f;
    --text: #e9e7e1;
    --muted: #9aa1ac;
    --border: #2a2e35;
    --accent: #4fd1a1;
    --accent-contrast: #0c1512;
    --code-bg: #1d2126;
    --todo-bg: #3a3111;
    --todo-text: #f2d675;
    --todo-border: #6b5a1c;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: var(--wide-width); margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: var(--content-width); margin: 0 auto; padding: 0 1.25rem; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--border); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-top: 0.9rem; padding-bottom: 0.9rem;
}
.wordmark {
  font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none;
}
.wordmark span { color: var(--accent); }
.site-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); }

.site-footer {
  border-top: 1px solid var(--border); margin-top: 5rem;
  padding: 2rem 0 3rem; color: var(--muted); font-size: 0.9rem;
}

/* Landing */
.hero { padding: 5rem 0 3.5rem; }
.eyebrow {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 1rem;
}
.hero h1 {
  font-family: var(--font-serif); font-weight: 600;
  font-size: clamp(2.3rem, 6vw, 4rem); line-height: 1.08;
  letter-spacing: -0.02em; margin: 0 0 1.25rem; max-width: 18ch;
}
.hero .lede { font-size: 1.2rem; color: var(--muted); max-width: 40rem; margin: 0 0 2rem; }

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.button {
  display: inline-block; padding: 0.65rem 1.15rem; border-radius: 0.5rem;
  font-weight: 600; font-size: 0.98rem; text-decoration: none;
  border: 1px solid var(--border); color: var(--text); background: var(--surface);
}
.button.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.button:hover { filter: brightness(1.06); }

.section { padding: 2.5rem 0; }
.section h2 {
  font-family: var(--font-serif); font-weight: 600; font-size: 1.6rem;
  letter-spacing: -0.01em; margin: 0 0 1.25rem;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0.75rem; padding: 1.25rem 1.35rem;
}
.card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.97rem; }

.post-link {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0.75rem; padding: 1.4rem 1.5rem;
}
.post-link:hover { border-color: var(--accent); }
.post-link .meta { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.3rem; }
.post-link h3 { font-family: var(--font-serif); font-weight: 600; font-size: 1.35rem; margin: 0 0 0.4rem; }
.post-link p { margin: 0; color: var(--muted); }

pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 0.6rem;
  padding: 1rem 1.15rem; overflow-x: auto; font-size: 0.9rem; line-height: 1.55; margin: 0;
}
code { font-family: var(--font-mono); font-size: 0.92em; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 0.3rem; }

/* Blog post */
.post-header { padding-top: 4rem; padding-bottom: 1.5rem; }
.post-header h1 {
  font-family: var(--font-serif); font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem); line-height: 1.12;
  letter-spacing: -0.02em; margin: 0 0 1rem;
}
.post-header .meta { color: var(--muted); font-size: 0.95rem; margin: 0; }
.post-header .meta sup { font-size: 0.7em; line-height: 0; }


.prose p { margin: 0 0 1.25rem; }
.prose h2 {
  font-family: var(--font-serif); font-weight: 600; font-size: 1.6rem;
  margin: 2.75rem 0 1rem; letter-spacing: -0.01em;
}
.prose ul { padding-left: 1.3rem; margin: 0 0 1.25rem; }
.prose li { margin-bottom: 0.35rem; }

.tldr {
  border-left: 3px solid var(--accent); background: var(--surface);
  padding: 1rem 1.25rem; border-radius: 0 0.5rem 0.5rem 0; margin: 0 0 2rem;
  font-size: 1.1rem;
}

/* Unfinished-content markers: grep for class="todo" / class="placeholder" */
.todo {
  background: var(--todo-bg); color: var(--todo-text); border: 1px dashed var(--todo-border);
  border-radius: 0.3rem; padding: 0 0.35em; font-size: 0.85em; font-family: var(--font-mono);
  white-space: nowrap;
}

figure { margin: 2rem 0; }
.placeholder {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--border); border-radius: 0.75rem; background: var(--surface);
  color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem; padding: 1rem;
}
.placeholder.chart { aspect-ratio: 16 / 8; }
/* Video gallery: one row of selectors above one player, as wide as the rollout viewer */
.gallery { width: min(var(--wide-width), 100vw - 2rem); margin-left: 50%; transform: translateX(-50%); }
.gallery-rail { width: fit-content; max-width: 100%; margin-bottom: 0.75rem; }
.gallery-stage video {
  display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--surface);
  border: 1px solid var(--border); border-radius: 0.75rem;
}
/* Throughput bar chart: one measure, our row in the accent, the rest neutral */
.throughput { --bar-neutral: #7f8792; }
@media (prefers-color-scheme: dark) { .throughput { --bar-neutral: #6b7280; } }
.chart-title { font-weight: 600; font-size: 0.95rem; margin: 0 0 0.75rem; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.bars li {
  display: grid; grid-template-columns: 12.5rem 1fr 3.5rem; align-items: center; gap: 0.75rem;
  margin: 0; font-size: 0.92rem; line-height: 1.25;
}
.bar-name { font-weight: 600; }
.bar-name small { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.bar-track { display: block; border-left: 1px solid var(--border); }
.bar-fill {
  display: block; height: 0.9rem; min-width: 2px; width: calc(var(--share) * 100%);
  background: var(--bar-neutral); border-radius: 0 4px 4px 0;
}
.bars li.ours .bar-fill { background: var(--accent); }
.bar-value { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.bars li.ours .bar-value { color: var(--text); font-weight: 600; }
@media (max-width: 34rem) {
  .bars li { grid-template-columns: 1fr 3.5rem; }
  .bar-name { grid-column: 1 / -1; }
}
.map-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.map-grid .placeholder { aspect-ratio: 1; }
@media (max-width: 34rem) { .map-grid { grid-template-columns: repeat(2, 1fr); } }
figcaption { color: var(--muted); font-size: 0.88rem; margin-top: 0.6rem; text-align: center; }

.table-scroll { overflow-x: auto; margin: 0 0 1.5rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
td:not(:first-child), th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* Interactive rollout viewer: wider than the text column */
.rollouts {
  width: min(var(--wide-width), 100vw - 2rem);
  margin-left: 50%; transform: translateX(-50%);
}
.rollout-controls { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; margin-bottom: 0.75rem; }
.segmented {
  display: flex; flex-wrap: wrap; border: 1px solid var(--border);
  border-radius: 0.5rem; overflow: hidden; background: var(--surface);
}
.segmented button {
  font: inherit; font-size: 0.88rem; padding: 0.4rem 0.75rem; cursor: pointer;
  border: 0; background: transparent; color: var(--muted);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.rollout-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 22rem;
  border: 1px solid var(--border); border-radius: 0.75rem; overflow: hidden; background: var(--surface);
}
.rollout-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.rollout-load {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.3rem; pointer-events: none;
  color: var(--text);
}
.rollout-load[hidden] { display: none; }
.rollout-load-size { color: var(--muted); font-size: 0.88rem; }

.legend {
  list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.3rem 1.1rem; color: var(--muted); font-size: 0.88rem;
}
.legend li { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.swatch { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 2px; }
.swatch-followed { background: #f4f4f4; border: 1px solid var(--border); }
.swatch-car { background: #f57c0a; }
.swatch-goal { background: transparent; border: 2px solid #38bdf8; border-radius: 50%; }
.swatch-light { width: 1.5rem; height: 0.3rem; background: linear-gradient(90deg, #ef4444 0 33%, #facc15 33% 66%, #22c55e 66%); }
.swatch-edge { width: 1.5rem; height: 0.2rem; background: #f2c230; }

/* Benchmark table: wider than the text column, our row emphasised */
.results { width: min(var(--wide-width), 100vw - 2rem); margin-left: 50%; transform: translateX(-50%); }
.results th { white-space: normal; vertical-align: bottom; }
.results td:nth-child(-n+4), .results th:nth-child(-n+4) { text-align: left; }
.results tr.ours td { background: var(--surface); }
.results tr.ours td:first-child { font-weight: 700; }
.table-note { color: var(--muted); font-size: 0.88rem; }
