/* Omnilus — instrument-panel over a dark operational map.
   Tokens: ink #0A0D12 / panel / line #273040 / text #E8ECF3 / muted #8C96A8
   Heat ramp (idx 0→100): #33405B → #5C5637 → #9A6224 → #C64E1C → #E82F2F
   Type: Archivo Black (wordmark) · IBM Plex Mono (readouts/data) · IBM Plex Sans (body) */

:root {
  --bg: #0a0d12;
  --panel: rgba(15, 20, 28, 0.94);
  --line: #273040;
  --text: #e8ecf3;
  --muted: #8c96a8;
  --accent: #8fb4d9;
  --hot: #e8704f;
  --calm: #58b98c;
  --nodata: #1a202b;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --display: 'Archivo Black', var(--sans);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }

#map { position: fixed; inset: 0; }
.maplibregl-canvas:focus { outline: none; }

/* ---- top bar ---- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: stretch; gap: 0;
  background: var(--panel); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.wordmark {
  font-family: var(--display); font-size: 20px; letter-spacing: 0.06em;
  color: var(--text); padding: 14px 20px; border-right: 1px solid var(--line);
  text-transform: uppercase;
}
.wordmark a { color: inherit; }
.wordmark a:hover { text-decoration: none; }
.wordmark .tld { color: var(--muted); font-family: var(--mono); font-size: 11px;
  font-weight: 400; letter-spacing: 0.1em; display: block; margin-top: -2px; }

.readouts { display: flex; flex: 1; overflow-x: auto; }
.readout {
  padding: 9px 20px; border-right: 1px solid var(--line);
  font-family: var(--mono); white-space: nowrap;
}
.readout .label { font-size: 10px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.readout .value { font-size: 17px; font-weight: 600; }
.readout .value .unit { font-size: 11px; color: var(--muted); font-weight: 400; }
.up { color: var(--hot); }
.down { color: var(--calm); }

.nav { display: flex; align-items: center; gap: 4px; padding: 0 12px; margin-left: auto; }
.nav a {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); padding: 8px 10px;
}
.nav a:hover, .nav a[aria-current] { color: var(--text); text-decoration: none; }

/* ---- panels ---- */
.panel {
  position: fixed; z-index: 15; background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px;
  backdrop-filter: blur(6px);
}
.panel h2 {
  margin: 0; padding: 10px 14px; font-family: var(--mono); font-size: 11px;
  font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.panel h2 button {
  background: none; border: 0; color: var(--muted); font-family: var(--mono);
  cursor: pointer; font-size: 12px; padding: 0 2px;
}

#stories { top: 72px; left: 16px; width: 340px; max-width: calc(100vw - 32px); }
#stories ol { list-style: none; margin: 0; padding: 6px 0; max-height: 46vh; overflow-y: auto; }
#stories li { padding: 8px 14px; border-bottom: 1px solid rgba(39, 48, 64, 0.5); }
#stories li:last-child { border-bottom: 0; }
#stories a { color: var(--text); font-size: 13.5px; line-height: 1.4; display: block; }
#stories .src { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; }
#stories.collapsed ol { display: none; }

#region { bottom: 40px; left: 16px; width: 360px; max-width: calc(100vw - 32px); display: none; }
#region.open { display: block; }
#region .head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
#region .name { font-size: 17px; font-weight: 600; }
#region .stats { display: flex; gap: 18px; margin-top: 6px; font-family: var(--mono); font-size: 12px; }
#region .stats .k { color: var(--muted); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; display: block; }
#region ul { list-style: none; margin: 0; padding: 6px 0; max-height: 32vh; overflow-y: auto; }
#region li { padding: 7px 14px; border-bottom: 1px solid rgba(39, 48, 64, 0.5); font-size: 13px; }
#region li:last-child { border-bottom: 0; }
#region .meta { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
#region .hint { padding: 10px 14px; font-size: 12.5px; color: var(--muted); }

/* ---- legend / status ---- */
#legend {
  position: fixed; right: 16px; bottom: 40px; z-index: 15;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 10px 14px; font-family: var(--mono); font-size: 10.5px; color: var(--muted);
}
#legend .bar {
  height: 8px; width: 180px; border-radius: 2px; margin: 6px 0 4px;
  background: linear-gradient(90deg, #33405b, #5c5637, #9a6224, #c64e1c, #e82f2f);
}
#legend .ends { display: flex; justify-content: space-between; }
#legend .stamp { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }

/* ---- static pages (brief, methodology) ---- */
.page { max-width: 720px; margin: 0 auto; padding: 96px 24px 80px; }
.page h1 { font-family: var(--display); font-size: 26px; letter-spacing: 0.03em; text-transform: uppercase; }
.page h2 { font-size: 18px; margin-top: 36px; }
.page code { font-family: var(--mono); background: #141a24; padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
.page .kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 760px) {
  .wordmark { padding: 12px 14px; font-size: 16px; }
  .readout { padding: 7px 12px; }
  .readout .value { font-size: 14px; }
  .nav { display: none; }
  #stories { width: calc(100vw - 32px); }
  #stories ol { max-height: 30vh; }
}

@media (prefers-reduced-motion: no-preference) {
  .panel, .topbar { animation: rise 0.4s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
