/* ============================================================
   Veda · plan explorer
   Design tokens first; components consume them, never raw values.
   ============================================================ */
:root {
  /* colour — dark, tuned for dense data legibility */
  --bg:            #0b0d12;
  --bg-raise:      #12151d;
  --surface:       #171b25;
  --surface-2:     #1e2330;
  --line:          #2a3140;
  --line-soft:     #212734;

  --text:          #e8ecf4;
  --text-2:        #a8b2c4;
  --text-3:        #6f7c93;

  --accent:        #7c8cff;
  --accent-2:      #a78bfa;
  --accent-ink:    #0b0d12;
  --dense:         #ff7a59;   /* dense attention — warm, reads as "cost" */
  --veda:          #3ddc97;   /* sparse / kept — cool, reads as "signal" */
  --warn:          #ffc857;

  /* tile-shape scale: one hue per shape, ordered by temporal coarseness */
  --shape-0: #4cc9f0;
  --shape-1: #4895ef;
  --shape-2: #4361ee;
  --shape-3: #3f37c9;
  --shape-4: #7209b7;
  --shape-5: #b5179e;

  /* spacing scale (4px base) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  --r1: 6px; --r2: 10px; --r3: 14px; --r4: 20px;

  --shadow-1: 0 1px 2px rgb(0 0 0 / .3);
  --shadow-2: 0 4px 16px -4px rgb(0 0 0 / .45);
  --shadow-3: 0 16px 48px -12px rgb(0 0 0 / .6);

  --t-fast: 120ms;
  --t-base: 220ms;
  --ease: cubic-bezier(.4, 0, .2, 1);

  --wrap: 1180px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fb; --bg-raise: #fff; --surface: #fff; --surface-2: #f0f2f7;
    --line: #d7dce6; --line-soft: #e6eaf1;
    --text: #131722; --text-2: #4a5468; --text-3: #77839a;
    --accent: #4d5bd6; --accent-2: #7c3aed;
    --dense: #e0532a; --veda: #128a5c; --warn: #a9741a;
    --shape-0: #0aa2c7; --shape-1: #1f6fd0; --shape-2: #2c3fd6;
    --shape-3: #4a2ec2; --shape-4: #7b17a8; --shape-5: #ab1885;
    --shadow-1: 0 1px 2px rgb(16 24 40 / .06);
    --shadow-2: 0 4px 16px -4px rgb(16 24 40 / .12);
    --shadow-3: 0 16px 48px -12px rgb(16 24 40 / .18);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s5); }

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

.skip {
  position: absolute; left: -9999px; top: var(--s2); z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: var(--s2) var(--s4); border-radius: var(--r1); font-weight: 600;
}
.skip:focus { left: var(--s2); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r1);
}

/* ---------- hero ---------- */
.hero {
  padding-block: var(--s9) var(--s8);
  border-bottom: 1px solid var(--line-soft);
  background:
    radial-gradient(900px 380px at 15% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(700px 320px at 88% -12%, color-mix(in srgb, var(--veda) 10%, transparent), transparent 70%);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2);
  margin: 0 0 var(--s4);
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em;
  color: var(--text-3);
  border: 1px solid var(--line); border-radius: 999px;
  padding: var(--s1) var(--s3); background: var(--surface);
  max-width: 100%; overflow-wrap: anywhere;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--veda);
  flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--veda) 20%, transparent);
}

