/*
 * Quark — Canonical Design System
 * ===============================================================
 * SINGLE SOURCE OF TRUTH for the public site AND the terminal UI.
 * Every Quark surface includes this BEFORE its own styles:
 *
 *     <link rel="stylesheet" href="/css/design-tokens.css">
 *
 * 2026-06-02 redesign: unifies the previously-split palettes
 * (shared purple #7f3ff5, landing maroon #6b2150, terminal purple/gold)
 * onto one refined brand system, and adds a full type/space/motion
 * scale + reusable component classes. Legacy variable names are kept
 * as aliases so existing pages keep rendering while they migrate.
 *
 * Positioning note (copy, not CSS): this is a disciplined, regime-aware
 * RISK-MANAGED systematic research surface. No proprietary method names,
 * no thresholds, no simulated-trading label — see the public-comms rules.
 */

:root {
  /* ─────────── Brand ─────────── */
  /* Refined maroon → magenta. Distinctive + premium (not generic tech-purple). */
  --brand-900: #2a0c20;
  --brand-700: #4d1639;
  --brand-600: #6b2150;
  --brand-500: #8a2d68;
  --brand-400: #9b3a6e;
  --brand-300: #c25c92;
  --brand-200: #e08bb8;
  --brand: var(--brand-600);
  --brand-bright: var(--brand-400);
  --gradient-brand: linear-gradient(135deg, #6b2150 0%, #9b3a6e 100%);
  --gradient-brand-soft: linear-gradient(135deg, rgba(107,33,80,.18), rgba(155,58,110,.10));
  --gradient-hero: radial-gradient(1200px 600px at 70% -10%, rgba(155,58,110,.18), transparent 60%),
                   linear-gradient(180deg, #0a0a0f 0%, #120a12 55%, #0a0a0f 100%);

  /* ─────────── Surfaces (dark, layered) ─────────── */
  --bg: #0a0a0f;
  --bg-1: #0c0c12;
  --bg-2: #0e0e14;
  --bg-3: #12121a;
  --bg-card: #101018;
  --bg-card-hover: #15151f;
  --bg-elevated: #181820;
  --bg-input: #0d0d13;

  /* ─────────── Borders ─────────── */
  --border: #1e1e2a;
  --border-2: #2a2a3a;
  --border-subtle: #16161f;
  --border-brand: rgba(155, 58, 110, 0.35);

  /* ─────────── Text ─────────── */
  --text: #c8ccd4;
  --bright: #e9ebf1;
  --text-secondary: #8e94a2;
  --dim: #888e9a;
  --vdim: #545a6e;

  /* ─────────── Status ─────────── */
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.14);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.14);
  --blue: #60a5fa;

  /* ─────────── Typography ─────────── */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', 'Menlo', monospace;
  /* Modular scale (1.250) */
  --fs-display: clamp(2.6rem, 5.2vw, 4.2rem);
  --fs-h1: clamp(2rem, 3.6vw, 3rem);
  --fs-h2: clamp(1.5rem, 2.4vw, 2rem);
  --fs-h3: 1.35rem;
  --fs-lg: 1.125rem;
  --fs-base: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.78rem;
  --fs-2xs: 0.7rem;
  --lh-tight: 1.15;
  --lh-snug: 1.35;
  --lh-base: 1.6;
  --tracking-tight: -0.02em;
  --tracking-wide: 0.04em;
  --tracking-caps: 0.12em;

  /* ─────────── Spacing (4px base) ─────────── */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 24px;  --sp-6: 32px;  --sp-7: 48px;  --sp-8: 64px;
  --sp-9: 96px;  --sp-10: 128px;

  /* ─────────── Radii / shadows / motion ─────────── */
  --r-sm: 6px;  --r-md: 10px;  --r-lg: 16px;  --r-xl: 24px;  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 6px 20px rgba(0,0,0,.35);
  --shadow-3: 0 18px 50px rgba(0,0,0,.45);
  --glow-brand: 0 0 0 1px var(--border-brand), 0 8px 40px rgba(155,58,110,.18);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 0.15s;  --dur-2: 0.3s;  --dur-3: 0.6s;  --dur-4: 0.9s;
  --container: 1200px;

  /* ─────────── Legacy aliases (do not remove — older pages reference these) ─────────── */
  --bg-primary: var(--bg);
  --bg-secondary: var(--bg-2);
  --accent: var(--brand);
  --accent-2: var(--brand-bright);
  --accent-primary: var(--brand-600);
  --accent-secondary: var(--brand-400);
  --accent-purple: var(--brand-bright);   /* terminal used purple; map to brand */
  --accent-gold: var(--amber);
  --accent-green: var(--green);
  --accent-red: var(--red);
  --text-primary: var(--text);
  --text-bright: var(--bright);
  --text-dim: var(--dim);
  --gradient-accent: var(--gradient-brand);
  --font-mono: var(--mono);
  --font-sans: var(--sans);
}

