/* base.css — reset, design tokens, type, buttons, spinner.
   First slice of the cascade; index.html links the rest in order. */

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

:root {
  color-scheme: light;

  /* Surfaces: page -> card -> inset, one step apart so every card reads. */
  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #ebebf0;

  --label:   #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #a1a1a6;

  /* FieldSense green — chrome only (nav, focus, toggles). Never a data color. */
  --accent:       #1f9d55;
  --accent-hover: #188a4a;
  --accent-light: rgba(31, 157, 85, 0.12);

  /* Data colors. Validated as a pair (dataviz validate_palette.js): lightness
     band, chroma, CVD separation, contrast — light and dark each their own step. */
  --run:        #d97706;
  --run-soft:   rgba(217, 119, 6, 0.13);
  --pass:       #0a84ff;
  --pass-soft:  rgba(10, 132, 255, 0.12);

  --red:        #d70015;
  --red-light:  rgba(215, 0, 21, 0.10);

  --border:   rgba(0, 0, 0, 0.08);
  --border-2: rgba(0, 0, 0, 0.05);
  --grid:     rgba(0, 0, 0, 0.07);

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px; --r-full: 980px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.11);

  --nav-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #000000;
  --surface:   #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;

  --label:   #f5f5f7;
  --label-2: #a1a1a6;
  --label-3: #6e6e73;

  --accent:       #30d158;
  --accent-hover: #28b84c;
  --accent-light: rgba(48, 209, 88, 0.16);

  --run:        #cc7a00;
  --run-soft:   rgba(204, 122, 0, 0.22);
  --pass:       #2f8ae8;
  --pass-soft:  rgba(47, 138, 232, 0.22);

  --red:        #ff453a;
  --red-light:  rgba(255, 69, 58, 0.16);

  --border:   rgba(255, 255, 255, 0.10);
  --border-2: rgba(255, 255, 255, 0.07);
  --grid:     rgba(255, 255, 255, 0.09);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
}

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

@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background-color 0.4s ease, color 0.3s ease;
}
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ── Splash / spinner ──────────────────────────────────────────────── */
.splash { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--r-full); border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
:root[data-theme="dark"] .btn--primary { color: #04210f; }
.btn--ghost { background: none; color: var(--label-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--label); }
.btn--full { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: none; border: none; color: var(--label-2); cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-2); color: var(--label); }

/* ── Cards: background step + border + shadow, always all three ─────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--label-2);
}
.muted { color: var(--label-2); }
.num { font-variant-numeric: tabular-nums; }

.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--red-light); color: var(--red); font-size: 14px; font-weight: 500;
}
