/* ============================================================
   base.css — Reset, ambient atmosphere, typography
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  /* Deep void with two atmospheric light bleeds — one cyan
     bleeding from upper-left (the "operator console glow"),
     one warm violet bleeding from lower-right. */
  background:
    radial-gradient(ellipse 1400px 900px at 8% -12%, rgba(94, 233, 255, 0.10), transparent 55%),
    radial-gradient(ellipse 1200px 800px at 96% 108%, rgba(183, 148, 255, 0.06), transparent 60%),
    linear-gradient(180deg, var(--bg0) 0%, var(--void) 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: 0.005em;
  font-feature-settings: 'cv11', 'ss03';
}

/* ── Atmospheric layer 1 — hex/grid mesh that slowly drifts ─ */
body::before {
  content: '';
  position: fixed;
  inset: -2px;
  background:
    linear-gradient(rgba(148, 175, 220, 0.030) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(148, 175, 220, 0.030) 1px, transparent 1px) 0 0 / 64px 64px,
    /* Half-step finer grid for depth */
    linear-gradient(rgba(94, 233, 255, 0.015) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(94, 233, 255, 0.015) 1px, transparent 1px) 0 0 / 16px 16px;
  -webkit-mask-image: radial-gradient(ellipse 120% 80% at 50% -10%, #000 0%, transparent 90%);
          mask-image: radial-gradient(ellipse 120% 80% at 50% -10%, #000 0%, transparent 90%);
  animation: mesh-drift 60s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes mesh-drift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(64px, 64px); }
}

/* ── Atmospheric layer 2 — film grain via SVG noise ─────────
   Adds tactile texture; very low opacity so it reads as
   "depth" rather than visible noise. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.4'/></svg>");
  opacity: 0.06;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
}

/* ── Typography helpers ─────────────────────────────────────── */
.font-display { font-family: var(--font-display); letter-spacing: 0.04em; }
.font-mono    { font-family: var(--font-mono); }
.font-sans    { font-family: var(--font-sans); }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md   { font-size: var(--text-md); }
.text-lg   { font-size: var(--text-lg); }

.text-cyan   { color: var(--cyan); }
.text-violet { color: var(--violet); }
.text-green  { color: var(--green); }
.text-amber  { color: var(--amber); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue); }
.text-muted  { color: var(--text2); }
.text-dim    { color: var(--text3); }

.tracking-wide  { letter-spacing: 0.08em; }
.tracking-wider { letter-spacing: 0.14em; }
.tracking-max   { letter-spacing: 0.22em; }
.uppercase      { text-transform: uppercase; }

/* Glowing data text — used on key metric values */
.glow-cyan  { color: var(--cyan);  text-shadow: 0 0 14px var(--cyan-glow), 0 0 4px var(--cyan-shadow); }
.glow-green { color: var(--green); text-shadow: 0 0 14px var(--green-glow); }
.glow-amber { color: var(--amber); text-shadow: 0 0 14px var(--amber-glow); }
.glow-red   { color: var(--red);   text-shadow: 0 0 14px var(--red-glow); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: var(--text);
}

code, kbd, samp, pre, .mono {
  font-family: var(--font-mono);
  font-feature-settings: 'ss01', 'tnum', 'zero';
}

/* ── Link reset ─────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--cyan); }

/* ── Button reset ───────────────────────────────────────────── */
button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* ── Scrollbar — refined glass ──────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.25); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--border3), var(--border2));
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--cyan-glow), var(--border3));
  background-clip: padding-box;
}
* { scrollbar-color: var(--border3) transparent; scrollbar-width: thin; }

/* ── Selection ──────────────────────────────────────────────── */
::selection {
  background: var(--cyan-glow);
  color: var(--cyan-bright);
  text-shadow: 0 0 8px var(--cyan-shadow);
}

/* ── Focus ring (accessibility) ─────────────────────────────── */
:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 3px;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 4px var(--cyan-dim);
}

/* ── Utility ────────────────────────────────────────────────── */
.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;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
