/* The Price of Intelligence — styles
   Palette: validated reference dataviz palette (light + dark selected).
   Theme is set on <html data-theme="…"> by a blocking script before paint,
   so there is no flash; both themes are fully specified. */

:root[data-theme="light"] {
  color-scheme: light;
  --page:           #f9f9f7;
  --surface:        #fcfcfb;
  --ink:            #0b0b0b;
  --ink-2:          #52514e;
  --ink-muted:      #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --shadow:         0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.04);

  --human:          #2a78d6;   /* categorical slot 1 — Human, everywhere */
  --ai:             #1baf7a;   /* categorical slot 2 — AI, everywhere    */
  --layer-fuel:     #eda100;   /* slot 3 — fuel/energy layer             */
  --layer-training: #4a3aa7;   /* slot 5 — training layer                */
  --layer-other:    #c3c2b7;   /* neutral — "everything else"            */
  --hist-a:         #4a3aa7;   /* history: frontier flagship             */
  --hist-b:         #eda100;   /* history: GPT-4-class capability        */

  --human-wash:     rgba(42, 120, 214, 0.08);
  --ai-wash:        rgba(27, 175, 122, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #0d0d0d;
  --surface:        #1a1a19;
  --ink:            #ffffff;
  --ink-2:          #c3c2b7;
  --ink-muted:      #898781;
  --grid:           #2c2c2a;
  --baseline:       #383835;
  --border:         rgba(255, 255, 255, 0.10);
  --shadow:         0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);

  --human:          #3987e5;
  --ai:             #199e70;
  --layer-fuel:     #c98500;
  --layer-training: #9085e9;
  --layer-other:    #52514e;
  --hist-a:         #9085e9;
  --hist-b:         #c98500;

  --human-wash:     rgba(57, 135, 229, 0.12);
  --ai-wash:        rgba(25, 158, 112, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 24px; }

a { color: var(--human); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top nav ---------- */

nav.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: blur(10px);
}
nav.top .wrap {
  display: flex; align-items: center; gap: 14px;
  padding-top: 14px; padding-bottom: 14px;
}
nav.top .brand { font-weight: 650; letter-spacing: -0.01em; color: var(--ink); font-size: 15px; }
nav.top .spacer { flex: 1; }
nav.top a.navlink { color: var(--ink-2); font-size: 14px; }
nav.top a.navlink:hover { color: var(--ink); text-decoration: none; }

.snapshot-select {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-muted);
}
.snapshot-select select {
  font-family: inherit; font-size: 13px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}

.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  font-size: 15px; line-height: 1; display: grid; place-items: center;
}
.theme-toggle:hover { background: var(--human-wash); }

/* ---------- Hero ---------- */

header.hero { padding: 72px 0 56px; text-align: center; }
.hero .lead-line {
  max-width: 560px; margin: 0 auto 22px;
  font-size: clamp(16px, 2.2vw, 20px); color: var(--ink-2);
  font-weight: 500; letter-spacing: -0.005em; line-height: 1.5;
}
.hero .lead-line strong { color: var(--ink); font-weight: 650; }
.hero h1 { font-size: clamp(34px, 5.5vw, 56px); line-height: 1.08; letter-spacing: -0.02em; }
.hero .kicker {
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-muted); margin-top: 14px;
}
.hero .sub {
  max-width: 620px; margin: 18px auto 0; color: var(--ink-2);
  font-size: clamp(15px, 2vw, 18px);
}
.hero-figure { margin-top: 44px; }
.hero-figure .big {
  font-size: clamp(56px, 9vw, 104px); font-weight: 650; letter-spacing: -0.03em;
  line-height: 1;
}
.hero-figure .caption { margin-top: 10px; color: var(--ink-2); font-size: 15px; }
.hero-figure .caption strong { color: var(--ink); }

/* ---------- Sections (whitespace does the separating — no rules) ---------- */

