/* Layout: left-aligned editorial column. The hero ends in a long, low coal
   bed that is also a chart (hour of day by weekday), like a narrow grill
   seen from above. Heat is the only color: a five-stop scale from cold coal
   to white ash-glow, used for data and for the one accent. Mincho serif
   speaks, grotesk explains, mono labels the record.
   Single committed dark look. */
:root {
  --bg: #0f0c0b;
  --bg-raised: #181412;
  --bg-sunk: #0a0807;
  --line: rgba(240, 228, 220, 0.10);
  --line-strong: rgba(240, 228, 220, 0.24);
  --fg: #efe9e4;
  --fg-muted: #a39890;
  --fg-faint: #746a63;
  --heat-0: #2a2422;
  --heat-1: #5c1c10;
  --heat-2: #c83c14;
  --heat-3: #ff7a28;
  --heat-4: #ffd696;
  --ember: #ff6a2b;
  --ember-hover: #ff8850;
  --ember-ink: #1d0a02;
  --ember-rgb: 255, 106, 43;
  --glow2-rgb: 200, 60, 20;
  --field-bg: var(--field-bg);
  --bench-shadow: rgba(0, 0, 0, 0.8);
  --years: #ff7a28;
  --mark-fg: #ffd696;
  --font-display: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Schibsted Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'DM Mono', 'SF Mono', Menlo, monospace;
  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
}
h1, h2, h3, p, figure { margin: 0; }

.wrap {
  width: min(1120px, 100%);
  margin-inline: auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}
.label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 22px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand svg { width: 26px; height: 26px; display: block; }
.brand span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.02em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 15px;
  color: var(--fg-muted);
}
.nav-links a { text-decoration: none; }
.nav-links a:hover { color: var(--fg); }
.nav-links .cta {
  color: var(--fg);
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: border-color 160ms ease, color 160ms ease;
}
.nav-links .cta:hover { border-color: var(--ember); color: var(--ember); }

/* Hero */
.hero { position: relative; overflow: hidden; }
.hero::after {
  /* heat coming off the bed */
  content: "";
  position: absolute;
  left: 50%;
  bottom: -30%;
  width: 120%;
  height: 80%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 100%, rgba(var(--ember-rgb), 0.10) 0%, rgba(var(--ember-rgb), 0.04) 35%, transparent 65%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-copy {
  padding-block: clamp(48px, 9vw, 112px) clamp(36px, 5vw, 64px);
  display: grid;
  gap: 26px;
  justify-items: start;
}
.hero-copy .label { animation: rise 0.8s 0.05s ease-out backwards; }
h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(44px, 8.2vw, 104px);
  line-height: 1.04;
  letter-spacing: -0.015em;
  text-wrap: balance;
  animation: rise 0.9s 0.15s ease-out backwards;
}
h1 i { font-style: normal; color: var(--ember); }
.lede {
  max-width: 34em;
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--fg-muted);
  animation: rise 0.9s 0.3s ease-out backwards;
}
.lede strong { color: var(--fg); font-weight: 500; }
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
  margin-top: 6px;
  animation: rise 0.9s 0.45s ease-out backwards;
}
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 15px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--ember);
  color: var(--ember-ink);
  font: 600 16px/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease;
}
.btn:hover { background: var(--ember-hover); }
.text-link {
  font-size: 16px;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: border-color 160ms ease;
}
.text-link:hover { border-color: var(--ember); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* Coal bed */
.bed { padding-bottom: clamp(40px, 6vw, 72px); }
.bed canvas { display: block; width: 100%; }
.bed figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 32px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--fg-muted);
}
.bed figcaption em { font-style: normal; color: var(--fg-faint); }
.scale {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
}
.scale b {
  display: block;
  width: 120px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--heat-0), var(--heat-1), var(--heat-2), var(--heat-3), var(--heat-4));
}

/* Sections */
section { padding-block: clamp(72px, 10vw, 132px); }
.rule-top { border-top: 1px solid var(--line); }
.sec-head {
  display: grid;
  gap: 18px;
  margin-bottom: clamp(36px, 5vw, 60px);
  max-width: 780px;
}
h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.sec-head p:not(.label) { color: var(--fg-muted); max-width: 36em; }

