/* ==========================================================================
   viz.css — chart chrome.

   Series colours are a validated three-slot categorical palette:
     #0f9d6e green · #e0651c terracotta · #2a78d6 blue
   Checked with the dataviz validator in BOTH modes against this site's
   surfaces, all-pairs: lightness band, chroma floor, CVD separation
   (worst ΔE 10.4), normal-vision floor (worst ΔE 21.7) and 3:1 contrast
   all pass with no warnings. The same hexes clear both bands, so light and
   dark share them. Do not add a fourth slot without re-running the validator.
   ========================================================================== */

.viz {
  --surface:     var(--paper-raised);
  --grid:        color-mix(in srgb, var(--ink) 9%, transparent);
  --axis-text:   var(--ink-faint);
  --label-text:  var(--ink-soft);

  --series-1: #0f9d6e;
  --series-2: #e0651c;
  --series-3: #2a78d6;

  position: relative;
}

.viz svg { display: block; width: 100%; height: auto; overflow: visible; }

.viz text { font-family: var(--font-body); }
.viz .viz-axis  { font-size: 11px; fill: var(--axis-text); font-variant-numeric: tabular-nums; }
.viz .viz-label { font-size: 11.5px; fill: var(--label-text); font-weight: 600; }
.viz .viz-grid  { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }

.viz .viz-line  { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .viz-area  { stroke: none; }
.viz .viz-dot   { stroke: var(--surface); stroke-width: 2; }

/* Bars: rounded data-end, separated by a surface-coloured gap rather than a border. */
.viz .viz-bar   { rx: 4; ry: 4; }
.viz .viz-track { fill: color-mix(in srgb, var(--ink) 6%, transparent); rx: 4; ry: 4; }

.viz-hit { fill: transparent; cursor: crosshair; }

.viz-tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--ink); color: var(--paper);
  padding: .4rem .6rem; border-radius: var(--r-sm);
  font-size: .78rem; line-height: 1.45; white-space: nowrap;
  box-shadow: var(--shadow-md); opacity: 0; transition: opacity .12s;
}
.viz-tooltip[data-show="true"] { opacity: 1; }
.viz-tooltip b { font-weight: 650; }
.viz-crosshair { stroke: var(--ink-faint); stroke-width: 1; }

.viz-legend {
  display: flex; flex-wrap: wrap; gap: .45rem 1rem;
  font-size: .8rem; color: var(--ink-soft); margin-bottom: .7rem;
}
.viz-legend span { display: inline-flex; align-items: center; gap: .38rem; }
.viz-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.viz-head {
  display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: .3rem;
}
.viz-head h3 { margin: 0; font-size: 1.02rem; }
.viz-head .viz-sub { font-size: .82rem; color: var(--ink-faint); }
.viz-head .viz-toggle { margin-left: auto; }

.viz-toggle {
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-soft);
  font-size: .74rem; padding: .18rem .55rem; border-radius: 999px; cursor: pointer;
}
.viz-toggle:hover { background: var(--paper-sunk); color: var(--ink); }

/* Every chart ships a table twin — the WCAG-clean way to read the same values. */
.viz-table { margin-top: .6rem; }
.viz-table table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.viz-table th, .viz-table td {
  text-align: left; padding: .32rem .5rem; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.viz-table th { font-weight: 650; color: var(--ink-faint); font-size: .72rem;
                text-transform: uppercase; letter-spacing: .05em; }
.viz-table td.num, .viz-table th.num { text-align: right; }
