/**
 * assets/css/base.css
 * Purpose: CSS custom properties (design tokens), reset, typography, focus rings.
 * All other CSS files import from this foundation — edit tokens here only.
 * Last modified: 2026-04-11
 */

/* ─── Design tokens ────────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:        #0a0e1a;
  --bg-elev-1: #111726;
  --bg-elev-2: #1a2238;
  --bg-glass:  rgba(26, 34, 56, 0.6);

  /* Borders */
  --border:        #243049;
  --border-strong: #334670;

  /* Text */
  --text:       #e8ecf5;
  --text-dim:   #9aa6c2;
  --text-faint: #6b7799;

  /* Accents */
  --accent:       #4f8cff;
  --accent-hover: #6ba0ff;
  --accent-glow:  rgba(79, 140, 255, 0.4);
  --accent-2:     #b67dff;
  --accent-3:     #2dd4bf;

  /* States */
  --success: #34d399;
  --warn:    #fbbf24;
  --danger:  #f87171;

  /* Radii */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-1:    0 4px 24px -8px rgba(0, 0, 0, 0.5);
  --shadow-2:    0 12px 48px -16px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 60px -10px var(--accent-glow);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Typography */
  --font-sans:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:   ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-arabic: "Segoe UI", Tahoma, "Geeza Pro", "Arabic Typesetting", sans-serif;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-base: 250ms ease;
  --t-slow: 400ms ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

/* ─── Typography ───────────────────────────────────────────────────────────── */
h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

p {
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

/* ─── Utility classes ──────────────────────────────────────────────────────── */
.text-dim   { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.mono       { font-family: var(--font-mono); }
.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;
}

/* ─── Focus rings ──────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}
.badge-ok   { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.badge-warn { background: rgba(251, 191, 36, 0.15);  color: var(--warn); }
.badge-err  { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.badge-info { background: rgba(79, 140, 255, 0.15);  color: var(--accent); }

/* ─── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .orb { animation: none !important; }
}
