/* ExoCortex dashboard — Ægis visual identity.
 *
 * Tokens lifted from exoreaction/aegis_website so the two read as one family:
 * JetBrains Mono for body, italic Newsreader for display, warm gold on
 * near-black. Fonts are loaded from Google Fonts as the Ægis site does; if that
 * fails the stack degrades to system mono/serif and the page still reads. */

:root {
  --bg:         #0A0B0D;
  --bg-2:       #101115;
  --bg-3:       #16181D;
  --line:       #24262C;
  --line-2:     #1B1D22;
  --fg:         #E8E4DA;
  --fg-mute:    #8A8478;
  --fg-dim:     #4A4842;
  --accent:     #E8B45C;
  --warn:       #D87A5C;
  --good:       #8AB87A;

  --pad-x: clamp(20px, 5vw, 88px);
  --section-pad: clamp(72px, 11vh, 128px);
  --max-w: 1400px;

  --t-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --t-disp: "Newsreader", ui-serif, Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--t-mono);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
em { font-style: italic; color: var(--accent); font-weight: 500; }
.mute { color: var(--fg-mute); }
.dim  { color: var(--fg-dim); }

.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  border-left: 1px solid var(--line-2);
  border-right: 1px solid var(--line-2);
  min-height: 100vh;
}

.brand { letter-spacing: 0.16em; font-weight: 600; }
.brand.small { font-size: 12px; }

.col-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 22px;
}

/* ── masthead ─────────────────────────────────────────────── */

.masthead {
  display: flex; align-items: center; gap: 28px;
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.masthead .brand { font-size: 13px; }

.nav { display: flex; gap: 22px; flex: 1; flex-wrap: wrap; }
.nav a {
  font-size: 12px; letter-spacing: 0.06em; color: var(--fg-dim);
  padding-bottom: 2px; border-bottom: 1px solid transparent;
  transition: color .18s, border-color .18s;
}
.nav a:hover, .nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

.live {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.08em; color: var(--fg-mute);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent);
  animation: breathe 2.8s ease-out infinite;
}
.live.stale .live-dot { background: var(--warn); animation: none; }
@keyframes breathe {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 50%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ── hero ─────────────────────────────────────────────────── */

.hero {
  padding: clamp(56px, 12vh, 128px) 0 var(--section-pad);
  border-bottom: 1px solid var(--line-2);
}

.hero-title {
  font-family: var(--t-disp);
  font-weight: 300;
  font-size: clamp(44px, 9vw, 118px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0;
}

.hero-sub {
  font-family: var(--t-disp);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(19px, 2.6vw, 32px);
  line-height: 1.35;
  color: var(--fg-mute);
  max-width: 46ch;
  margin: 30px 0 0;
}

.hero-figures {
  margin-top: clamp(48px, 8vh, 90px);
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  background: var(--line-2);
  border: 1px solid var(--line-2);
}
.figure { background: var(--bg); padding: 26px 24px 22px; }
.figure-n {
  font-size: clamp(30px, 4.4vw, 54px);
  font-weight: 300;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.figure-k {
  margin-top: 10px; font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-dim);
}

.hero-foot {
  margin-top: 64px; display: flex; align-items: center; gap: 18px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
}
.rule { flex: 1; height: 1px; background: var(--line-2); }
.scroll-cue { color: var(--accent); }

/* ── sections ─────────────────────────────────────────────── */

.section {
  padding: var(--section-pad) 0;
  border-bottom: 1px solid var(--line-2);
  scroll-margin-top: 76px;
}
.section-title {
  font-family: var(--t-disp);
  font-weight: 300;
  font-size: clamp(32px, 5vw, 62px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0;
}
.section-lede {
  font-family: var(--t-disp);
  font-style: italic; font-weight: 300;
  font-size: clamp(17px, 1.9vw, 23px);
  line-height: 1.45;
  color: var(--fg-mute);
  max-width: 58ch;
  margin: 20px 0 52px;
}

/* ── stat grid ────────────────────────────────────────────── */

.stat-grid {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  background: var(--line-2); border: 1px solid var(--line-2);
}
.stat { background: var(--bg); padding: 24px; }
.stat-n {
  font-size: clamp(24px, 3vw, 38px); font-weight: 300;
  letter-spacing: -0.04em; line-height: 1; color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.stat-k {
  margin-top: 9px; font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-dim);
}
.stat-note { margin-top: 8px; font-size: 12px; color: var(--fg-mute); }

/* ── nodes ────────────────────────────────────────────────── */

.nodes { display: grid; gap: 1px; background: var(--line-2);
         border: 1px solid var(--line-2);
         grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.node { background: var(--bg); padding: 26px 24px; }
.node-head { display: flex; align-items: baseline; gap: 10px; }
.node-name {
  font-family: var(--t-disp); font-size: 27px; font-weight: 300;
  letter-spacing: -0.02em;
}
.node-state {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-dim); margin-left: auto;
}
.node.online .node-state { color: var(--good); }
.node-role {
  margin-top: 8px; font-size: 12.5px; color: var(--fg-mute);
  line-height: 1.5; min-height: 2.6em;
}
.node-figs {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-2);
  display: flex; gap: 26px;
}
.node-fig-n {
  font-size: 20px; font-weight: 300; color: var(--accent);
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.node-fig-k {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-dim); margin-top: 3px;
}

/* ── bars ─────────────────────────────────────────────────── */

.split { display: grid; gap: 44px; grid-template-columns: 1fr; }
@media (min-width: 880px) { .split { grid-template-columns: 1.4fr 1fr; } }

.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; }
.bar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-val {
  font-size: 12px; color: var(--fg-mute); font-variant-numeric: tabular-nums;
}
.bar-track { grid-column: 1 / -1; height: 2px; background: var(--line); }
.bar-fill {
  height: 100%; background: var(--accent); width: 0;
  transition: width 1.1s cubic-bezier(.2,.7,.3,1);
}
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }

.aside {
  font-family: var(--t-disp); font-style: italic; font-weight: 300;
  font-size: 18px; line-height: 1.5; color: var(--fg-mute);
  border-left: 1px solid var(--line); padding-left: 24px;
}

/* ── chart ────────────────────────────────────────────────── */

.chart { width: 100%; height: clamp(200px, 32vh, 320px); }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-area { fill: color-mix(in srgb, var(--accent) 13%, transparent); }
.chart-stroke { fill: none; stroke: var(--accent); stroke-width: 1.25; }
.chart-avg {
  fill: none; stroke: var(--fg-mute); stroke-width: 1;
  stroke-dasharray: 3 3; opacity: .85;
}
.chart-base { stroke: var(--line); stroke-width: 1; }

.chart-legend {
  margin-top: 18px; display: flex; gap: 24px; flex-wrap: wrap;
  font-size: 11px; letter-spacing: 0.06em; color: var(--fg-dim);
  align-items: center;
}
.swatch { display: inline-block; width: 14px; height: 2px; margin-right: 8px;
          vertical-align: middle; }
.swatch-area { background: var(--accent); }
.swatch-line { background: var(--fg-mute); }

/* ── footer ───────────────────────────────────────────────── */

.footer { padding: var(--section-pad) 0 60px; }
.disclosure {
  font-size: 12.5px; color: var(--fg-dim); line-height: 1.7;
  max-width: 68ch; border-left: 1px solid var(--line); padding-left: 22px;
  margin: 0 0 44px;
}
.footer-meta {
  display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
  font-size: 11px; letter-spacing: 0.06em; color: var(--fg-dim);
  padding-top: 22px; border-top: 1px solid var(--line-2);
}
.footer-meta .mute:last-child { margin-left: auto; }

.empty { color: var(--fg-dim); font-style: italic; font-family: var(--t-disp); }

/* ── node detail modal ────────────────────────────────────── */

.node { cursor: pointer; transition: background .15s; }
.node:hover { background: var(--bg-2); }
.node.untelemetered .node-fig-n { color: var(--fg-dim); }

.modal { position: fixed; inset: 0; z-index: 100; display: flex;
         align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,11,13,.82);
                  backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; z-index: 1; width: min(620px, 100%);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 34px 34px 30px; max-height: 84vh; overflow-y: auto;
}
.modal-x {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  color: var(--fg-dim); font-size: 24px; line-height: 1; cursor: pointer;
  font-family: var(--t-mono);
}
.modal-x:hover { color: var(--accent); }
.modal-name {
  font-family: var(--t-disp); font-weight: 300; font-size: 40px;
  letter-spacing: -.03em; margin: 0 0 12px;
}
.modal-role {
  font-family: var(--t-disp); font-style: italic; font-weight: 300;
  font-size: 18px; line-height: 1.5; color: var(--fg-mute); margin: 0 0 26px;
}
.modal-figs { display: flex; gap: 34px; flex-wrap: wrap;
              padding: 18px 0; border-top: 1px solid var(--line-2);
              border-bottom: 1px solid var(--line-2); margin-bottom: 22px; }
.modal-fig-n { font-size: 26px; font-weight: 300; color: var(--accent);
               letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.modal-fig-n.none { color: var(--fg-dim); font-size: 15px; font-style: italic;
                    font-family: var(--t-disp); }
.modal-fig-k { font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
               color: var(--fg-dim); margin-top: 4px; }
.modal-stack { font-size: 13px; line-height: 1.7; color: var(--fg-mute); }
