/* Figures: the live map, the live charts and the day charts, as paper figure sheets (the lab look of
   jasperhaynes.com). Loads after /style.css (scripts/head.mjs) and takes over its map and chart rules.
   Colours only through var() tokens, so every figure follows the theme and the pen.

   Meaning inside a figure: --ink is "all planes", the pen is only "airline flights", --muted is
   "other planes" and "a week earlier". Status colours never appear in a figure. Every series also
   differs by shape (upper or lower line, line weight, dashes, dots, square size), and the keys and
   captions name that shape, never a colour. */

/* ---------- Map ---------- */
/* The canvas paints the card sheet itself (public/map.js reads the tokens), so no edge of its own:
   the .fig-sheet around it is the frame. */
.map-canvas { border: 0; border-radius: 0; background: var(--card); }

/* ---------- Charts (public/chart.js and the day pages) ---------- */
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-axis { fill: var(--muted); font: 400 11px var(--mono); }
.chart-total,
.chart-airline { fill: none; stroke-linejoin: round; stroke-linecap: round; }
/* All planes thin and on top, airline flights thick underneath: where the two lines meet, the ink
   line still shows inside the pen line, so the weight tells them apart, not only the colour. */
.chart-total { stroke: var(--ink); stroke-width: 1.5; }
.chart-airline { stroke: var(--pen); stroke-width: 3.5; }
.chart-archive { stroke-dasharray: 5 4; stroke-linecap: butt; }
.chart-normal { fill: var(--muted); stroke: none; }
/* The stop and the lift: thin dotted ink lines (a different rhythm from the dashed archive), each
   running up to its label in the band above the plot (public/chart.js places them). */
.chart-stop { stroke: var(--ink); stroke-width: 1.25; stroke-dasharray: 1.5 3.5; stroke-linecap: round; }
/* Mono labels with a halo of the sheet colour. */
.chart-stop-label {
  fill: var(--ink);
  font: 500 11px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* ---------- Keys: drawn swatches and words ---------- */
.fig-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font: 400 12.5px/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}
.fig-key li { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 0; }
.fig-key li::before { content: none; }
.fig-key svg { flex: none; display: block; overflow: visible; }
.key-plane-airline { fill: var(--pen); }
.key-plane-other { fill: var(--muted); }

/* ---------- Day pages (scripts/build-static.mjs) ---------- */
/* The SVG is 600 viewBox units wide and scales with the column, so line widths stay in screen
   pixels (non-scaling) and text sizes are in viewBox units, set in steps so the labels stay
   between about 11 and 15 screen pixels: 26 units on a phone (the SVG is about 253px wide at
   320 and 308px at 375), 20 from 440px, 16 from 560px, 13 from 660px (about 690px wide at most).
   scripts/build-static.mjs places the stop and lift labels for the largest size. */
.fig-sheet.day-chart-wrap { background: var(--card); }
.day-chart { display: block; width: 100%; height: auto; font-family: var(--mono); }
.day-chart .chart-grid,
.day-chart .chart-total,
.day-chart .chart-airline,
.day-chart .chart-stop { vector-effect: non-scaling-stroke; }
.day-chart .chart-axis,
.day-chart .chart-stop-label { font-size: 26px; }
.day-chart .chart-stop-label { stroke-width: 6px; }
/* Five times along the bottom from 660px, three (first, middle, last) below. */
.day-chart .chart-axis-extra { display: none; }
@media (min-width: 440px) {
  .day-chart .chart-axis,
  .day-chart .chart-stop-label { font-size: 20px; }
}
@media (min-width: 560px) {
  .day-chart .chart-axis,
  .day-chart .chart-stop-label { font-size: 16px; }
  .day-chart .chart-stop-label { stroke-width: 5px; }
}
@media (min-width: 660px) {
  .day-chart .chart-axis,
  .day-chart .chart-stop-label { font-size: 13px; }
  .day-chart .chart-stop-label { stroke-width: 4px; }
  .day-chart .chart-axis-extra { display: inline; }
}

/* ---------- Forced colours (Windows high contrast) ---------- */
/* The sheet turns into the system background there, but SVG strokes and fills keep their tokens,
   so the figures take the system colours instead: the text colour for ink, the highlight for the
   airline series. System colour keywords are the only colours this block may use. */
@media (forced-colors: active) {
  .chart-total, .chart-stop { stroke: CanvasText; }
  .chart-airline { stroke: Highlight; }
  .chart-axis, .chart-normal, .key-plane-other { fill: CanvasText; }
  .key-plane-airline { fill: Highlight; }
  .chart-stop-label { fill: CanvasText; stroke: Canvas; }
}