section { padding: 72px 0 8px; }
.section-head { max-width: 640px; margin-bottom: 32px; }
.section-head .num {
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 8px;
}
.section-head h2 { font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -0.015em; line-height: 1.15; }
.section-head p { margin-top: 10px; color: var(--ink-2); }

/* ---------- Filter row (task chips + model select) ---------- */

.filter-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 24px;
}
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: background 0.12s, color 0.12s;
}
.chip:hover { background: var(--human-wash); }
.chip.active { background: var(--ink); color: var(--page); border-color: var(--ink); }
.filter-row .spacer { flex: 1; }
.model-select {
  display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2);
}
.model-select select {
  font-family: inherit; font-size: 14px; padding: 7px 10px; max-width: 340px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}

/* ---------- Confidence badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--ink-2); background: var(--page);
  white-space: nowrap;
}
.badge .glyph { font-weight: 700; }
.badge.confirmed .glyph { color: var(--ai); }
.badge.reported .glyph { color: var(--layer-fuel); }
.badge.estimated { border-style: dashed; }
.badge.estimated .glyph { color: var(--ink-muted); }
.badge.unavailable { border-style: dashed; color: var(--ink-muted); }

.conf-legend {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px;
  font-size: 12.5px; color: var(--ink-muted);
}

/* ---------- Worker cards ---------- */

.ledger-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.worker-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 26px 26px 22px; position: relative; overflow: hidden;
}
.worker-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
}
.worker-card.human::before { background: var(--human); }
.worker-card.ai::before    { background: var(--ai); }

.worker-card .who {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted);
}
.worker-card .who .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.worker-card.human .who .dot { background: var(--human); }
.worker-card.ai .who .dot    { background: var(--ai); }
.worker-card .who .badge { text-transform: none; letter-spacing: 0; margin-left: auto; }

.worker-card .price {
  font-size: clamp(36px, 5vw, 52px); font-weight: 650; letter-spacing: -0.02em;
  margin-top: 10px; line-height: 1;
}
.worker-card .price.na { color: var(--ink-muted); }
.worker-card .price-note { color: var(--ink-2); font-size: 13.5px; margin-top: 8px; min-height: 2.6em; }

.worker-card .meta { display: flex; gap: 24px; margin-top: 20px; }
.worker-card .meta div { font-size: 14px; }
.worker-card .meta .label { color: var(--ink-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.worker-card .meta .val { font-weight: 600; margin-top: 2px; }

/* Composition bar — what's inside the price */
.comp { margin-top: 22px; }
.comp .comp-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); margin-bottom: 8px; }
.comp-bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--page); }
.comp-bar span { display: block; height: 100%; min-width: 1px; }
.comp-bar .seg-fuel     { background: var(--layer-fuel); }
.comp-bar .seg-training { background: var(--layer-training); }
.comp-bar .seg-other    { background: var(--layer-other); }
.comp-legend { margin-top: 10px; display: grid; gap: 5px; }
.comp-legend .row { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.comp-legend .swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; align-self: center; }
.comp-legend .k { color: var(--ink-2); }
.comp-legend .v { margin-left: auto; font-weight: 600; white-space: nowrap; }
.comp-legend .pct { color: var(--ink-muted); font-size: 12.5px; width: 5.2em; text-align: right; }

/* Ratio tiles */
.ratio-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.stat-tile {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 20px 24px;
}
.stat-tile .label { font-size: 13.5px; color: var(--ink-2); }
.stat-tile .value { font-size: clamp(28px, 4vw, 40px); font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; }
.stat-tile .value.na { color: var(--ink-muted); }
.stat-tile .sub { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }

.parity-note {
  margin-top: 20px; padding: 14px 18px;
  border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
  color: var(--ink-2); font-size: 13.5px;
}

/* ---------- Charts ---------- */

.chart-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 24px 26px;
}
.chart-card + .chart-card { margin-top: 20px; }
.chart-card h3 { font-size: 17px; letter-spacing: -0.01em; }
.chart-card .chart-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; margin-bottom: 16px; }
.chart-card svg { width: 100%; height: auto; display: block; }

