/* ============================================================
   DESIGN TOKENS — single source of truth (Batch 1 foundation)
   Legacy names are preserved verbatim (class-contract rule);
   new mobile-overhaul tokens extend the set below the fold.
   ============================================================ */

:root {
  /* ---- Legacy palette (unchanged values) ---- */
  --color-bg: #faf5e6;
  --color-bg-alt: #f1e8d0;
  --color-text: #1a1a1a;
  --color-text-secondary: #6c757d;
  --color-border: #e9ecef;

  --color-accent: #059669;
  --color-accent-dark: #065f46;
  --color-accent-medium: #10b981;
  --color-accent-light: #d1fae5;
  --color-accent-lighter: #ecfdf5;

  --color-gold: #d4af37;
  --color-gold-dark: #b8960c;
  --color-gold-medium: #f0d060;
  --color-gold-light: #fff8e1;
  --color-gold-tint: #fef9e7;

  --color-error: #dc2626;
  --color-error-light: #fee2e2;
  --color-warning: #d97706;

  --color-shadow: rgba(0, 0, 0, 0.05);
  --color-correct: #059669;
  --color-wrong: #dc2626;
  --color-success: #059669;

  /* ---- Legacy typography / spacing / radius / motion ---- */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-secondary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  --space-0: 0;
  --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;

  --radius-sm: 0.25rem;
  --radius-base: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px var(--color-shadow);
  --shadow-base: 0 4px 6px var(--color-shadow);
  --shadow-lg: 0 10px 15px var(--color-shadow);
  --card-shadow-elevated: 0 2px 4px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(15, 23, 42, 0.08);

  --transition-fast: 150ms ease-in-out;
  --transition-normal: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;

  --max-width-container: 48rem;
  --header-height: 4rem;
  --touch-min: 44px;

  /* ============================================================
     MOBILE-OVERHAUL EXTENSIONS (Batch 1)
     ============================================================ */

  /* Ink & surfaces (value-exact homes for former literals) */
  --color-ink: #0f172a;
  --ink-rgb: 15, 23, 42;
  --color-text-secondary-strong: #475569;
  --color-text-muted: #64748b;
  --slate-rgb: 100, 116, 139;
  --slate-deep-rgb: 71, 85, 105;
  --color-border-soft: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-surface: #ffffff;
  --surface-rgb: 255, 255, 255;
  --color-surface-bright: #f8fafc;
  --surface-bright-rgb: 248, 250, 252;
  --color-surface-muted: #f1f5f9;
  --shadow-rgb: 0, 0, 0;
  --color-check-muted: #cccccc;

  /* Status strengtheners */
  --color-success-strong: #15803d;
  --color-danger-strong: #b91c1c;
  --color-warning-strong: #a16207;
  --color-warning-deep: #92400e;
  --danger-deep: #991b1b;
  --danger-darkest: #7f1d1d;
  --flash-dark: #101828;

  /* RGB triplets (for alpha composition) */
  --accent-rgb: 5, 150, 105;
  --accent-medium-rgb: 16, 185, 129;
  --danger-rgb: 239, 68, 68;
  --error-rgb: 220, 38, 38;
  --red-wash-rgb: 254, 226, 226;
  --metal-gold-rgb: 202, 138, 4;
  --bronze-rgb: 180, 83, 9;
  --blue-rgb: 59, 130, 246;
  --territory-b1-rgb: 37, 99, 235;
  --success-rgb: 34, 197, 94;
  --warn-mid-rgb: 234, 179, 8;

  /* Metals & territories */
  --metal-gold: #ca8a04;
  --metal-bronze: #b45309;
  --metal-silver: #94a3b8;
  --territory-b1: #2563eb;
  --territory-b2: #7c3aed;
  --emerald-strong: #047857;
  --emerald-soft: #34d399;
  --emerald-tint: #a7f3d0;
  --success-wash: #eef4ef;
  --success-border: #cfe6d8;
  --emerald-deep: #064e3b;
  --emerald-light: #6ee7b7;
  --banner-ink: #713f12;
  --metal-silver-rgb: 148, 163, 184;
  --ink-deep-rgb: 16, 24, 40;
  --legacy-gold-rgb: 212, 175, 55;

  /* Washes (gold ceremony / parchment puzzle) */
  --gold-wash-a: #fffbeb;
  --gold-wash-b: #fef3c7;
  --parchment-a: #faf5e6;
  --parchment-b: #f1e8d0;
  --parchment-border: #e2d5b0;
  --parchment-ink: #6b5618;
  --parchment-sub: #7c6a35;

  /* Radii additions (legacy scale untouched) */
  --radius-card: 16px;
  --radius-sheet: 20px;

  /* Touch target alias */
  --tap: 44px;

  /* Breakpoints (reference for media queries) */
  --bp-tablet: 720px;
  --bp-desktop: 1024px;

  /* Motion additions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.22, 1.4, 0.36, 1);

  /* Z-index ladder (single stacking authority) */
  --z-board: -1;
  --z-base: 0;
  --z-sticky: 10;
  --z-float: 90;
  --z-modal: 120;
  --z-banner: 150;
  --z-ceremony: 200;
  --z-flash: 9999;
}

/* Dark-mode adjustments carried over (legacy behavior preserved). */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #f8fafc;
    --color-bg-alt: #f1f5f9;
    --color-text: #0f172a;
    --color-text-secondary: #64748b;
    --color-border: #cbd5e1;
    --color-accent: #10b981;
    --color-accent-light: #d1fae5;
  }
}

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