/* ==========================================================================
   Chart chrome. Every visualisation in the system draws its axis, grid,
   ticks, legend, tooltip, empty state and sample flag from these values —
   that is what makes seven different charts read as one instrument.

   The rules, once:
     · Gridlines are horizontal only, hairline, and there are never more
       than five. Vertical rules are reserved for a single event marker
       ("now"), drawn dashed.
     · There is no drawn axis line. The bottom gridline is the baseline and
       sits one step stronger than the rest.
     · Every plot ends in a hairline rule and a row of mono ticks. Time
       labels and value ticks get the SAME treatment — that row is the
       signature of the family.
     · Values are direct-labelled at the mark. A legend appears only when
       two or more series share a plot.
     · One tooltip, one shape, everywhere.
   ========================================================================== */
:root {
  --chart-grid-w: 1px; /* @kind spacing */
  --chart-grid: var(--sx-grid);
  --chart-baseline: var(--sx-axis);
  --chart-marker: var(--sx-axis);       /* the "now" rule                   */
  --chart-series-w: 2px; /* @kind spacing */
  --chart-dash: 6 5; /* @kind other */   /* modelled / forecast stroke      */
  --chart-marker-dash: 2 4; /* @kind other */
  --chart-flow-dash: 6 18; /* @kind other */ /* direction of data flow      */

  --chart-tick: var(--text-quiet);
  --chart-tick-size: var(--t-caption);
  --chart-tick-gap: var(--sp-3);        /* plot bottom → rule               */
  --chart-tick-pad: var(--sp-2);        /* rule → tick row                  */
  --chart-grid-max: 5; /* @kind other */
  --chart-ticks-max: 6; /* @kind other */
  --chart-ticks-max-mobile: 3; /* @kind other */

  --chart-track: var(--surface-raised); /* every bar sits in one of these   */
  --chart-track-h: 10px; /* @kind spacing */
  --chart-track-h-sm: 6px; /* @kind spacing */

  --chart-plot-h: 220px; /* @kind spacing */
  --chart-plot-h-mobile: 150px; /* @kind spacing */

  --chart-tip-bg: var(--surface-overlay);
  --chart-tip-line: var(--border-strong);
  --chart-tip-pad: 8px 10px; /* @kind spacing */
  --chart-tip-offset: 12px; /* @kind spacing */
}

/* Custom properties resolve where they are declared, so every chart token that
   points at a colour has to be restated when the palette flips. Same
   definitions, paper values. */
[data-theme="paper"] {
  --chart-grid: var(--sx-grid);
  --chart-baseline: var(--sx-axis);
  --chart-marker: var(--sx-axis);
  --chart-tick: var(--text-quiet);
  --chart-track: var(--surface-raised);
  --chart-tip-bg: var(--surface-overlay);
  --chart-tip-line: var(--border-strong);
}
