/* ============================================================================
   ICTA Design System — Legacy Alias Bridge
   ----------------------------------------------------------------------------
   The dashboard's existing CSS (dashboard.css, chat.css, permissions.css,
   terminal.css, …) uses short legacy token names (--p, --e, --pb, --t1, …).
   This file maps every legacy name onto the canonical --icta-* tokens so the
   whole UI adopts the ICTA palette and all three themes WITHOUT rewriting the
   existing rules. Progressive migration: move page CSS to --icta-* over time,
   then delete the matching alias here.

   LOAD ORDER (in base.html):
     1. icta-ds/tokens.css   (defines --icta-*)
     2. icta-ds/bridge.css   (this file — maps legacy → --icta-*)
     3. icta-ds/motion.css   (microinteractions, honors reduced-motion)
     4. css/dashboard.css    (legacy; its own :root is overridden by 1–3 below
                              because this file is linked AFTER it — see note)

   NOTE on cascade: custom-property declarations resolve by source order, so
   this bridge is linked AFTER dashboard.css in <head>. That lets the bridge
   win over dashboard.css's inline :root mapping and, crucially, ADD the sand
   theme the legacy file never defined. Reversible: remove the three <link>s.
   ============================================================================ */

:root {
  /* Brand hues (kept identical to ICTA base palette) */
  --p:  var(--icta-action);        /* primary / action */
  --e:  var(--icta-action-hover);  /* primary hover / emphasis */
  --pb: var(--icta-mint);          /* "primary bright" — badges, accent */
  --pd: var(--icta-navy);          /* "primary deep" — badge bg */

  /* Status */
  --s:  var(--icta-success);
  --w:  var(--icta-warning);
  --d:  var(--icta-danger);
  --i:  var(--icta-info);

  /* Surfaces */
  --bg:  var(--icta-surface);
  --bg2: var(--icta-surface-soft);

  /* Lines / borders */
  --bo:  var(--icta-border);
  --bo2: var(--icta-line);

  /* Text ramp */
  --t1: var(--icta-text-primary);
  --t2: var(--icta-text-secondary);
  --t3: var(--icta-text-tertiary);

  /* Type families */
  --ff: var(--icta-font-sans);
  --fm: var(--icta-font-mono);

  /* Radii used by legacy rules */
  --r:  var(--icta-radius-sm);   /* 8px */
  --rm: var(--icta-radius-md);   /* 12px */
}

/* DARK — legacy file only partially defined these; re-point to ICTA tokens.
   --icta-action already resolves to mint in dark via tokens.css, so --p / --e
   follow automatically. We restate the few that legacy hardcoded. */
[data-theme="dark"] {
  --p:  var(--icta-action);        /* mint in dark */
  --e:  var(--icta-action-hover);  /* cyan in dark */
  --pb: var(--icta-cyan);          /* bright accent reads better on dark */
  --bg2: var(--icta-surface-soft);
}

/* SAND — the legacy file never defined this theme; the bridge supplies it.
   --icta-action is editorial black in sand, so --p resolves to ink. */
[data-theme="sand"] {
  --p:  var(--icta-action);        /* ink */
  --e:  var(--icta-action-hover);  /* blue */
  --pb: var(--icta-mint);
  --pd: var(--icta-navy);
  --bg2: var(--icta-surface-soft);
}