/* Workbench glimpse */
.bench {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-raised);
  overflow: hidden;
  box-shadow: 0 40px 80px -30px var(--bench-shadow);
}
.bench-bar, .bench-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--fg-muted);
}
.bench-bar { border-bottom: 1px solid var(--line); }
.bench-foot { border-top: 1px solid var(--line); background: var(--bg-sunk); }
.bench-bar .tabs { display: flex; gap: 20px; }
.bench-bar .tabs span:first-child { color: var(--fg); box-shadow: 0 13px 0 -11px var(--ember); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ember); }
.bench-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.conds {
  padding: 18px;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 10px;
  align-content: start;
}
.conds .label { margin-bottom: 4px; }
.cond {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 14px;
}
.cond small { font-family: var(--font-mono); font-size: 11px; color: var(--fg-faint); letter-spacing: 0.04em; }
.cond-add { display: flex; gap: 8px; margin-top: 4px; }
.cond-add span {
  font-size: 13px;
  color: var(--fg-muted);
  padding: 6px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}
.rows { min-width: 0; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 700px; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  white-space: nowrap;
}
td { color: var(--fg-muted); }
td.num { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.narr { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; color: var(--fg); min-width: 300px; }
td.narr mark { background: rgba(var(--ember-rgb), 0.18); color: var(--mark-fg); padding: 1px 3px; border-radius: 2px; }
tr:last-child td { border-bottom: 0; }
.bench-note { margin-top: 16px; font-size: 14px; color: var(--fg-faint); }

/* Method */
.method { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); }
.method > div {
  padding: clamp(26px, 3.4vw, 44px) 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  align-content: start;
}
.method > div:nth-child(odd) { padding-right: clamp(20px, 4vw, 56px); border-right: 1px solid var(--line); }
.method > div:nth-child(even) { padding-left: clamp(20px, 4vw, 56px); }
h3 { font-family: var(--font-display); font-weight: 500; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.2; }
.method p { color: var(--fg-muted); max-width: 30em; }

/* Records */
.ledger { border-top: 1px solid var(--line-strong); }
.row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 8px 32px;
  align-items: baseline;
  padding-block: 28px;
  border-bottom: 1px solid var(--line);
}
.row .code { font-family: var(--font-display); font-weight: 500; font-size: clamp(28px, 3.4vw, 40px); line-height: 1; }
.row .what { min-width: 0; font-size: 18px; }
.row .what span { display: block; color: var(--fg-muted); font-size: 15px; margin-top: 4px; }
.row .years { font-family: var(--font-mono); font-size: 13px; color: var(--years); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Closing */
.close { position: relative; overflow: hidden; border-top: 1px solid var(--line); }
.close::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -55%;
  width: 130%;
  height: 110%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 100%, rgba(var(--ember-rgb), 0.20) 0%, rgba(var(--glow2-rgb), 0.09) 34%, transparent 66%);
  pointer-events: none;
}
.close .wrap { position: relative; display: grid; gap: 32px; justify-items: start; }
.close h2 { font-size: clamp(36px, 6vw, 76px); line-height: 1.06; }
.close .sub { color: var(--fg-muted); max-width: 30em; margin-top: -12px; }
form { width: min(520px, 100%); display: grid; gap: 8px; }
form label { font-size: 13px; color: var(--fg-muted); }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; }
.form-row input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 14px 18px;
  background: var(--field-bg);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--fg);
  font: 16px var(--font-body);
}
.form-row input::placeholder { color: var(--fg-faint); }
.form-row input[aria-invalid="true"] { border-color: var(--ember); }
.confirm { padding: 18px 22px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--field-bg); }
.form-error { color: var(--ember); font-size: 15px; }
.confirm p + p { margin-top: 4px; color: var(--fg-muted); font-size: 15px; }

footer {
  position: relative;
  border-top: 1px solid var(--line);
  padding-block: 26px 36px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  color: var(--fg-faint);
  font-size: 13px;
}
footer b { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--fg); }

@media (max-width: 860px) {
  .bench-body { grid-template-columns: minmax(0, 1fr); }
  .conds { border-right: 0; border-bottom: 1px solid var(--line); }
  .method { grid-template-columns: minmax(0, 1fr); }
  .method > div:nth-child(odd) { padding-right: 0; border-right: 0; }
  .method > div:nth-child(even) { padding-left: 0; }
  .row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav-links a:not(.cta) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-copy .label, h1, .lede, .actions { animation: none; }
  .btn, .text-link, .nav-links .cta { transition: none; }
}

.btn:disabled { opacity: 0.6; cursor: default; }