/* ═══════════ Reusable components (opt-in classes) ═══════════ */

/* Container */
.qk-container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--sp-5); }

/* Buttons */
.qk-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--sans); font-size: var(--fs-sm); font-weight: 600;
  padding: 10px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1; white-space: nowrap;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease),
              background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.qk-btn:active { transform: translateY(1px); }
.qk-btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: var(--shadow-2); }
.qk-btn-primary:hover { box-shadow: var(--glow-brand); transform: translateY(-1px); }
.qk-btn-secondary { background: var(--bg-3); color: var(--bright); border-color: var(--border-2); }
.qk-btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-brand); }
.qk-btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.qk-btn-ghost:hover { color: var(--bright); border-color: var(--border-brand); }

/* Cards */
.qk-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
}
.qk-card:hover { border-color: var(--border-brand); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.qk-card-flush { padding: 0; overflow: hidden; }

/* Eyebrow / section label */
.qk-eyebrow {
  font-family: var(--mono); font-size: var(--fs-2xs); font-weight: 600;
  letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--brand-bright);
}

/* Badges + status pills (legacy .pill kept) */
.qk-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: var(--fs-2xs); font-weight: 600;
  letter-spacing: var(--tracking-wide); text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid var(--border-2); color: var(--text-secondary);
}
.qk-badge.is-up, .qk-badge.risk_on { color: var(--green); background: var(--green-dim); border-color: rgba(74,222,128,.3); }
.qk-badge.is-warn, .qk-badge.neutral { color: var(--amber); background: var(--amber-dim); border-color: rgba(245,158,11,.3); }
.qk-badge.is-down, .qk-badge.risk_off { color: var(--red); background: var(--red-dim); border-color: rgba(239,68,68,.3); }
.pill { display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
.pill.risk_on { background: var(--green-dim); color: var(--green); border: 1px solid rgba(74,222,128,.3); }
.pill.neutral { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,158,11,.3); }
.pill.risk_off { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,.3); }

/* Data tables */
.qk-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.qk-table th { text-align: left; font-family: var(--mono); font-size: var(--fs-2xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.qk-table td { padding: 11px 12px; border-bottom: 1px solid var(--border-subtle); color: var(--text); }
.qk-table tr:hover td { background: var(--bg-2); }
.qk-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Section rhythm + reveal-on-scroll (pair with a tiny IntersectionObserver) */
.qk-section { padding-block: var(--sp-9); }
.qk-reveal { opacity: 0; transform: translateY(28px); transition: opacity var(--dur-3) var(--ease), transform var(--dur-3) var(--ease); }
.qk-reveal.in-view { opacity: 1; transform: none; }

/* Focus-visible accessibility ring (applies app-wide) */
:where(a, button, .qk-btn, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-bright); outline-offset: 2px; border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  .qk-reveal { opacity: 1; transform: none; transition: none; }
  * { scroll-behavior: auto !important; }
}