h1 {
  margin: 0 0 var(--s4);
  font-size: clamp(32px, 5.5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 680;
  max-width: 18ch;
}

.lede {
  margin: 0; max-width: 62ch;
  font-size: clamp(16px, 1.6vw, 18px); color: var(--text-2);
}

.stats {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: var(--s7);
}
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r3); padding: var(--s4);
  display: flex; flex-direction: column; gap: var(--s1);
  box-shadow: var(--shadow-1);
}
.stat-v {
  font-family: var(--mono); font-size: clamp(22px, 3vw, 28px);
  font-weight: 600; letter-spacing: -.02em; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-l { font-size: 13px; color: var(--text-2); line-height: 1.35; }
.stat-l small { color: var(--text-3); font-size: 11.5px; }

/* ---------- sections ---------- */
main > section, main > aside { margin-block: var(--s9); }

.sec-head { margin-bottom: var(--s5); }
h2 {
  margin: 0 0 var(--s2);
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -.02em; font-weight: 640;
}
h3 { margin: 0; font-size: 16px; font-weight: 620; }
.sec-sub { margin: 0; max-width: 68ch; color: var(--text-2); }
.vs {
  font-family: var(--mono); font-size: .6em; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 .6em;
  vertical-align: middle; margin-inline: var(--s1);
}

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

/* ---------- notice ---------- */
.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  background: var(--surface);
  border-radius: var(--r3);
  padding: var(--s5);
  box-shadow: var(--shadow-1);
}
.notice h2 { font-size: 17px; display: flex; align-items: center; gap: var(--s2); }
.notice h2 span { color: var(--warn); font-size: 15px; }
.notice p { margin: var(--s3) 0 0; color: var(--text-2); max-width: 82ch; }
.notice strong { color: var(--text); font-weight: 620; }

code {
  font-family: var(--mono); font-size: .875em;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  padding: .1em .4em; border-radius: 4px;
  overflow-wrap: anywhere;
}

/* ---------- comparisons ---------- */
.cmp {
  display: grid; gap: var(--s5);
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
}
@media (max-width: 520px) { .cmp { grid-template-columns: 1fr; } }

.pair {
  margin: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r4);
  padding: var(--s4); box-shadow: var(--shadow-2);
}

/* the source composites are 1920x582 — two panels plus a burned-in title bar */
.cmpvid {
  display: block; width: 100%; aspect-ratio: 1920 / 582;
  background: #000; border-radius: var(--r2);
  border: 1px solid var(--line);
}

.pair-cap {
  margin-top: var(--s3); font-size: 13px; color: var(--text-3);
  font-family: var(--mono); line-height: 1.5;
}
.pair-cap b { color: var(--text); font-weight: 600; }
.pair-cap .d { color: var(--dense); }
.pair-cap .v { color: var(--veda); }

.skeleton {
  grid-column: 1 / -1; color: var(--text-3);
  font-family: var(--mono); font-size: 13px;
  padding: var(--s6); text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r3);
}

/* ---------- controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: var(--s4);
  align-items: flex-end; margin-bottom: var(--s4);
}
.ctl { display: flex; flex-direction: column; gap: var(--s2); border: 0; padding: 0; margin: 0; min-width: 0; }
.ctl > label, .ctl > legend {
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3); padding: 0;
}

select {
  appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236f7c93' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right var(--s3) center;
  color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r2); padding: var(--s2) calc(var(--s3) + 18px) var(--s2) var(--s3);
  font-family: var(--mono); font-size: 13.5px; cursor: pointer;
  min-width: 168px; min-height: 38px;
}
select:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

.segbtns { display: flex; gap: var(--s1); background: var(--surface-2); padding: 3px; border-radius: var(--r2); border: 1px solid var(--line); }
.segbtns button {
  appearance: none; border: 0; cursor: pointer;
  background: transparent; color: var(--text-2);
  font-family: var(--mono); font-size: 12.5px;
  padding: var(--s2) var(--s3); border-radius: 7px;
  min-height: 32px; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.segbtns button:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.segbtns button[aria-checked="true"] {
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}

/* ---------- readout ---------- */
.readout {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  margin-bottom: var(--s4);
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--r3); padding: var(--s4);
}
.ro { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ro dt { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.ro dd {
  margin: 0; font-family: var(--mono); font-size: 16px; font-weight: 600;
  color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.ro dd.sm { font-size: 13px; font-weight: 400; color: var(--text-2); }

/* ---------- panels ---------- */
.panel {
  position: relative; margin: 0 0 var(--s5);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r3); padding: var(--s4);
  box-shadow: var(--shadow-2);
}
.panel-cap {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4);
  align-items: baseline; justify-content: space-between;
  margin-bottom: var(--s4);
}
.cap-title { font-size: 13.5px; font-weight: 620; }
.cap-hint { font-size: 12.5px; color: var(--text-3); font-family: var(--mono); }

.plotwrap { position: relative; width: 100%; }
.plotwrap canvas { display: block; width: 100%; height: auto; }
.plotwrap.prof { display: flex; flex-direction: column; gap: var(--s1); }
.profrow { position: relative; }
.profrow canvas { display: block; width: 100%; height: 12px; border-radius: 3px; }

.axis {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  margin-top: var(--s2);
}
.axis.y {
  position: absolute; left: calc(var(--s5) * -1 + 2px); top: 84px; bottom: 64px;
  flex-direction: column; writing-mode: vertical-rl; transform: rotate(180deg);
}
@media (max-width: 700px) { .axis.y { display: none; } }

.legend {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4);
  margin-top: var(--s4); padding-top: var(--s3);
  border-top: 1px solid var(--line-soft);
}
.lg { display: flex; align-items: center; gap: var(--s2); font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.lg i { width: 13px; height: 13px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12); }

.tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--r1); padding: var(--s2) var(--s3);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.45;
  color: var(--text); box-shadow: var(--shadow-3);
  white-space: nowrap;
}
.tip b { color: var(--text); }

.stack { display: flex; flex-direction: column; gap: var(--s3); }
.profkey { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.profkey li { display: flex; align-items: center; gap: var(--s2); font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.profkey i { width: 13px; height: 13px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12); }

/* ---------- facts ---------- */
.facts { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.fact { display: flex; flex-direction: column; gap: var(--s1); }
.fact dt { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.fact dd { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.fact dd b { color: var(--text); }

/* ---------- howto ---------- */
.howto { padding: 0; }
.howto summary {
  cursor: pointer; padding: var(--s4); list-style: none;
  display: flex; align-items: center; gap: var(--s2);
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after {
  content: "+"; margin-left: auto; font-family: var(--mono);
  font-size: 18px; color: var(--text-3); transition: transform var(--t-base) var(--ease);
}
.howto[open] summary::after { transform: rotate(45deg); }
.howto summary:hover { color: var(--accent-2); }
.howto-body { padding: 0 var(--s4) var(--s4); border-top: 1px solid var(--line-soft); padding-top: var(--s4); }
.howto-body p { margin: 0 0 var(--s3); color: var(--text-2); max-width: 82ch; font-size: 14.5px; }
.howto-body p:last-child { margin-bottom: 0; }
.howto-body .warn {
  border-left: 3px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 7%, transparent);
  padding: var(--s3) var(--s4); border-radius: 0 var(--r2) var(--r2) 0;
}
.howto-body strong { color: var(--text); }

/* ---------- table ---------- */
.tablewrap {
  overflow-x: auto; border: 1px solid var(--line);
  border-radius: var(--r3); background: var(--surface);
  box-shadow: var(--shadow-1); -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: 14px; }
caption { text-align: left; }
th, td { padding: var(--s3) var(--s4); text-align: left; border-bottom: 1px solid var(--line-soft); }
thead th {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600; background: var(--surface-2);
  white-space: nowrap;
}
tbody th { font-weight: 600; color: var(--text); }
tbody td { font-family: var(--mono); color: var(--text-2); font-variant-numeric: tabular-nums; }
tbody td strong { color: var(--veda); font-weight: 700; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* ---------- links ---------- */
.links {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  display: flex; flex-direction: column; gap: var(--s1);
  padding: var(--s4); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r3); box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.card:hover {
  transform: translateY(-2px); color: inherit;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow-2);
}
.card-k { font-weight: 620; color: var(--text); font-size: 15px; }
.card:hover .card-k { color: var(--accent); }
.card-d { font-size: 13px; color: var(--text-2); }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line-soft); margin-top: var(--s9);
  padding-block: var(--s6) var(--s8);
  background: var(--bg-raise);
}
.foot p { margin: 0; font-size: 12.5px; color: var(--text-3); max-width: 80ch; }