/* ====== CA 2026 CHART TOKENS ======
   Colour roles, type scale, geometry. All --c26- prefixed so nothing here can
   collide with tokens.css or chart.css.

   HOUSE RULE (see charts-CA2026/README.md):
     valence  = yellow positive, red negative
     tradeoff = yellow vs blue, for symmetric choices with no good side
     party is NEVER encoded by hue

   Charts never name a colour. A spec names a SCALE; the scale names a role
   token from this file; the build resolves it. validate.mjs fails any chart
   file containing a raw hex or a legacy --chart-/--color- token.
   ====== */

:root {
  /* ---- Valence: inherent good/bad direction ---- */
  --c26-val-pos-strong:  #D9A528;   /* very favorable, strongly agree   */
  --c26-val-pos:         #EBC84B;   /* somewhat favorable               */
  --c26-val-neg:         #C66D69;   /* somewhat unfavorable             */
  --c26-val-neg-strong:  #A71712;   /* very unfavorable                 */

  /* ---- Trade-off: symmetric choice, neither side is "good" ---- */
  --c26-tr-a-strong:     #D9A528;
  --c26-tr-a:            #EBC84B;
  --c26-tr-a-light:      #FFE173;
  --c26-tr-b-light:      #78B1E0;
  --c26-tr-b:            #5B8BD9;
  --c26-tr-b-strong:     #1436BC;

  /* ---- Neutral: not sure, no opinion, never heard ---- */
  --c26-neutral:         #999999;
  --c26-neutral-light:   #C8C8C8;

  /* ---- Sequential: one ordered quantity ----
     EVERY hex here already exists in the published UK system: the ramp runs
     from the UK track/neutral greys into the three UK yellows. No new colours
     are invented for intensity; that drift happened once (2026-07-31 review)
     and is not to be reintroduced. Plain single-colour bars use --c26-seq-5,
     which IS the UK chart yellow. ---- */
  --c26-seq-1:           #EBEBEB;
  --c26-seq-2:           #C8C8C8;
  --c26-seq-3:           #FFE173;
  --c26-seq-4:           #EBC84B;
  --c26-seq-5:           #D9A528;

  /* ---- Red sequential: ordered intensity on the negative hue ----
     Same provenance rule as above — every hex is a published UK chart
     colour: the UK concern-battery ramp (tokens.css --chart-red-light/
     -pale/-faint, chart.css --chart-red) plus UK --grey-600 for the dark
     neutral. Added 2026-08-11 for the deck's solid use-recency bar. ---- */
  --c26-rseq-5:          #A71712;   /* = UK --chart-red        */
  --c26-rseq-4:          #C66D69;   /* = UK --chart-red-light  */
  --c26-rseq-3:          #D9A09E;   /* = UK --chart-red-pale   */
  --c26-rseq-2:          #EBCFCE;   /* = UK --chart-red-faint  */
  --c26-neutral-dark:    #777777;   /* = UK --grey-600         */

  /* ---- Segments: categorical, no ordering implied ----
     Carried over from CA-2025 --ca-seg-* for series continuity.
     Segments and trade-offs do not co-occur in any planned chart. ---- */
  --c26-seg-alarmed:     #C62828;
  --c26-seg-market:      #E8942D;
  --c26-seg-disengaged:  #5F8A8B;
  --c26-seg-pragmatic:   #2E7D32;
  --c26-seg-hopeful:     #1565C0;

  /* ---- Year pairs: trend charts (2025 vs 2026). Ordered, not valenced. ---- */
  --c26-year-2025:       #C8C8C8;
  --c26-year-2026:       #D9A528;

  /* ---- Structure ---- */
  --c26-axis:            #666666;
  --c26-grid:            #F0F0F0;
  --c26-rule:            #E0E0E0;
  --c26-text:            #585858;
  --c26-value-on-bar:    #FFFFFF;

  /* ---- Type scale: SIX steps, no more ---- */
  --c26-font-title:      clamp(1rem,    1.2vw,  1.15rem);
  --c26-font-subtitle:   clamp(0.78rem, 0.9vw,  0.85rem);
  /* The subtitle as CA 2026 renders it: about two points up on the inherited
     step, so the gap to the question strap below the chart is unmistakable
     (author direction 2026-08-17). The step above stays for anything still
     reading the inherited token. */
  --c26-font-subtitle-lg: clamp(0.9rem,  1.05vw, 1rem);
  --c26-font-label:      clamp(0.78rem, 0.9vw,  0.88rem);
  --c26-font-value:      clamp(0.72rem, 0.85vw, 0.8rem);
  --c26-font-caption:    clamp(0.72rem, 0.82vw, 0.78rem);
  --c26-font-micro:      clamp(0.65rem, 0.75vw, 0.7rem);

  /* ---- Geometry ----
     Value and net columns are sized in ch, tied to the type scale, so they are
     wide enough for their widest real content ("47%", "-24") at EVERY
     viewport. This is the fix for the vw-based cramping in the UK build. ---- */
  --c26-col-value:       4.5ch;
  --c26-col-net:         4.5ch;
  --c26-col-notsure:     4.5ch;
  /* Trailing year-change column ("vs 2025"): wider than net so the
     two-word header fits on one line. */
  --c26-col-change:      6.5ch;
  --c26-col-nsgap:       18px;    /* gutter before the detached NO/NH bar (chart--sd-nsbar) */

  /* Two failure modes, both fixed here.

     (1) The clamp MINIMUM is a floor that cannot shrink, so an inherited
     clamp(180px, 22vw, 300px) resolved to 180px at 375px wide: 48% of the
     screen spent on labels, with the bars crushed into a sliver. Minimums are
     therefore set from the narrow end. Below 560px the label takes its own
     full-width line anyway (see chart-CA2026.css).

     (2) vw measures the VIEWPORT, but what constrains a chart is its CONTAINER.
     The same preset that read 25% of the chart in the wide QA gallery read 43%
     inside the 701px report column at the same viewport width. The preferred
     term is therefore in cqw (1% of the chart's own inline size), which is what
     "size the label column to the space actually available" requires. The vw
     line below is the fallback for engines without container queries; the cqw
     line overrides it wherever they are supported. */
  --c26-label-sm:        clamp(56px,   9vw,  96px);
  --c26-label-md:        clamp(90px,  15vw, 190px);
  --c26-label-lg:        clamp(110px, 24vw, 300px);
}

@supports (width: 1cqw) {
  :root {
    --c26-label-sm:      clamp(56px,  16cqw,  96px);
    --c26-label-md:      clamp(90px,  26cqw, 190px);
    --c26-label-lg:      clamp(110px, 34cqw, 300px);
  }
}

:root {

  --c26-row-gap:         0.35em;
  --c26-bar-h:           1.5em;
  --c26-centre-gap:      2px;

  /* ---- SVG compensation ----
     Set per-SVG by ResizeObserver in the engine copy to
     viewBoxWidth / renderedWidth, so SVG text lands at the same optical size
     as DOM text. The 1 here is the fallback for a non-SVG context. ---- */
  --c26-svg-scale:       1;
}
