/* ============================================================
   BET BUILDER AI - DESIGN SYSTEM TOKENS
   Master CSS variables, resets, typography, and base components.
   Import this file first in every page.
   See DESIGN_SYSTEM.md for full documentation.
   ============================================================ */

/* === RAW COLOUR TOKENS === */
:root {
  /* Brand Red */
  --red-50:  #fff0f0;
  --red-100: #ffd6d6;
  --red-200: #ff9999;
  --red-300: #ff5c5c;
  --red-400: #ff2b2b;
  --red-500: #ff0000;
  --red-600: #db0000;
  --red-700: #b30000;
  --red-800: #800000;
  --red-900: #4d0000;

  /* Brand Blue */
  --blue-50:  #eef3ff;
  --blue-100: #d4e1ff;
  --blue-200: #a3bfff;
  --blue-300: #6d99ff;
  --blue-400: #3778ff;
  --blue-500: #0257ff;
  --blue-600: #0047d4;
  --blue-700: #0036a3;
  --blue-800: #002673;
  --blue-900: #001744;

  /* Neutrals - the dark end is the site's PAGE GROUND and panel ramp.
   *
   * These were cool-toned: #0a0c14 put its blue channel ten steps above its
   * red, and the steps above it widened the gap (#181c28 was sixteen, #282e42
   * twenty-six). Every panel on the site is a white overlay
   * (rgba(255,255,255,0.02-0.05)), so a panel does not dilute the ground's
   * cast, it multiplies the area showing it - and pages with many panels
   * read blue rather than dark.
   *
   * The NFL sheet worked this out first and forked its own de-blued ramp
   * scoped to body.nfl-mode. That fork is why football and NFL did not match.
   * Those values are now the shared ones: 950 / 900 / 800 / 750 are exactly
   * what NFL shipped, and 850 / 700 / 600 are new, de-blued to sit on the same
   * curve within 3.4% relative luminance of what they replaced. The ramp is
   * still monotonic, so the depth hierarchy survives and only the hue moves.
   *
   * --gray-500 and lighter are borders and text, not grounds, and keep their
   * cool tone deliberately - 500 is still a cast of thirty-eight. */
  --gray-950: #07080b;
  --gray-900: #0b0d12;
  --gray-850: #101217;
  --gray-800: #12141a;
  --gray-750: #171a21;
  --gray-700: #1f222a;
  --gray-600: #2a2e36;
  --gray-500: #3a4160;
  --gray-400: #555d78;
  --gray-300: #8890aa;
  --gray-200: #b4bbd4;
  --gray-100: #dfe3ef;
  --gray-50:  #f0f2f8;

  /* Semantic */
  --color-success: #34d399;
  --color-warning: #f59e0b;
  --color-error:   var(--red-400);
  --color-info:    var(--blue-400);

  /* Accents */
  --accent-purple: #7c3aed;
  --accent-cyan:   #22d3ee;
  --accent-gold:   #fbbf24;  /* SEMANTIC amber (aliased by --accent-amber for red/amber/green coding) - kept, NOT the brand accent. Brand gold->red lives in --wc-gold. */
  --accent-orange: #f97316;
}

/* === SEMANTIC SURFACE TOKENS === */
:root {
  --surface-base:     var(--gray-900);
  --surface-sunken:   var(--gray-950);
  --surface-default:  var(--gray-800);
  --surface-elevated: var(--gray-750);
  --surface-hover:    var(--gray-700);
  --surface-active:   var(--gray-600);
  --surface-overlay:  rgba(6, 7, 11, 0.8);
}

/* === SEMANTIC BORDER TOKENS === */
:root {
  --border-default: var(--gray-600);
  --border-subtle:  var(--gray-700);
  --border-strong:  var(--gray-500);
  --border-focus:   var(--red-500);
  --border-focus-alt: var(--blue-500);
}

/* === SEMANTIC TEXT TOKENS === */
:root {
  --text-primary:   var(--gray-50);
  --text-secondary: var(--gray-300);
  --text-muted:     #7B839F;
  --text-disabled:  var(--gray-500);
  --text-inverse:   var(--gray-950);
  --text-on-red:    #ffffff;
  --text-on-blue:   #ffffff;
  --text-info:      var(--blue-300);
  --text-accent-purple: #9B6BFF;
}

