:root{
  /* Accessible Brand Palette (central source of truth) */
  /* Primary (Indigo 600): AA on white as text (≈5.2:1), white on primary (≈5.2:1) */
  --primary:#4F46E5; /* rgb(79,70,229) */
  --primary-700:#3730A3; /* Darker for outlines/hover, white on this ≈8.8:1 */
  --primary-rgb:79,70,229;

  /* Secondary (Cyan 500/600 blended) – accent/gradients only; avoid as text color on light bg (fails AA) */
  --secondary:#06B6D4; /* rgb(6,182,212) */
  --secondary-700:#0E7490; /* rgb(14,116,144) for borders/overlays */
  --secondary-rgb:6,182,212;

  /* Accent (Emerald 500/600) – use for positive/accents; white on accent (≈4.7–6.0:1) */
  --accent:#10B981; /* rgb(16,185,129) */
  --accent-700:#047857; /* rgb(4,120,87) for stronger contrast */
  --accent-rgb:16,185,129;

  /* States */
  --success:#16A34A; /* white on success ≈4.9:1 */
  --success-700:#15803D;
  --success-rgb:22,163,74;
  --warning:#D97706; /* use dark text on warning backgrounds */
  --warning-800:#92400E;
  --warning-rgb:217,119,6;
  --danger:#DC2626; /* white on danger ≈5.6:1 */
  --danger-700:#B91C1C;
  --danger-rgb:220,38,38;

  /* Neutrals (Tailored for contrast) */
  --gray-900:#0F172A; /* on white ≈ 15:1 */
  --gray-800:#1F2937;
  --gray-700:#374151; /* on white ≈ 7.6:1 */
  --gray-600:#4B5563; /* on white ≈ 5.7:1 */
  --gray-500:#6B7280;
  --gray-400:#9CA3AF;
  --gray-300:#D1D5DB;
  --gray-200:#E5E7EB;
  --gray-100:#F3F4F6;
  --white:#FFFFFF;
  --black:#000000;
  --white-rgb:255,255,255;
  --black-rgb:0,0,0;

  /* Semantic Surfaces (light) */
  --surface-1:#FFFFFF;
  --surface-2:#F8FAFC;
  --surface-3:#EEF2FF; /* subtle primary-tinted card */
  --elevated-1:#FFFFFF;
  --elevated-border:#E5E7EB;

  /* Text tokens (light) */
  --text-strong:var(--gray-900); /* ≥ 12:1 on --surface-1 */
  --text:var(--gray-800);
  --text-muted:var(--gray-600); /* ≈5.7:1 on --surface-1 */
  --text-inverse:#FFFFFF; /* on dark surfaces */
  --text-inverse-rgb:255,255,255;

  /* Borders */
  --border:var(--gray-200);
  --border-strong:#D1D5DB;

  /* Components */
  --chip-bg:#FFFFFF;
  --chip-border:var(--gray-200);
  --chip-text:var(--gray-800);

  /* Top bar / dark ribbons */
  --topbar-bg:#0F172A;
  --topbar-border:var(--gray-800);

  /* Overlays / scrims */
  --scrim-rgb:2,6,23; /* deep navy-black for overlays */

  /* Focus ring (meets AA against most surfaces) */
  --focus-outline:#1E40AF; /* Indigo-800 */
  --focus-ring:0 0 0 3px rgba(var(--primary-rgb), .32);

  /* Elevation shadows (use scrim for neutral, accessible depth) */
  --shadow-sm:0 1px 2px rgba(var(--scrim-rgb), .05);
  --shadow-md:0 8px 24px rgba(var(--scrim-rgb), .10);
  --shadow-lg:0 14px 40px rgba(var(--scrim-rgb), .14);
  --shadow-xl:0 20px 50px rgba(var(--scrim-rgb), .18);
}

@media (prefers-color-scheme: dark){
  :root{
    /* Semantic color tokens (dark) */
    --surface-1:#0B0F1A;
    --surface-2:#0F172A;
    --surface-3:#111827;
    --elevated-1:#0F172A;
    --elevated-border:#1F2937;

    --text-strong:#F3F4F6; /* on surface-1 ≈ 13:1 */
    --text:#E5E7EB;
    --text-muted:#CBD5E1;
    --text-inverse:#0B0F1A;

    --border:#1F2937;
    --border-strong:#334155;

    --chip-bg:#0F172A;
    --chip-border:#1F2937;
    --chip-text:#E2E8F0;

    --topbar-bg:#0F172A;
    --topbar-border:#1F2937;
  }
}

