/* ═══════════════════════════════════════════════════════
   Speed Signal — Design Tokens
   Shared across all section files
   ═══════════════════════════════════════════════════════ */

:root {
    /* ── Backgrounds ──
       --ss-bg-surface unified to #0C1322 (was #0F172A, a slightly more
       violet/blue tint Mason didn't want). All cards now use the darker,
       cooler --ss-bg-surface-alt-equivalent. -alt and -surface are now equal;
       kept both names for code that already references them. */
    --ss-bg:              #080D19;
    --ss-bg-surface:      #0C1322;
    --ss-bg-surface-alt:  #0C1322;
    --ss-bg-elevated:     #162036;
    --ss-bg-hover:        #131C30;
    /* Used ONLY in the Ticker Detail panel cards (sipCard, dCard, sip-metric-
       item) so they contrast with the dark surface around the SIP panel. */
    --ss-detail-card:     #0F1A2D;

    /* ── Borders ── */
    --ss-border:          rgba(255, 255, 255, 0.06);
    --ss-border-hover:    rgba(255, 255, 255, 0.12);
    --ss-border-accent:   rgba(34, 197, 94, 0.25);

    /* ── Accent palette ── */
    --ss-green:           #22C55E;
    --ss-green-light:     #4ADE80;
    --ss-green-dim:       rgba(34, 197, 94, 0.06);
    --ss-teal:            #14B8A6;
    --ss-teal-light:      #2DD4BF;
    --ss-teal-dim:        rgba(20, 184, 166, 0.06);
    --ss-cyan:            #7FA0C8;
    --ss-cyan-dim:        rgba(127, 160, 200, 0.18);
    --ss-red:             #EF4444;
    --ss-red-light:       #F87171;
    --ss-red-dark:        #DC2626;
    --ss-red-dim:         rgba(239, 68, 68, 0.08);
    --ss-amber:           #F59E0B;
    --ss-amber-light:     #FBBF24;
    --ss-amber-dark:      #D97706;
    --ss-amber-dim:       rgba(245, 158, 11, 0.08);
    --ss-blue:            #60A5FA;
    --ss-blue-dim:        rgba(96, 165, 250, 0.08);
    --ss-purple:          #A78BFA;
    --ss-purple-dim:      rgba(167, 139, 250, 0.08);

    /* ── Semantic — Phase colors ──
       One token per phase. To recolor a phase across the entire app, change
       the hex here; STATUS_CONFIG / STATUS_BADGE / STATUS_GG / charts and
       inline pills read from these tokens. The `-bg` variant (15% opacity)
       is for pill backgrounds; the `-dim` variant (6% opacity) is for
       subtle card backgrounds. */
    --ss-phase-coiling:           #7FA0C8;
    --ss-phase-coiling-bg:        rgba(127, 160, 200, 0.15);
    --ss-phase-coiling-dim:       rgba(127, 160, 200, 0.06);
    --ss-phase-pre-ignition:      #60A5FA;
    --ss-phase-pre-ignition-bg:   rgba(96, 165, 250, 0.15);
    --ss-phase-pre-ignition-dim:  rgba(96, 165, 250, 0.06);
    --ss-phase-liftoff:           #F59E0B;
    --ss-phase-liftoff-bg:        rgba(245, 158, 11, 0.15);
    --ss-phase-liftoff-dim:       rgba(245, 158, 11, 0.06);
    --ss-phase-below:             #8B9DB0;
    --ss-phase-below-bg:          rgba(157, 170, 182, 0.12);
    --ss-phase-below-dim:         rgba(157, 170, 182, 0.06);

    /* ── Semantic — Conviction levels ──
       Independent of phase color. Low → muted, High → strongest signal.
       Mason can recolor conviction here without touching phase colors. */
    --ss-conviction-low:          var(--ss-text-muted);
    --ss-conviction-medium:       var(--ss-phase-pre-ignition);
    --ss-conviction-high:         var(--ss-phase-liftoff);
    /* Empty/unfilled dot color — overridden in light theme. */
    --ss-conf-dot-empty:          rgba(255, 255, 255, 0.14);

    /* ── Text ── */
    --ss-text:            #F1F5F9;
    --ss-text-body:       #8B9DB0;
    --ss-text-secondary:  #94A3B8;
    --ss-text-muted:      #64748B;
    --ss-text-light:      #CBD5E1;
    --ss-text-lighter:    #E2E8F0;
    --ss-text-faint:      #475569;

    /* ── Gradients ── */
    --ss-grad-accent:     linear-gradient(135deg, #14B8A6 0%, #22C55E 100%);
    --ss-grad-score:      linear-gradient(90deg, #0D9488 0%, #14B8A6 40%, #22C55E 100%);
    --ss-grad-glow:       radial-gradient(ellipse at 25% 40%, rgba(20, 184, 166, 0.06) 0%, transparent 55%);
    --ss-grad-glow-alt:   radial-gradient(ellipse at 75% 80%, rgba(34, 197, 94, 0.04) 0%, transparent 50%);

    /* ── Radii ── */
    --ss-r-sm:   0.375rem;
    --ss-r-md:   0.625rem;
    --ss-r-lg:   0.875rem;
    --ss-r-xl:   1.125rem;
    --ss-r-2xl:  1.5rem;
    --ss-r-pill: 9999px;

    /* ── Shadows ── */
    --ss-shadow-card:     0 4px 24px -4px rgba(0, 0, 0, 0.35);
    --ss-shadow-glow-sm:  0 0 24px rgba(34, 197, 94, 0.15);
    --ss-shadow-glow-md:  0 0 48px rgba(34, 197, 94, 0.10);
    --ss-shadow-glow-lg:  0 0 80px rgba(20, 184, 166, 0.08);

    /* ── Motion ── */
    --ss-ease:            cubic-bezier(0.16, 1, 0.3, 1);
    --ss-ease-out:        cubic-bezier(0.33, 1, 0.68, 1);
    --ss-dur-fast:        150ms;
    --ss-dur-normal:      280ms;
    --ss-dur-slow:        500ms;

    /* ── Typography scale ── */
    --ss-font:            'Inter', system-ui, -apple-system, sans-serif;
    --ss-text-xs:         0.75rem;
    --ss-text-sm:         0.875rem;
    --ss-text-base:       1rem;
    --ss-text-lg:         1.125rem;
    --ss-text-xl:         1.25rem;
    --ss-text-2xl:        1.5rem;
    --ss-text-3xl:        1.875rem;
    --ss-text-4xl:        2.25rem;
    --ss-text-5xl:        3rem;
    --ss-text-6xl:        3.75rem;
}

/* ── Light theme overrides ──
   Hallazgo #18: the light theme was previously implemented via CSS attribute
   selectors that matched Tailwind class strings literally (e.g.
   [class*="bg-[#0F172A]"]). That blocked migrating hex to var() tokens.
   Now the tokens themselves switch value when data-theme="light" is set,
   so the HTML can use bg-[var(--ss-bg-surface)] and it Just Works™ in both
   themes without any attribute selectors. */
html[data-theme="light"] {
    /* ── Backgrounds ── */
    --ss-bg:              #F8FAFC;
    --ss-bg-surface:      #FFFFFF;
    --ss-bg-surface-alt:  #F1F5F9;
    --ss-bg-elevated:     #E2E8F0;
    --ss-bg-hover:        #F1F5F9;
    /* Detail panel cards (sipCard, dCard, sip-metric-item) — slightly darker
       than --ss-bg to make a sutil contrast with the page background. */
    --ss-detail-card:     #F1F5F9;
    /* Light-mode shadow: subtler than the dark equivalent (the dark version
       uses heavy black shadow which would look harsh on a white background).
       Two-layer shadow gives the 3D feel without darkening the bg too much. */
    --ss-shadow-card:     0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    /* Empty dot color — visible on white background. */
    --ss-conf-dot-empty:  rgba(15, 23, 42, 0.18);

    /* ── Borders ── */
    --ss-border:          rgba(0, 0, 0, 0.08);
    --ss-border-hover:    rgba(0, 0, 0, 0.15);
    --ss-border-accent:   rgba(34, 197, 94, 0.2);

    /* ── Text ── */
    --ss-text:            #0F172A;
    --ss-text-body:       #627484;
    --ss-text-secondary:  #566878;
    --ss-text-muted:      #475569;
    --ss-text-faint:      #94A3B8;

    /* ── Status colors — darker for contrast on light bg ── */
    --ss-amber-light:     #B45309;
    --ss-amber-dim:       rgba(180, 83, 9, 0.08);
    --ss-cyan:            #4A6587;
    --ss-cyan-dim:        rgba(74, 101, 135, 0.15);
    --ss-blue:            #2563EB;
    --ss-blue-dim:        rgba(37, 99, 235, 0.08);
    --ss-purple:          #7C3AED;
    --ss-purple-dim:      rgba(124, 58, 237, 0.08);
    --ss-red-light:       #DC2626;
    --ss-red-dim:         rgba(220, 38, 38, 0.08);

    /* M16: greens más oscuros para texto/badges sobre superficies blancas — el #22C55E
       y #4ADE80 originales tienen contraste WCAG insuficiente en light mode. */
    --ss-green:           #16A34A;
    --ss-green-light:     #15803D;
    --ss-green-dim:       rgba(22, 163, 74, 0.10);
    --ss-teal:            #0D9488;
    --ss-teal-light:      #0F766E;
    --ss-teal-dim:        rgba(13, 148, 136, 0.10);
}
