/* ============================================================
   DESIGN SYSTEM — CSS Variables, Tokens, Themes
   Sponsorship Intelligence Tool
   ============================================================ */

/* ---------- Light theme (default) ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #F8F9FA;       /* Page background */
  --bg-secondary: #FFFFFF;     /* Section / panel background */
  --bg-card: #FFFFFF;          /* Card surface */
  --bg-input: #FFFFFF;         /* Input field background */
  --bg-frosted: rgba(248, 249, 250, 0.85); /* ExportBar frosted glass */

  /* Text */
  --text-primary: #0D0F11;     /* Headings, primary labels */
  --text-secondary: #5C6370;   /* Body copy, secondary labels */
  --text-muted: #9BA3AF;       /* Placeholders, hints */
  --text-inverse: #FFFFFF;     /* Text on dark/accent backgrounds */

  /* Borders */
  --border-color: #E5E7EB;     /* All borders */
  --border-focus: #1A56E8;     /* Input focus ring */

  /* Accent */
  --accent-primary: #1A56E8;   /* CTAs, active states, links */
  --accent-secondary: #0E3DA8; /* Hover on accent */
  --accent-subtle: #EBF0FD;    /* Accent tint backgrounds */

  /* Score colors */
  --score-high: #16A34A;       /* Score >= 75 (green) */
  --score-high-bg: #DCFCE7;    /* High score background tint */
  --score-mid: #D97706;        /* Score 50–74 (amber) */
  --score-mid-bg: #FEF3C7;     /* Mid score background tint */
  --score-low: #DC2626;        /* Score < 50 (red) */
  --score-low-bg: #FEE2E2;     /* Low score background tint */

  /* Composite score badge colors (same thresholds) */
  --composite-high-text: #15803D;
  --composite-mid-text: #B45309;
  --composite-low-text: #B91C1C;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Border radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-elevated: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-focus: 0 0 0 3px rgba(26, 86, 232, 0.18);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease-out;

  /* Z-index scale */
  --z-base: 1;
  --z-overlay: 10;
  --z-sticky: 100;
  --z-modal: 200;

  /* Layout */
  --max-width: 1140px;
  --export-bar-height: 60px;
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --bg-primary: #0D0F11;
  --bg-secondary: #161A1F;
  --bg-card: #1E2229;
  --bg-input: #1E2229;
  --bg-frosted: rgba(13, 15, 17, 0.88);

  --text-primary: #F1F3F5;
  --text-secondary: #9BA3AF;
  --text-muted: #5C6370;

  --border-color: #2D3139;
  --border-focus: #3B6EF0;

  --accent-subtle: #1A2847;

  --score-high-bg: #052E16;
  --score-mid-bg: #1C1500;
  --score-low-bg: #2D0707;

  --composite-high-text: #4ADE80;
  --composite-mid-text: #FCD34D;
  --composite-low-text: #F87171;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.20);
  --shadow-elevated: 0 4px 12px rgba(0,0,0,0.40);
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color var(--transition-base), color var(--transition-base);
  /* Padding at bottom so content is never hidden behind ExportBar */
  padding-bottom: calc(var(--export-bar-height) + var(--space-4));
}

/* ---------- Typography scale ---------- */
h1 { font-size: 2rem;   font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 0.9375rem; font-weight: 600; line-height: 1.4; }

p  { font-size: 0.9375rem; line-height: 1.7; color: var(--text-secondary); }

/* ---------- Focus visible (accessibility) ---------- */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ---------- Selection ---------- */
::selection {
  background: var(--accent-subtle);
  color: var(--accent-primary);
}

/* ---------- Scrollbar (webkit) ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