.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; font-size: 13.5px; color: var(--ink-2); }
.legend .item { display: flex; align-items: center; gap: 7px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 50%; }
.legend .swatch.hollow { background: transparent !important; border: 2px solid var(--ink-muted); width: 8px; height: 8px; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 50;
  background: var(--ink); color: var(--page);
  font-size: 12.5px; line-height: 1.45; padding: 8px 11px; border-radius: 8px;
  max-width: 280px; opacity: 0; transition: opacity 0.1s;
}
.tooltip.show { opacity: 1; }

/* ---------- Training section ---------- */

.train-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.train-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 26px;
}
.train-card .who { font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); display: flex; align-items: center; gap: 8px; }
.train-card .who .dot { width: 10px; height: 10px; border-radius: 50%; }
.train-card .big { font-size: clamp(30px, 4.4vw, 44px); font-weight: 650; letter-spacing: -0.02em; margin-top: 10px; }
.train-card .desc { color: var(--ink-2); font-size: 14px; margin-top: 8px; }
.train-card dl { margin-top: 20px; display: grid; gap: 8px; }
.train-card dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.train-card dt { color: var(--ink-2); }
.train-card dd { font-weight: 600; text-align: right; }

.punchline {
  margin-top: 20px; padding: 22px 26px; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow);
  font-size: 15.5px; color: var(--ink-2);
}
.punchline strong { color: var(--ink); }

/* ---------- Methodology ---------- */

.method-block { max-width: 760px; }
.method-block h3 { font-size: 18px; margin-top: 32px; margin-bottom: 8px; }
.method-block p, .method-block li { color: var(--ink-2); font-size: 15px; }
.method-block ul, .method-block ol { padding-left: 22px; margin-top: 8px; display: grid; gap: 7px; }
.method-block li strong { color: var(--ink); }

table.data-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.table-scroll {
  overflow-x: auto; margin-top: 14px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow); padding: 6px 14px 10px;
}
.data-table th, .data-table td {
  text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th {
  color: var(--ink-muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.data-table td:first-child { font-weight: 600; }

.sources-list { margin-top: 14px; display: grid; gap: 8px; padding-left: 22px; }
.sources-list li { font-size: 14px; color: var(--ink-2); }
.verified-note { margin-top: 14px; font-size: 13px; color: var(--ink-muted); }

/* ---------- Live page ---------- */

.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

.live-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 24px 26px;
}
.live-card h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-card .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }
.live-card .rows { margin-top: 18px; display: grid; gap: 12px; }
.live-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14.5px; }
.live-row .k { color: var(--ink-2); }
.live-row .v { font-weight: 650; text-align: right; }
.live-big { font-size: clamp(30px, 4.5vw, 44px); font-weight: 650; letter-spacing: -0.02em; margin-top: 12px; }
.live-note { margin-top: 14px; font-size: 12.5px; color: var(--ink-muted); }

.meter { margin-top: 8px; }
.meter .track { height: 12px; border-radius: 6px; background: var(--human-wash); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 6px; background: var(--human); min-width: 2px; transition: width 0.4s; }
.meter .meter-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-muted); margin-top: 5px; }

.custom-rate { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.custom-rate input {
  width: 100px; font-family: inherit; font-size: 14px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink);
}

select.mini {
  font-family: inherit; font-size: 13px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}

/* ---------- Footer ---------- */

footer { padding: 72px 0 64px; }
footer p { color: var(--ink-muted); font-size: 13.5px; max-width: 720px; }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .ledger-grid, .ratio-row, .train-grid, .live-grid { grid-template-columns: 1fr; }
  header.hero { padding: 48px 0 40px; }
  section { padding: 52px 0 8px; }
  .filter-row .spacer { flex-basis: 100%; }
  nav.top .wrap { flex-wrap: wrap; row-gap: 8px; }
}
