/**
 * Relay meaning-contract palette (playbook §6).
 *
 * These values are SOLVED, not chosen: scratch/solve-palette.mjs searches the
 * lightness assignment that maximises the worst-case CIEDE2000 separation across
 * normal, deuteranopic, protanopic and tritanopic vision, subject to each band
 * clearing 3:1 on its own surface. scratch/validate-palette.mjs is the gate.
 *
 *   light theme — worst separation dE 19.4 (replied/dropped @deutan)
 *   dark theme  — worst separation dE 24.0 (replied/dropped @deutan)
 *   gate        — dE >= 12
 *
 * Do not hand-edit a value here. Change the solver's constraints, re-run it,
 * and paste the result — otherwise the numbers above stop being true.
 *
 * ---------------------------------------------------------------------------
 * THE CONTRACT
 *
 * Chart bands (--viz-band-*) are the four states a viewer must tell apart with
 * NO text: not started, in flight, replied, dropped. Use them for the hero flow,
 * funnel segments and stacked bars. Never introduce a fifth band — the drop-out
 * reasons live one layer down (playbook §3), which is where they belong.
 *
 * Chips (--viz-chip-*) ALWAYS render their own label. Colour is reinforcement,
 * so they are validated for contrast only. Never use a chip hue as an unlabeled
 * chart segment: they are not separated from each other under colour blindness.
 * ---------------------------------------------------------------------------
 */

:root {
  /**
   * Text and glyphs sitting ON the accent fill. The accent stays a mid-blue in
   * both themes, so this does not flip with the theme — deriving it from
   * --surface would put dark text on a mid-blue chip in dark mode.
   */
  --on-accent: #ffffff;

  /* --- chart bands: unlabeled, fully separated ------------------------- */
  --viz-band-scheduled: #b4b6bd; /* nothing has happened yet — always labelled */
  --viz-band-inflight:  #014ea1; /* moving through a sequence */
  --viz-band-replied:   #4ba34b; /* the win */
  --viz-band-dropped:   #9a0621; /* bounced, unsubscribed or complained */

  --viz-band-scheduled-bg: rgba(180, 182, 189, 0.14);
  --viz-band-inflight-bg:  rgba(1, 78, 161, 0.10);
  --viz-band-replied-bg:   rgba(75, 163, 75, 0.12);
  --viz-band-dropped-bg:   rgba(154, 6, 33, 0.10);

  /* --- mailbox health: SHAPE first, colour second ----------------------
   * Four states including green/amber/red cannot be told apart by colour alone:
   * under deuteranopia all three collapse onto the yellow axis, and white's
   * contrast budget leaves too little lightness range to separate them (the
   * solver's best was dE 10.5 against a bar of 12).
   *
   * So health is encoded by SHAPE, and colour only reinforces it:
   *     active  = filled disc        warming = half-filled disc
   *     paused  = hollow ring        blocked = ring with a diagonal slash
   * Builders: never render a health dot without its shape. Colour alone is a
   * defect here, not a style choice.
   */
  --viz-mbx-paused:  #8a8a96;
  --viz-mbx-active:  #1f9e3a;
  --viz-mbx-warming: #b17504;
  --viz-mbx-blocked: #b81f1f;

  /* --- chips: always carry text --------------------------------------- */
  --viz-chip-opened:         #0f8a99;
  --viz-chip-clicked:        #7c4ddb;
  --viz-chip-interested:     #1f9e3a;
  --viz-chip-question:       #0f8a99;
  --viz-chip-referral:       #1f6fd0;
  --viz-chip-ooo:            #75757f;
  --viz-chip-wrong-person:   #a8730a;
  --viz-chip-not-interested: #7c4ddb;
  --viz-chip-unsubscribe:    #a81f1f;

  --viz-chip-opened-bg:         rgba(15, 138, 153, 0.10);
  --viz-chip-clicked-bg:        rgba(124, 77, 219, 0.10);
  --viz-chip-interested-bg:     rgba(31, 158, 58, 0.12);
  --viz-chip-question-bg:       rgba(15, 138, 153, 0.10);
  --viz-chip-referral-bg:       rgba(31, 111, 208, 0.10);
  --viz-chip-ooo-bg:            rgba(117, 117, 127, 0.12);
  --viz-chip-wrong-person-bg:   rgba(168, 115, 10, 0.12);
  --viz-chip-not-interested-bg: rgba(124, 77, 219, 0.10);
  --viz-chip-unsubscribe-bg:    rgba(168, 31, 31, 0.10);

  /* --- ordered ramps: monotonic in L*, exempt from the dE gate --------- */
  --viz-ramp-send-1: #b9c9ea; /* queued */
  --viz-ramp-send-2: #5a93de; /* sent */
  --viz-ramp-send-3: #1f6fd0; /* delivered */
  --viz-ramp-drop-1: #c9564f; /* unsubscribed */
  --viz-ramp-drop-2: #a81f1f; /* complained */
}

/* Dark theme re-derives every value — never auto-inverted (playbook §1). */
:root[data-theme='dark'] {
  --viz-band-scheduled: #3c3d43;
  --viz-band-inflight:  #3666bc;
  --viz-band-replied:   #8ee689;
  --viz-band-dropped:   #c53b40;

  --viz-band-scheduled-bg: rgba(60, 61, 67, 0.55);
  --viz-band-inflight-bg:  rgba(54, 102, 188, 0.18);
  --viz-band-replied-bg:   rgba(142, 230, 137, 0.14);
  --viz-band-dropped-bg:   rgba(197, 59, 64, 0.16);

  --viz-mbx-paused:  #67686e;
  --viz-mbx-active:  #9ef097;
  --viz-mbx-warming: #cf8e28;
  --viz-mbx-blocked: #bc383d;

  --viz-chip-opened:         #3fc9dc;
  --viz-chip-clicked:        #a98bf0;
  --viz-chip-interested:     #5fd06f;
  --viz-chip-question:       #3fc9dc;
  --viz-chip-referral:       #6fa3ea;
  --viz-chip-ooo:            #9a9aa4;
  --viz-chip-wrong-person:   #f0bb46;
  --viz-chip-not-interested: #a98bf0;
  --viz-chip-unsubscribe:    #e05c5c;

  --viz-chip-opened-bg:         rgba(63, 201, 220, 0.14);
  --viz-chip-clicked-bg:        rgba(169, 139, 240, 0.14);
  --viz-chip-interested-bg:     rgba(95, 208, 111, 0.14);
  --viz-chip-question-bg:       rgba(63, 201, 220, 0.14);
  --viz-chip-referral-bg:       rgba(111, 163, 234, 0.14);
  --viz-chip-ooo-bg:            rgba(154, 154, 164, 0.16);
  --viz-chip-wrong-person-bg:   rgba(240, 187, 70, 0.14);
  --viz-chip-not-interested-bg: rgba(169, 139, 240, 0.14);
  --viz-chip-unsubscribe-bg:    rgba(224, 92, 92, 0.14);

  --viz-ramp-send-1: #2b4468;
  --viz-ramp-send-2: #3f7ac4;
  --viz-ramp-send-3: #6fa3ea;
  --viz-ramp-drop-1: #8e3733;
  --viz-ramp-drop-2: #e05c5c;
}
