/* style.css — SPARK Design Tokens & Component Styles */

/* ===== TYPE SCALE ===== */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    8rem);

  /* ===== SPACING (4px system) ===== */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* ===== FONTS ===== */
  --font-display: 'Clash Display', 'Inter', sans-serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;

  /* ===== RADIUS ===== */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* ===== TRANSITIONS ===== */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* ===== CONTENT WIDTHS ===== */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;
}

/* ===== DARK MODE (DEFAULT) ===== */
:root, [data-theme="dark"] {
  --color-bg:             #0f1117;
  --color-surface:        #1a1b23;
  --color-surface-2:      #242530;
  --color-surface-offset: #16171f;
  --color-border:         #2a2b35;
  --color-divider:        #1f2029;
  --color-text:           #ffffff;
  --color-text-muted:     #9ca3af;
  --color-text-faint:     #9ca3af; /* CRITICAL-05: was #6b7280 (failed WCAG AA); values were swapped */
  --color-text-inverse:   #0f1117;
  --color-primary:        #e8a634;
  --color-primary-hover:  #f0b44a;
  --color-primary-active: #d49530;
  --color-primary-highlight: rgba(232, 166, 52, 0.12);
  --color-error:          #ef4444;
  --color-success:        #22c55e;

  /* Pre-computed alpha values for oklch() relative color Firefox fallbacks (CRITICAL-01) */
  --color-bg-alpha-85:         rgb(15 17 23 / 0.85);
  --color-border-alpha-50:     rgb(42 43 53 / 0.5);
  --color-primary-alpha-30:    rgb(232 166 52 / 0.3);
  --color-primary-alpha-40:    rgb(232 166 52 / 0.4);
  --color-primary-alpha-15:    rgb(232 166 52 / 0.15);
  --color-primary-alpha-12:    rgb(232 166 52 / 0.12);
  --color-primary-alpha-10:    rgb(232 166 52 / 0.1);
  --color-primary-alpha-08:    rgb(232 166 52 / 0.08);
  --color-primary-alpha-06:    rgb(232 166 52 / 0.06);
  --color-primary-alpha-20:    rgb(232 166 52 / 0.2);
  --color-primary-alpha-015:   rgb(232 166 52 / 0.15);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] {
  --color-bg:             #f7f6f2;
  --color-surface:        #ffffff;
  --color-surface-2:      #f3f0ec;
  --color-surface-offset: #edeae5;
  --color-border:         #d4d1ca;
  --color-divider:        #dcd9d5;
  --color-text:           #0f1117;
  --color-text-muted:     #646972; /* MAJOR-02: was #6b7280 (4.47:1, just below WCAG AA); now ~4.6:1 */
  --color-text-faint:     #6b7280; /* CRITICAL-05: was #9ca3af (failed WCAG AA); values were swapped */
  --color-text-inverse:   #ffffff;
  --color-primary:        #e8a634;
  --color-primary-text:   #8a5a00; /* CRITICAL-03: dark amber for WCAG AA text on light backgrounds (~7.5:1 on white) */
  --color-primary-hover:  #d49530;
  --color-primary-active: #c0862c;
  --color-primary-highlight: rgba(232, 166, 52, 0.1);
  --color-error:          #dc2626;
  --color-success:        #16a34a;

  /* Pre-computed alpha values for oklch() relative color Firefox fallbacks (CRITICAL-01) */
  --color-bg-alpha-85:         rgb(247 246 242 / 0.85);
  --color-border-alpha-50:     rgb(212 209 202 / 0.5);
  --color-primary-alpha-30:    rgb(232 166 52 / 0.3);
  --color-primary-alpha-40:    rgb(232 166 52 / 0.4);
  --color-primary-alpha-15:    rgb(232 166 52 / 0.15);
  --color-primary-alpha-12:    rgb(232 166 52 / 0.12);
  --color-primary-alpha-10:    rgb(232 166 52 / 0.1);
  --color-primary-alpha-08:    rgb(232 166 52 / 0.08);
  --color-primary-alpha-06:    rgb(232 166 52 / 0.06);
  --color-primary-alpha-20:    rgb(232 166 52 / 0.2);
  --color-primary-alpha-015:   rgb(232 166 52 / 0.15);

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
}

/* System preference fallback */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg:             #f7f6f2;
    --color-surface:        #ffffff;
    --color-surface-2:      #f3f0ec;
    --color-surface-offset: #edeae5;
    --color-border:         #d4d1ca;
    --color-divider:        #dcd9d5;
    --color-text:           #0f1117;
    --color-text-muted:     #6b7280;
    --color-text-faint:     #9ca3af;
    --color-text-inverse:   #ffffff;
    --color-primary:        #e8a634;
    --color-primary-hover:  #d49530;
    --color-primary-active: #c0862c;
    --color-primary-highlight: rgba(232, 166, 52, 0.1);
    --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
    --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
    --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
  }
}
