/*
 * ClearHorizon design tokens
 * The single source of truth for color, type, spacing, shape, and motion.
 * Light mode is the default; [data-theme="dark"] overrides for dark mode.
 * Contrast ratios noted inline are verified against WCAG 2.1 AA.
 * Palette: "Momentum" refresh (brighter azure primary, cooler slate surfaces).
 */

:root {
  /* Brand */
  --ch-primary:        #1466B8;  /* Azure — white text on this ≈ 5.8:1 (AA) */
  --ch-primary-hover:  #0F5296;
  --ch-primary-text:   #0F5296;  /* navy text on light tints */
  --ch-accent:         #0E8A6E;  /* Teal — used sparingly for emphasis */

  /* Surfaces & text */
  --ch-bg:             #EDF1F6;  /* page */
  --ch-surface:        #FFFFFF;  /* cards / panels */
  --ch-surface-tint:   #E8EEF6;  /* metric cards, subtle fills */
  --ch-surface-info:   #E8EEF6;  /* selected / info fills */
  --ch-text:           #0F1B26;  /* on surface — very high contrast */
  --ch-text-muted:     #5A6675;  /* on surface — AA for informational text */
  --ch-text-decorative:#8696A4;  /* decorative chrome ONLY — never informational text */
  --ch-border:         #E1E7EF;
  --ch-border-strong:  #D3DBE6;

  /* Semantic (meaning only) */
  --ch-success:        #176B45;
  --ch-success-bg:     #DDF2EA;
  --ch-warning:        #8A5A0B;
  --ch-warning-bg:     #FBF3E2;
  --ch-danger:         #A33D2D;
  --ch-danger-bg:      #FBEAE7;
  --ch-info:           #1466B8;  /* tracks --ch-primary */
  --ch-info-bg:        #E8EEF6;

  /* Typography */
  --ch-font-sans: "Spline Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ch-fs-12: 0.75rem;  --ch-fs-13: 0.8125rem; --ch-fs-14: 0.875rem;
  --ch-fs-16: 1rem;     --ch-fs-18: 1.125rem;  --ch-fs-20: 1.25rem;
  --ch-fs-24: 1.5rem;   --ch-fs-30: 1.875rem;  --ch-fs-38: 2.375rem;
  --ch-fw-regular: 400; --ch-fw-medium: 500;   --ch-fw-semibold: 600;

  /* Spacing (4px base) */
  --ch-sp-1: 4px;  --ch-sp-2: 8px;  --ch-sp-3: 12px; --ch-sp-4: 16px;
  --ch-sp-6: 24px; --ch-sp-8: 32px; --ch-sp-12: 48px; --ch-sp-16: 64px;

  /* Shape — Momentum bumps radii one step up (was 6/8/12) for a softer feel */
  --ch-radius-sm: 9px; --ch-radius-md: 12px; --ch-radius-lg: 16px;
  --ch-radius-xl: 20px; --ch-radius-pill: 999px;
  --ch-shadow-sm: 0 1px 2px rgba(15, 27, 38, 0.05);
  --ch-shadow-md: 0 4px 12px rgba(15, 27, 38, 0.10);
  --ch-shadow-lg: 0 20px 50px -24px rgba(15, 27, 38, 0.28);

  /* Motion */
  --ch-motion-micro: 150ms;
  --ch-motion-standard: 250ms;
  --ch-motion-panel: 400ms;
  --ch-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-theme="dark"] {
  --ch-primary:        #4FA3E8;  /* lightened for dark */
  --ch-primary-hover:  #6FB6EE;
  --ch-primary-text:   #BFD8F0;
  --ch-accent:         #3FC0A0;

  --ch-bg:             #0B141D;
  --ch-surface:        #132230;
  --ch-surface-tint:   #1A2E40;
  --ch-surface-info:   #1A2E40;
  --ch-text:           #E7EEF4;  /* ≈ 14:1 */
  --ch-text-muted:     #9DB0BE;  /* ≈ 6.1:1 */
  --ch-text-decorative:#6B7E8D;
  --ch-border:         #243645;
  --ch-border-strong:  #2E4356;

  --ch-success:        #34B27B;
  --ch-success-bg:     #123528;
  --ch-warning:        #D8A23D;
  --ch-warning-bg:     #382A11;
  --ch-danger:         #E0685C;
  --ch-danger-bg:      #3A1F1B;
  --ch-info:           #4FA3E8;  /* tracks --ch-primary */
  --ch-info-bg:        #1A2E40;

  /* Momentum dark shadows */
  --ch-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --ch-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --ch-shadow-lg: 0 20px 50px -24px rgba(0, 0, 0, 0.6);
}

/* Financial figures align to the digit */
.ch-figure { font-variant-numeric: tabular-nums; }

/* Respect the user's reduced-motion preference everywhere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