/* Shared confidence/messaging strip */
.confidence-strip{padding:1.25rem 0;background:var(--surface-2);border-bottom:1px solid var(--border)}
.confidence-strip .container{max-width:1180px;margin:0 auto;padding:0 1rem}
.confidence-strip .row{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:.75rem;row-gap:.6rem}
.confidence-chip{display:inline-flex;align-items:center;gap:.5rem;padding:.6rem .9rem;border:1px solid var(--chip-border);border-radius:999px;background:var(--chip-bg);color:var(--chip-text);font-weight:800;font-size:.8rem;letter-spacing:.02em}
.confidence-chip i{color:var(--primary)}

/* Mobile-First High Contrast Overrides (WCAG AA Compliance) */
@media (max-width: 768px) {
  :root {
    /* Enhanced mobile contrast variables */
    --mobile-primary-text: #1E40AF; /* Indigo 800 - 7.7:1 on white */
    --mobile-background-light: #FEFEFE; /* Pure white for maximum contrast */
    --mobile-text-strong: #0A0A0A; /* Near black - 20.6:1 on white */
    --mobile-text-default: #1F2937; /* Gray 800 - 12.6:1 on white */
    --mobile-text-muted: #374151; /* Gray 700 - 7.6:1 on white */
    --mobile-accent: #047857; /* Emerald 700 - 8.4:1 on white */
    --mobile-border-visible: #6B7280; /* Gray 500 - visible on all backgrounds */
    --mobile-shadow-strong: rgba(0, 0, 0, 0.25);
    
    /* Override problematic colors for mobile */
    --text-strong: var(--mobile-text-strong);
    --text: var(--mobile-text-default);
    --text-muted: var(--mobile-text-muted);
    --primary: var(--mobile-primary-text);
    --accent: var(--mobile-accent);
    --surface-1: var(--mobile-background-light);
    --border: var(--mobile-border-visible);
  }
  
  /* Force high contrast on key elements */
  .logo, .logo-icon {
    color: var(--mobile-text-strong) !important;
    background: var(--mobile-background-light) !important;
  }
  
  .nav-link {
    color: var(--mobile-text-default) !important;
  }
  
  .nav-link:hover, .nav-link.active {
    color: var(--mobile-primary-text) !important;
  }
  
  /* Hero section mobile fixes */
  .hero h1, .display {
    color: var(--mobile-text-strong) !important;
  }
  
  .hero p, .lead {
    color: var(--mobile-text-default) !important;
  }
  
  /* Content areas */
  .section-title, h2, h3, h4, h5, h6 {
    color: var(--mobile-text-strong) !important;
  }
  
  p, .body-text, .card-body {
    color: var(--mobile-text-default) !important;
  }
  
  /* Muted text elements */
  .text-muted, .gray-600, .step-text, .testi-name {
    color: var(--mobile-text-muted) !important;
  }
  
  /* Form elements */
  input, textarea, select {
    color: var(--mobile-text-strong) !important;
    background: var(--mobile-background-light) !important;
    border-color: var(--mobile-border-visible) !important;
  }
  
  /* Tables */
  .table th, .table td {
    color: var(--mobile-text-default) !important;
    border-color: var(--mobile-border-visible) !important;
  }
  
  /* Cards and surfaces */
  .card, .plan, .step {
    background: var(--mobile-background-light) !important;
    border-color: var(--mobile-border-visible) !important;
  }
  
  /* Links in content */
  .case-link, .spotlight-text a, .content-link {
    color: var(--mobile-primary-text) !important;
  }
}

/* Force mobile contrast utility class */
.force-mobile-contrast {
  color: #0A0A0A !important;
  background: #FEFEFE !important;
  border-color: #6B7280 !important;
}

.force-mobile-contrast a {
  color: #1E40AF !important;
}

.force-mobile-contrast.light-text {
  color: #FEFEFE !important;
  background: #0A0A0A !important;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  *{transition:none !important;animation:none !important}
}
