:root {
  /* palette: yaga.sh's system re-tinted to navy; amber accent, because red and green belong to the candles */
  --bg: #0C1526;
  --surface: #131E33;
  --ink: #F3F5F9;
  --body: #BFC9D9;
  --muted: #93A1B7;
  --line: #223049;
  --line-strong: #41516E;
  --accent: #E8B04A;
  --up: #2CB7A8;
  --down: #F0705A;
  --volume: #41516E;
  --sans: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-display: clamp(32px, 4.4vw, 56px);
  --fs-lead: clamp(17px, 1.4vw, 19px);
  --fs-label: 12px;
  --gutter: clamp(24px, 4vw, 48px);
  --max: 1200px;
  --header-h: 64px;
  --bar-h: 28px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection { background: var(--accent); color: var(--bg); }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Buttons: square, as on yaga.sh */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

.btn-dark { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 14px; }

@media (hover: hover) {
  .btn-dark:hover { background: var(--accent); }
  .btn-ghost:hover { border-color: var(--ink); }
}

/* yaga.sh family bar: drawn in yaga.sh's own warm dark palette, so it reads as the parent site */

.yaga-bar { background: #161514; border-bottom: 1px solid #2A2826; }

.yaga-bar-inner {
  max-width: calc(var(--max) + 2 * var(--gutter));
  height: var(--bar-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.yaga-bar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--bar-h);
  color: #C4BFB7;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  transition: color 200ms var(--ease-out);
}
.yaga-bar-link strong { color: #F5F4F2; font-weight: 500; }
.yaga-bar-arrow { display: block; width: 12px; height: 12px; flex: none; transition: transform 200ms var(--ease-out); }
.yaga-bar-mark { display: block; width: 16px; height: 16px; flex: none; }

@media (hover: hover) {
  .yaga-bar-link:hover { color: #F5F4F2; }
  .yaga-bar-link:hover .yaga-bar-arrow { transform: translateX(-3px); }
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.site-header-inner {
  max-width: calc(var(--max) + 2 * var(--gutter));
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; color: var(--ink); }
.brand-mark { display: block; width: 36px; height: 36px; flex: none; }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.site-brand { display: flex; align-items: center; }

/* Type */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-bar { width: 24px; height: 2px; background: var(--accent); flex: none; }

h1, h2 {
  font-weight: 500;
  font-size: var(--fs-display);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 12px 0 0 0;
  color: var(--ink);
  max-width: 18ch;
  text-wrap: balance;
}

.accent { color: var(--accent); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--body);
  max-width: 44ch;
  margin: 24px 0 0 0;
  text-wrap: pretty;
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

.note {
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: var(--fs-label);
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* Hero */

.hero-grid {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  min-height: calc(100svh - var(--header-h) - var(--bar-h));
  margin: 0 auto;
  padding: clamp(48px, 6vw, 96px) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}

.hero-copy { min-width: 0; }

.history { margin: 0; min-width: 0; }
.history-link { display: block; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.history-plot { display: block; width: 100%; aspect-ratio: 5 / 4; }
.history-plot svg { display: block; width: 100%; height: 100%; }
.history-plot text { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.history figcaption { margin-top: 12px; font-family: var(--mono); font-size: var(--fs-label); line-height: 1.6; color: var(--muted); }

@media (hover: hover) {
  .history-link { transition: border-color 200ms var(--ease-out); }
  .history-link:hover { border-color: var(--line-strong); }
}

/* Sections */

.section { border-top: 1px solid var(--line); }

.section-inner {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(72px, 9vw, 128px) var(--gutter);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
  margin-top: 48px;
}

.card-grid-tight { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.nowrap { white-space: nowrap; }

.card { display: flex; flex-direction: column; border: 1px solid var(--line); padding: 24px; }
.card h3 { margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
.card p { margin: 8px 0 0; font-size: 15px; line-height: 1.6; color: var(--body); text-wrap: pretty; }
.card .card-kicker {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Dataset */

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 48px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.tile { padding: 24px; border-left: 1px solid var(--line); min-width: 0; }
.tile:first-child { border-left: 0; }
.tile-value { font-size: clamp(32px, 3.6vw, 48px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-label { margin-top: 8px; font-family: var(--mono); font-size: var(--fs-label); letter-spacing: 0.04em; color: var(--muted); }

.facts { margin: 20px 0 0; display: grid; gap: 0; }
.fact { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.fact dt { font-size: 14px; color: var(--muted); }
.fact dd { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.card .card-foot { margin-top: auto; padding-top: 16px; font-size: 14px; }

/* Status */


/* Footer */

.closing h2 { max-width: 22ch; }
.divider { height: 1px; background: var(--line); margin-top: clamp(72px, 9vw, 128px); }

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px 0 32px;
}

.footer-brand { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; }
.footer-mark { display: block; width: 24px; height: 24px; flex: none; }

.copyright {
  font-family: var(--mono);
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  color: var(--muted);
}

.closing-inner { padding-bottom: 0; }

/* Chart page: fills the window, the chart takes what the controls leave */

.chart-page { display: flex; flex-direction: column; height: 100svh; min-height: 560px; }
.chart-page .site-header { position: static; }
.chart-page .site-header-inner { max-width: none; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 12px var(--gutter);
  border-bottom: 1px solid var(--line);
}

.seg { display: inline-flex; flex-wrap: nowrap; }
.seg button {
  min-height: 36px;
  padding: 0 12px;
  margin-left: -1px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--body);
  font-family: var(--mono);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.seg button:first-child { margin-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); position: relative; }

@media (hover: hover) {
  .seg button:not([aria-pressed="true"]):hover { color: var(--ink); background: var(--surface); }
}

.readout {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  align-content: flex-start;
  gap: 2px 16px;
  min-height: 40px;
  padding: 10px var(--gutter);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 20px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.readout .k { color: var(--muted); margin-right: 4px; }
.readout .warn { color: var(--accent); }

.chart-wrap { position: relative; flex: 1; min-height: 0; }
#chart { position: absolute; inset: 0; }

.chart-msg {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--bg);
}
.chart-msg[hidden] { display: none; }

.chart-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 24px;
  padding: 10px var(--gutter);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: var(--fs-label);
  line-height: 1.6;
  color: var(--muted);
}

/* Responsive */

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .tiles { grid-template-columns: minmax(0, 1fr); }
  .tile { border-left: 0; border-top: 1px solid var(--line); }
  .tile:first-child { border-top: 0; }
}

@media (max-width: 600px) {
  .chart-page .brand-name { font-size: 15px; }
  .toolbar { gap: 8px; padding: 8px var(--gutter); }
  .seg button { min-height: 40px; padding: 0 10px; font-size: 12px; }
  .readout { font-size: 12px; min-height: 60px; padding: 6px var(--gutter); gap: 0 12px; line-height: 18px; }
  .chart-foot { padding: 6px var(--gutter); font-size: 11px; }
  #foot-venue { display: none; }
}