/* === INTERACTIVE TOKENS === */
:root {
  --interactive-primary:        var(--red-500);
  --interactive-primary-hover:  var(--red-400);
  --interactive-secondary:      var(--blue-500);
  --interactive-secondary-hover: var(--blue-400);
  --interactive-muted:          var(--text-muted);
  --interactive-muted-hover:    var(--gray-300);
}

/* === GRADIENTS === */
:root {
  /* Brand */
  --gradient-primary:   linear-gradient(135deg, #ff0000, #ff2b2b);
  --gradient-secondary: linear-gradient(135deg, #0257ff, #3778ff);
  --gradient-power:     linear-gradient(135deg, #ff0000, #0257ff);

  /* Accent */
  --gradient-fire:     linear-gradient(135deg, #ff0000, #ff6b00);
  --gradient-electric: linear-gradient(135deg, #0257ff, #00d4ff);
  --gradient-hype:     linear-gradient(135deg, #ff0000, #7c3aed);
  --gradient-neon:     linear-gradient(135deg, #00e070, #00d4ff);
  --gradient-warm:     linear-gradient(135deg, #ffb800, #ff6b00);
  --gradient-gold:     linear-gradient(135deg, #ff2740, #ff0000);

  /* Surface */
  --gradient-surface: linear-gradient(135deg, #181c28, #13161f);
  --gradient-glass:   linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

/* === SHADOWS & GLOWS === */
:root {
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl:  0 16px 48px rgba(0, 0, 0, 0.6);

  --glow-red:         0 0 30px rgba(255, 0, 0, 0.12);
  --glow-red-strong:  0 0 40px rgba(255, 0, 0, 0.25);
  --glow-blue:        0 0 30px rgba(2, 87, 255, 0.12);
  --glow-blue-strong: 0 0 40px rgba(2, 87, 255, 0.25);
}

/* === BACKDROP BLUR === */
:root {
  --blur-sm: blur(8px);
  --blur-md: blur(16px);
  --blur-lg: blur(24px);
}

/* === SPACING SCALE (4px base) === */
:root {
  --s-0:    0px;
  --s-px:   1px;
  --s-0\.5: 2px;
  --s-1:    4px;
  --s-2:    8px;
  --s-3:    12px;
  --s-4:    16px;
  --s-5:    20px;
  --s-6:    24px;
  --s-8:    32px;
  --s-10:   40px;
  --s-12:   48px;
  --s-16:   64px;
  --s-20:   80px;
  --s-24:   96px;
}

/* === BORDER RADIUS === */
:root {
  --r-none: 0px;
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-2xl:  28px;
  --r-full: 9999px;
}

/* === TYPOGRAPHY === */
:root {
  --font-display: 'Red Hat Display', system-ui, sans-serif;
  --font-body:    'Red Hat Display', system-ui, sans-serif;
  --font-mono:    'Red Hat Mono', monospace;
}

/* === BACKWARD-COMPAT ALIASES === */
/* Maps old theme.css variable names to new tokens for incremental migration */
:root {
  --bg-primary:    var(--surface-base);
  --bg-card:       var(--surface-default);
  --bg-card-hover: var(--surface-hover);
  --bg-elevated:   var(--surface-elevated);
  --bg-surface:    var(--surface-sunken);
  --border:        var(--border-default);
  --border-hover:  var(--border-strong);
  --accent-red:    var(--red-400);
  --accent-amber:  var(--accent-gold);
  --accent-green:  var(--color-success);
  --accent-blue:   var(--blue-400);
  --font:          var(--font-body);
  --mono:          var(--font-mono);
  --shadow-glow:   var(--glow-red);
  --shadow-card:   var(--shadow-sm);
  --radius-sm:     var(--r-sm);
  --radius-md:     var(--r-md);
  --radius-lg:     var(--r-lg);
  --radius-xl:     var(--r-xl);
  --gradient-hot:  var(--gradient-fire);
  --gradient-assist: var(--gradient-electric);
  --gradient-subtle: var(--gradient-surface);
}

/* === GLOBAL RESET === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === BASE BODY === */
body {
  background: var(--surface-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient background glow - opt-in, off by default.
 *
 * This carried a red + blue radial wash for every page on the site. It was the
 * lowest of three stacked washes (wc-site.css and wc-public.css each claimed
 * the same pseudo-element on the wc pages at higher specificity), and with
 * those two removed it would have been the one that kept the pages blue.
 *
 * The scaffold stays because theme.css layers page-specific glows on top of it
 * (body.page-assistant, body.page-sot, body.page-goals) and those rules set
 * only a background, relying on this rule for the box. A page that wants a
 * tint declares one; every other page gets a flat --surface-base ground. */
body::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: none;
  pointer-events: none;
  z-index: 0;
}

/* Dot grid overlay */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* === TYPOGRAPHY BASE === */
h1, .text-h1,
.text-display {
  font-family: var(--font-display);       /* Red Hat Display */
  text-transform: none;                    /* sentence case (was Anton uppercase) */
  transform: none;                         /* no skew (was skewX(-10deg)) */
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-weight: 800;                        /* ExtraBold (Red Hat) */
}

h1, .text-h1 {
  font-size: 48px;
}

.text-display {
  font-size: 72px;
  line-height: 1.0;
}

h2, .text-h2 {
  font-family: var(--font-body);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

h3, .text-h3 {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.25;
}

h4, .text-h4 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.text-body-lg {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.65;
}

.text-body-sm {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.text-caption {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

.text-overline {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.3;
  text-transform: uppercase;
}

.text-micro {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  line-height: 1.3;
  text-transform: uppercase;
}

/* Mono variants */
.text-data {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.text-stat {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.text-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

/* === COLOUR UTILITIES === */
.text-red     { color: var(--red-400); }
.text-blue    { color: var(--text-info); }
.text-green   { color: var(--color-success); }
.text-gold    { color: var(--accent-gold); }
.text-purple  { color: var(--text-accent-purple); }
.text-cyan    { color: var(--accent-cyan); }
.text-orange  { color: var(--accent-orange); }
.text-warning { color: var(--color-warning); }

/* Gradient text */
.text-gradient-primary {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-gradient-power {
  background: var(--gradient-power);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-gradient-fire {
  background: var(--gradient-fire);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-gradient-electric {
  background: var(--gradient-electric);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-gradient-hype {
  background: var(--gradient-hype);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === BASE COMPONENT STYLES === */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1;
}
.btn:disabled {
  background: var(--gray-600);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-on-red);
  box-shadow: var(--glow-red);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: var(--glow-red-strong);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--gradient-secondary);
  color: var(--text-on-blue);
  box-shadow: var(--glow-blue);
}
.btn-secondary:hover:not(:disabled) {
  box-shadow: var(--glow-blue-strong);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--red-500);
  color: var(--red-500);
  background: rgba(255, 0, 0, 0.04);
}

.btn-pill {
  border-radius: var(--r-full);
  padding: 12px 32px;
}

/* Cards */
.card {
  background: var(--surface-default);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: all 0.2s ease;
}
.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.card-accent {
  position: relative;
  overflow: hidden;
}
.card-accent::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.2s;
}
.card-accent:hover::before {
  opacity: 1;
}

/* Inputs */
.input {
  background: var(--surface-default);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s ease;
}
.input:hover {
  border-color: var(--border-strong);
}
.input:focus {
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.08);
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}
.pill:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.pill.active {
  border-color: var(--red-500);
  color: var(--red-500);
  background: rgba(255, 0, 0, 0.06);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-family: var(--font-body);
}
.badge-red {
  background: rgba(255, 43, 43, 0.10);
  color: var(--red-300);
}
.badge-blue {
  background: rgba(2, 87, 255, 0.12);
  color: var(--text-info);
}
.badge-green {
  background: rgba(0, 224, 112, 0.12);
  color: var(--color-success);
}
.badge-gold {
  background: rgba(255, 39, 64, 0.12);
  color: var(--accent-gold);
}
.badge-purple {
  background: rgba(124, 58, 237, 0.12);
  color: var(--text-accent-purple);
}

/* === KEYFRAME ANIMATIONS === */
@keyframes fadeUp {
  from { opacity: 0; translate: 0 16px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.6); }
}

@keyframes glowBreathe {
  0%, 100% { opacity: 0.06; }
  50% { opacity: 0.12; }
}

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

/* === UTILITY === */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
