:root {
  --bg: #f3f2f2;
  --ink: #201e1d;
  --accent: #ec3013;
  --accent-dark: #ae1800;
  --accent-tint: #ffc4b8;
  --accent-on-dark: #ff9783;
  --grey-800: #444141;
  --grey-700: #605d5d;
  --grey-400: #bab6b6;
  --grey-200: #e4e2e2;
  --pad-x: clamp(20px, 4vw, 40px);
  --mono: "JetBrains Mono", monospace;
  --nav-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
::selection { background: var(--accent-tint); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

[id] { scroll-margin-top: var(--nav-h); }

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

/* clip, not hidden: hidden would make this a scroll container and break the sticky nav */
.page { background: var(--bg); color: var(--ink); min-height: 100vh; overflow-x: clip; }

.container { max-width: 1320px; margin: 0 auto; }

.display { font-weight: 900; font-stretch: 125%; font-style: italic; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 2px solid var(--ink); }
.nav-inner {
  max-width: 1320px; margin: 0 auto; padding: 16px var(--pad-x);
  display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; align-items: center;
  font-size: 14px; font-weight: 700;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-stretch: 125%; font-style: italic; font-size: 17px; }
.brand-mark { width: 24px; height: 11px; background: var(--accent); transform: skewX(-24deg); }
.nav-links { display: flex; flex-wrap: wrap; gap: 24px; }
.accent-link { color: var(--accent); }

/* Hero */
.hero { padding: clamp(32px, 5vw, 56px) var(--pad-x) 0; }
.wordmark {
  margin: 0;
  font-weight: 900; font-stretch: 125%; font-style: italic;
  font-size: min(9.4vw, 136px); line-height: 0.82; letter-spacing: -0.055em; white-space: nowrap;
}
.accent { color: var(--accent); }
.speed-lines {
  margin: clamp(20px, 2.5vw, 32px) calc(-1 * var(--pad-x)) 0 auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 9px; width: 60%;
}
.hero-row {
  display: flex; flex-wrap: wrap; gap: 24px clamp(24px, 4vw, 56px); align-items: flex-end;
  margin-top: clamp(24px, 3vw, 40px);
}
.hero-copy { flex: 1 1 380px; display: flex; flex-direction: column; gap: 20px; padding-bottom: 12px; }
.lede { margin: 0; max-width: 540px; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.5; color: var(--grey-800); text-wrap: pretty; }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: flex; justify-content: space-between; gap: 48px; min-width: 190px; font-weight: 800; }
.btn-primary { padding: 15px 18px; background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { padding: 13px 16px; border: 2px solid var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--bg); }

/* The page */
.page-section { padding: clamp(56px, 7vw, 96px) var(--pad-x) 0; }
.fig { margin: 0; }
.fig-caption {
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; align-items: baseline;
  font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.fig-count { color: var(--grey-700); font-variant-numeric: tabular-nums; }
.diagram-scroll { margin-top: 12px; overflow-x: auto; }
.diagram-inner { min-width: 900px; }
.diagram { height: 190px; border: 2px solid var(--ink); display: flex; background: #fff; }
.d-header {
  width: 130px; flex: none; background: var(--ink); color: var(--bg); padding: 14px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
}
.d-header-sub { font-family: var(--mono); font-weight: 400; color: var(--grey-400); letter-spacing: 0; }
.d-slots { display: flex; border-right: 2px dashed var(--ink); }
.slot {
  width: 38px; border-right: 1px solid var(--grey-400);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding-bottom: 10px; gap: 8px; transition: opacity .3s;
}
.slot-bar { width: 12px; height: 100px; background: var(--ink); }
.slot-label { font-family: var(--mono); font-size: 11px; }
.d-free {
  flex: 1;
  background: repeating-linear-gradient(90deg, transparent 0 22px, var(--grey-200) 22px 24px);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; color: var(--grey-700);
}
.d-tuples { display: flex; flex-direction: row-reverse; border-left: 2px dashed var(--ink); }
.tuple {
  background: var(--ink); border-left: 2px solid #fff; color: #fff; padding: 12px;
  font-family: var(--mono); font-size: 11px; transition: opacity .3s, background .3s;
}
.slot.is-empty { opacity: 0.15; }
.tuple.is-empty { opacity: 0.06; }
.slot.is-latest .slot-bar, .tuple.is-latest { background: var(--accent); }
.diagram-legend {
  margin-top: 10px; display: grid; grid-template-columns: 130px 228px 1fr auto;
  font-size: 13px; font-weight: 600; color: var(--grey-800);
}
.facts {
  margin-top: 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  border-top: 2px solid var(--ink);
}
.fact { padding: 20px 24px 0 0; display: flex; flex-direction: column; gap: 6px; }
.fact-title { font-weight: 800; }
.fact-text { color: var(--grey-700); font-size: 15px; }

/* Layers */
.layers-section { padding: clamp(72px, 8vw, 112px) var(--pad-x) 0; }
.layers-head { display: flex; flex-wrap: wrap; gap: 16px 40px; justify-content: space-between; align-items: flex-end; }
.layers-title { margin: 0; font-size: clamp(40px, 5.4vw, 72px); line-height: 0.92; letter-spacing: -0.035em; }
.layers-intro { margin: 0; max-width: 420px; color: var(--grey-700); font-size: 16px; }
.stairs { margin: 32px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.stair {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 16px 22px;
  background: var(--ink); color: var(--bg);
}
.stair-title { flex: 0 0 190px; margin: 0; font-weight: 900; font-stretch: 125%; font-style: italic; font-size: 26px; }
.stair-desc { flex: 1 1 240px; color: var(--grey-400); }
.stair-base { background: var(--accent); color: #fff; }
.stair-base .stair-desc { color: inherit; }
.types {
  margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-family: var(--mono); font-size: 13px; color: var(--grey-700);
}
.types-label { color: var(--ink); font-weight: 600; }

/* Run it */
.run { margin-top: clamp(72px, 8vw, 112px); background: var(--ink); color: var(--bg); }
.run-inner {
  max-width: 1320px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}
.run-copy { padding: clamp(40px, 5vw, 64px) var(--pad-x); display: flex; flex-direction: column; gap: 16px; }
.run-title { margin: 0; font-size: clamp(36px, 4.4vw, 56px); line-height: 0.92; letter-spacing: -0.03em; color: var(--bg); }
.run-text { margin: 0; max-width: 400px; color: var(--grey-400); }
.cmds { border-left: 2px solid var(--grey-800); display: flex; flex-direction: column; justify-content: center; }
.cmd { display: flex; align-items: stretch; border-bottom: 1px solid var(--grey-800); }
.cmd code {
  flex: 1; min-width: 0; padding: 20px clamp(20px, 3vw, 32px);
  font-family: var(--mono); font-size: 14px; color: var(--bg); overflow-x: auto; white-space: nowrap;
}
.prompt { color: var(--accent-on-dark); }
.copy {
  flex: none; width: 96px; border: 0; border-left: 1px solid var(--grey-800);
  background: transparent; color: var(--bg);
  font-family: var(--mono); font-size: 12px; text-align: left; padding: 0 16px; cursor: pointer;
}
.copy:hover { background: var(--grey-800); }
.copy.is-copied, .copy.is-copied:hover { background: var(--accent); }

/* Checkered strip + footer */
.checkers { height: 36px; background: repeating-conic-gradient(var(--ink) 0 25%, var(--bg) 0 50%) 0 0 / 36px 36px; }
.footer {
  max-width: 1320px; margin: 0 auto; padding: 24px var(--pad-x);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  font-size: 13px; font-weight: 600;
}
.footer-brand { font-weight: 900; font-stretch: 125%; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slot, .tuple { transition: none; }
}
