:root {
  color-scheme: dark;
  --bg: #12110e;
  --bg-raise: #1c1a16;
  --line: #3a3428;
  --ink: #f3efe6;
  --muted: #b7ad9c;
  --gold: #e4c27a;
  --gold-ink: #241c0e;
  --focus: #f0d7a2;
  --danger: #e7b2a4;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 1.05rem;
}

a {
  color: var(--gold);
  text-underline-offset: 0.18em;
}

a:hover { color: #f6e3b8; }

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--gold);
  color: var(--gold-ink);
  padding: 0.4rem 0.7rem;
  z-index: 10;
}

.skip:focus { top: 0.75rem; }

.mast,
main,
.colophon {
  width: min(980px, calc(100% - 1.5rem));
  margin-inline: auto;
}

.mast { padding: 1.75rem 0 0.5rem; }

.eyebrow {
  margin: 0 0 0.4rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--gold);
}

h1, h2, h3 {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 7vw, 3.3rem); margin: 0 0 0.8rem; }

h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); margin: 0 0 0.4rem; }

h3 { font-size: 1.25rem; margin: 0; }

.lede { font-size: 1.15rem; max-width: 40rem; }

.links { display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem; }

.refreshed, .unit-help, .section-head p, .caveat, .source, .when, .omitted, .colophon {
  color: var(--muted);
}

.section-head { margin: 2.2rem 0 1rem; }

.unit-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  padding: 0.55rem 0 0.7rem;
}

.unit-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  background: #2a261f;
  padding: 0.3rem;
  border-radius: 999px;
}

.unit-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
}

.unit-toggle button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 700;
}

.unit-toggle button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.unit-help { margin: 0.7rem 0 0; font-size: 0.95rem; }

.life-grid, .chart-stack {
  display: grid;
  gap: 0.9rem;
}

.card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 0.9rem 0.8rem;
}

.card.is-index { box-shadow: inset 3px 0 0 var(--gold); }

.latest {
  margin: 0.35rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
}

.num {
  font-variant-numeric: tabular-nums;
  font-size: 1.7rem;
  color: var(--ink);
}

.unit, .when, .source, .caveat { font-size: 0.92rem; }

.when { margin: 0.1rem 0 0.4rem; }

.chart-box { position: relative; height: 220px; }

.caveat { margin: 0.55rem 0 0.25rem; }

.source { margin: 0.2rem 0 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  margin: 0.2rem 0 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: -0.05rem;
}

.omitted {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.omitted h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }

.recipe, .source-block {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { color: var(--muted); font-weight: 600; }

.numcell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.error {
  background: #3a2420;
  border: 1px solid var(--danger);
  color: var(--ink);
  padding: 0.8rem 1rem;
  border-radius: 12px;
}

.colophon {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}

.noscript {
  width: min(980px, calc(100% - 1.5rem));
  margin: 1rem auto;
}

@media (min-width: 800px) {
  .life-grid { grid-template-columns: 1fr 1fr; }
  .chart-box { height: 250px; }
  .mast { padding-top: 2.5rem; }
}
