/* ============================================================
   AaaS Design System — Colors & Type
   Basalt + Circuit. Dark-first, warm-gray light theme.
   Locked tokens (do not hardcode hex; reference CSS vars).
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root,
[data-theme="dark"] {
  /* --- Basalt surfaces (warm gray, never pure white) --- */
  --basalt-deep:    8 8 9; /* @kind color */        /* page bg */
  --basalt-surface: 26 26 28;     /* glass surface */
  --basalt-bright:  42 42 46; /* @kind color */     /* lifted card / hover */

  /* --- BRAND LEADS (the only two colors that ever dominate) ---
     Circuit and Red are co-equal. Use them generously: headings, CTAs,
     active states, hover borders, glow rings, topic labels, status. */
  --circuit-glow:   0 243 255; /* @kind color */         /* the blue/green — primary brand */
  --circuit-dim:    rgba(0, 243, 255, 0.15);
  --circuit-glow-strong: rgba(0, 243, 255, 0.4);
  --accent-red:     244 63 108; /* @kind color */        /* primary brand (co-lead) */
  --accent-red-dim: rgba(244, 63, 108, 0.15);
  --accent-red-glow:rgba(244, 63, 108, 0.4);

  /* --- SUPPORTIVE (contextual use only, never dominant) ---
     Use for: one stat in a strip; one badge variant; a single status pill;
     log-line prefix coloring. Never as a hero, button fill, or section accent. */
  --accent-teal:    0 212 184; /* @kind color */         /* "all-clear" / success only */
  --accent-teal-dim:rgba(0, 212, 184, 0.15);
  --pastel-lavender: 147 154 255; /* @kind color */      /* "learning" / model badge only */
  --pastel-gold:     248 217 116; /* @kind color */      /* "new" / "alert-soft" only */

  /* --- STATUS (semantic, pinned — D189) ---
     Agent/thread state. Never brand: tenant packs override --circuit-glow/--accent-*, status must not move
     with them. Each state also has its own SHAPE (diamond · triangle · check-ring · dot · ring) so colour is
     never the only cue (WCAG 1.4.1); values chosen for ≥3:1 against basalt surfaces (WCAG 1.4.11). */
  --status-needs:   244 63 108; /* @kind color */   /* a human decision blocks it */
  --status-stuck:   248 217 116; /* @kind color */  /* technical: rate limit, error, alert */
  --status-done:    0 212 184; /* @kind color */    /* finished, not yet opened */
  --status-running: 0 243 255; /* @kind color */    /* working */
  --status-idle:    224 224 222; /* @kind color */  /* ready — use at /0.5 */

  /* --- Text --- */
  --text:        224 224 222;
  --text-muted:  rgba(224, 224, 222, 0.5);

  /* --- Fixed ink (theme-invariant) ---
     Ink for FIXED backgrounds that do not flip with the theme — black scrims, video-hairline
     gradients, solid chips that stay put in both themes. The background cannot move, so the
     ink must not: never put a theme-following token (--text, --basalt-deep, --app-ink) on a
     fixed fill. Declared once here, outside every theme override block, by design. */
  --ink-on-scrim: 224 224 222; /* @kind color */ /* light ink on dark fixed fills: rgb(0 0 0 / .5-.6) scrims, #4a1010 video gradients */
  --ink-on-fill:     8 8 9; /* @kind color */    /* dark ink on light fixed fills: pastel-gold chips (light --pastel-gold is tuned FOR dark text — P4.3) */

  /* --- Border / chrome --- */
  --border:      rgba(255, 255, 255, 0.05);
  --grain-opacity: 0.015; /* @kind other */
  --aura-blend:  screen; /* @kind other */

  /* --- Foundation tokens --- */
  --radius:      0.75rem;                                  /* 12px — all surfaces */
  --radius-btn:  0.6rem;                                   /* buttons */
  --liquid-ease: cubic-bezier(0.23, 1, 0.32, 1); /* @kind other */         /* all transitions */

  /* --- Elevation --- */
  --shadow-glass:  inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-hover:  0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px var(--circuit-dim);
  --shadow-menu:   0 12px 40px rgba(0, 0, 0, 0.5);

  /* --- Type families --- */
  --font-inter: "Inter", system-ui, -apple-system, sans-serif;
  --font-jetbrains: "JetBrains Mono", ui-monospace, monospace;

  color-scheme: dark;
}

