/* base.css — BLACKBOX design system.
   Art direction: avionics MFD. Deep instrument-panel charcoal, phosphor green for
   live data, amber for caution, a single desaturated blue for reference. Technical
   monospace for every number, a tight grotesk for every word. Nothing decorative. */

:root {
  /* ---- type */
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-sans: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --text-xs: 0.6875rem;   /* 11 */
  --text-sm: 0.8125rem;   /* 13 */
  --text-base: 0.9375rem; /* 15 */
  --text-md: 1.0625rem;   /* 17 */
  --text-lg: 1.375rem;    /* 22 */
  --text-xl: 1.875rem;    /* 30 */
  --text-2xl: 2.625rem;   /* 42 */
  --text-3xl: clamp(2.75rem, 6vw, 4.75rem);

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

  --r-sm: 4px; --r: 7px; --r-lg: 12px; --r-xl: 18px;

  /* ---- signal colours, constant across themes so instruments never change meaning */
  --phos: #3ddc84;
  --phos-dim: #1f7a4a;
  --amber: #ffb020;
  --amber-dim: #8a5f10;
  --crit: #ff4d4d;
  --info: #5ac8fa;
  --violet: #c792ea;

  --dur-fast: 120ms;
  --dur: 220ms;
  --dur-slow: 420ms;
  --ease: cubic-bezier(0.22, 0.68, 0.24, 1);
}

/* ---------------------------------------------------------------- dark: the default */
:root[data-theme="dark"] {
  --bg: #07080a;
  --bg-1: #0b0d10;
  --bg-2: #101318;
  --bg-3: #171b21;
  --bg-4: #1f242c;
  --line: #23282f;
  --line-2: #2e343d;
  --ink: #e9edf1;
  --ink-2: #a4b0bc;
  --ink-3: #6b7885;
  --ink-4: #47525d;
  --panel-grad: linear-gradient(180deg, #12161b 0%, #0c0f13 100%);
  --shadow: 0 1px 0 rgba(255,255,255,.04), 0 12px 32px rgba(0,0,0,.55);
  --shadow-lg: 0 1px 0 rgba(255,255,255,.05), 0 32px 72px rgba(0,0,0,.7);
  --glass: rgba(11,13,16,.82);
}

/* ---------------------------------------------------------------- light: a paper chart */
:root[data-theme="light"] {
  --bg: #f4f2ed;
  --bg-1: #ffffff;
  --bg-2: #eeece6;
  --bg-3: #e5e2da;
  --bg-4: #d9d5cb;
  --line: #d4d0c6;
  --line-2: #bfbab0;
  --ink: #14181c;
  --ink-2: #454e57;
  --ink-3: #6c757e;
  --ink-4: #949ba2;
  --phos: #0f8b4c;
  --phos-dim: #a8ddc0;
  --amber: #a86a00;
  --amber-dim: #e8cf9e;
  --crit: #c62828;
  --info: #0b6f9d;
  --violet: #6c3fa8;
  --panel-grad: linear-gradient(180deg, #ffffff 0%, #f0eee8 100%);
  --shadow: 0 1px 0 rgba(255,255,255,.7), 0 8px 24px rgba(30,26,18,.10);
  --shadow-lg: 0 1px 0 rgba(255,255,255,.8), 0 28px 60px rgba(30,26,18,.16);
  --glass: rgba(255,255,255,.86);
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
h1 { font-size: var(--text-3xl); font-weight: 900; letter-spacing: -0.035em; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-md); }
code, kbd, .num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { color: inherit; }
::selection { background: var(--phos); color: #04120a; }

:focus-visible {
  outline: 2px solid var(--phos);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* thin, dark scrollbars that do not break the panel illusion */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- primitives */
.btn {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 9px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--bg-3);
  color: var(--ink);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-4); border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--phos);
  border-color: var(--phos);
  color: #04120a;
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--bg-2); }
.btn.sm { padding: 6px 11px; font-size: var(--text-xs); }
.btn:disabled { opacity: .38; cursor: not-allowed; }

kbd {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; min-width: 22px; text-align: center;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  background: var(--bg-3);
  color: var(--ink-2);
}

.x {
  width: 30px; height: 30px; border-radius: var(--r);
  font-size: 20px; line-height: 1; color: var(--ink-3);
  display: grid; place-items: center;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.x:hover { color: var(--ink); background: var(--bg-3); }

/* label / value micro-typography used everywhere */
.k, .tape-label, .eyebrow, .tier-head h2 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------- logo tokens
   The mark's sky and ground invert with the theme so it never becomes a dark
   box on dark paper. The horizon and the aircraft datum stay phosphor and amber
   in both, because they are signal colours and signal colours never move. */
:root[data-theme="dark"]  { --logo-sky: #0e1216; --logo-ground: #2b333b; --logo-frame: #454f59; }
:root[data-theme="light"] { --logo-sky: #ffffff; --logo-ground: #cfc9bd; --logo-frame: #a9a29a; }