[data-theme="light"] {
  --basalt-deep:    228 228 224; /* @kind color */ /* warm gray, NEVER #fff */
  --basalt-surface: 218 218 213;
  --basalt-bright:  205 205 198; /* @kind color */
  --circuit-glow:   0 120 145; /* @kind color */
  --circuit-dim:    rgba(0, 120, 145, 0.15);
  --accent-red:     190 42 82; /* @kind color */
  --accent-red-dim: rgba(190, 42, 82, 0.10);
  --accent-red-glow:rgba(190, 42, 82, 0.30);
  --accent-teal:    0 140 120; /* @kind color */
  --accent-teal-dim:rgba(0, 140, 120, 0.12);
  --pastel-lavender:100 106 200; /* @kind color */
  --pastel-gold:    190 155 40; /* @kind color */
  /* status, light: blue vs green kept apart on purpose (cyan/teal were indistinguishable here) */
  --status-needs:   190 42 82; /* @kind color */
  --status-stuck:   150 105 0; /* @kind color */
  --status-done:    0 128 88; /* @kind color */
  --status-running: 0 92 190; /* @kind color */
  --status-idle:    17 17 19; /* @kind color */
  --text:           17 17 19;
  --text-muted:     rgba(17, 17, 19, 0.6);
  --border:         rgba(0, 0, 0, 0.08);
  --grain-opacity:  0.01; /* @kind other */
  --aura-blend:     multiply; /* @kind other */
  color-scheme: light;
}

/* ============================================================
   Base type — body uses sentence case, never uppercase
   ============================================================ */
html, body {
  font-family: var(--font-inter);
  background: rgb(var(--basalt-deep));
  color: rgb(var(--text));
  -webkit-font-smoothing: antialiased;
}

/* H1 baseline — Inter 900, UPPERCASE, tight tracking, trailing period
   (display H1 always carries a trailing period) */
h1, .h1 {
  font-family: var(--font-inter);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  line-height: 0.85;
  font-size: clamp(3rem, 6vw, 5.5rem);
}

/* H2 — display section header */
h2, .h2 {
  font-family: var(--font-inter);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-size: clamp(2rem, 4vw, 3rem);
}

/* H3 — content header, Title Case */
h3, .h3 {
  font-family: var(--font-inter);
  font-weight: 600;
  letter-spacing: normal;
  line-height: 1.2;
  font-size: 1.5rem;
}

/* H4 — content sub-header, Title Case */
h4, .h4 {
  font-family: var(--font-inter);
  font-weight: 600;
  letter-spacing: normal;
  line-height: 1.3;
  font-size: 1.125rem;
}

/* Body */
p, .body {
  font-family: var(--font-inter);
  font-weight: 400;
  line-height: 1.6;
  font-size: 1rem;
}

.body-sm   { font-size: 0.875rem; line-height: 1.55; }
.body-lg   { font-size: 1.125rem; line-height: 1.65; }

/* Mono labels — UPPERCASE, never bold (700+) */
.label-overline {
  font-family: var(--font-jetbrains);
  font-weight: 500;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15rem;
}

.label-nav {
  font-family: var(--font-jetbrains);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.label-system {
  font-family: var(--font-jetbrains);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: normal;
}

/* CTA text — Inter, 700, UPPERCASE */
.cta-text {
  font-family: var(--font-inter);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.03em;
}

/* Code / mono inline */
code, .mono {
  font-family: var(--font-jetbrains);
  font-weight: 400;
  font-size: 0.875em;
}

/* ============================================================
   Semantic tokens (ready-to-use)
   ============================================================ */
.fg-primary   { color: rgb(var(--text)); }
.fg-muted     { color: var(--text-muted); }
.fg-circuit   { color: rgb(var(--circuit-glow)); }
.fg-red       { color: rgb(var(--accent-red)); }
.fg-teal      { color: rgb(var(--accent-teal)); }

.bg-deep      { background: rgb(var(--basalt-deep)); }
.bg-surface   { background: rgb(var(--basalt-surface)); }
.bg-bright    { background: rgb(var(--basalt-bright)); }

/* Glass surface — nav + cards.  rgba(26,26,28 / 0.6) + 24px blur */
.glass {
  background: rgb(var(--basalt-surface) / 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
}

[data-theme="light"] .glass {
  background: rgba(255, 255, 255, 0.50);
  border-color: rgba(0, 0, 0, 0.06);
}

/* Glow utilities */
.glow-circuit { box-shadow: 0 0 24px var(--circuit-dim); }
.glow-red     { box-shadow: 0 0 24px var(--accent-red-dim); }
.text-glow     { text-shadow: 0 0 12px rgb(var(--circuit-glow) / 0.6); }
.text-glow-red { text-shadow: 0 0 12px rgb(var(--accent-red) / 0.6); }

/* Brand-colored selection */
::selection { background: var(--accent-red-dim); color: rgb(var(--text)); }

/* Anti-pattern reminders (do not delete these comments)
   ✗ never uppercase body
   ✗ never bold (700+) on mono labels
   ✗ never gradient-text mix circuit + red
   ✗ buttons on solid blue/cyan must use BLACK text (legibility)
   ✓ display H1 always trailing period
   ✓ all surfaces use --radius (0.75rem)
   ✓ all transitions use --liquid-ease
*/
