/* BackgammonX v0.2.23 — 20-x23-charts.css (v1.0.5: the four charts shown together)
   Owns: the look of the Game Charts section built by js/35-x23-charts.js — v1.0.5: the four chart cards
   (Pip race, Dice fortune, Borne-off race, Hit battle), two by two on a wide page and one under another on a
   narrow one, each with its framed SVG chart, its key and the line of words that reads it (the four-button
   picker of earlier versions is gone: every chart is always shown).

   PRESENTATION ONLY, and override-only: this file sits after css/19 and never edits
   css/01-19. Every rule's SUBJECT (the right-most compound selector) is one of this file's own
   classes (.bgx-chart*) and nothing here sizes, positions or transforms the board, the
   checkers, the rails, the hit targets, the dice layers or the rotation stage. The section is
   ordinary page content inside the stack that js/28 owns; its surfaces, lines and text come
   from the --x-* tokens of css/16 (so Dark and Light follow without a second set of rules),
   and its two lines come from the player-colour tokens js/24 publishes.

   Colour is never the only cue: the first player's line is solid with a round marker and the
   second player's is dashed with a square marker, and the key names both. Each line is drawn
   twice — a wider edge in the player's checker-border colour under a narrower line in the
   checker colour — exactly how the checkers themselves stay readable (a light edge for a
   black checker, a dark edge for a white one), so every colour choice keeps a boundary of at
   least 3:1 against the chart on both pages. */

:root { --bgx-css-20: 1; }

/* A rule that sets `display` must not defeat the hidden attribute. */
.bgx-chart[hidden],
.bgx-chart-empty[hidden],
.bgx-chart-frame[hidden],
.bgx-chart-legend[hidden],
.bgx-chart-readout[hidden] { display: none; }

.bgx-charts { color: var(--text); }

/* ── v1.0.5: the four cards ──────────────────────────────────────────── */
/* One column on a narrow page; two by two from 900px (the order is the reading order either way: Pip race, Dice fortune,
   Borne-off race, Hit battle). Each card keeps the chart's own readable size; the section grows and the page scrolls. */
.bgx-chart-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 0;
}
@media (min-width: 900px) {
  .bgx-chart-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.bgx-chart-name {
  margin: 0;
  font-family: var(--x-font-serif);
  font-size: calc(1.0625rem * var(--text-scale, 1));
  font-weight: 700;
  line-height: 1.3;
  color: var(--x-gold-bright);
}
.bgx-chart-name:focus { outline: none; }
.bgx-chart-name:focus-visible { outline: 2px solid var(--x-focus); outline-offset: 2px; }
/* the card a chart link asked for (Play & Insights → Pip Race, …) keeps a gold edge; the other three stay as they are */
.bgx-chart[data-revealed="true"] { border-color: var(--x-gold); }
html[data-appearance="light"] .bgx-chart[data-revealed="true"] { border-color: #7a5200; }
.bgx-chart-actions { margin-top: 10px; }

/* ── The chart ──────────────────────────────────────────────────────── */
.bgx-chart-empty {
  margin: 0;
  padding: 12px;
  font-size: 13.5px;
  color: var(--text-muted);
  border: 1px dashed var(--x-line);
  border-radius: var(--x-radius-sm);
}
.bgx-chart {
  min-width: 0;
  max-width: 720px;          /* a card is never wider than the chart's widest picture */
  margin: 0;
  padding: 12px;
  border: 1px solid var(--x-line-soft);
  border-radius: var(--x-radius-sm);
  background-color: var(--x-panel);
}
.bgx-chart-head { display: block; margin: 0 0 2px; }
.bgx-chart-title {
  display: block;
  margin: 2px 0 2px;
  font-size: calc(0.875rem * var(--text-scale, 1));
  font-weight: 700;
  color: var(--x-text);
}
.bgx-chart-hint { margin: 0 0 8px; font-size: calc(0.8125rem * var(--text-scale, 1)); color: var(--text-muted); }
.bgx-chart-frame {
  box-sizing: border-box;
  overflow-x: auto;
  border: 1px solid var(--x-line-soft);
  border-radius: var(--x-radius-sm);
  background-color: var(--x-panel-2);
  touch-action: pan-y;
}
.bgx-chart-frame:focus-visible { outline: 2px solid var(--x-focus); outline-offset: 2px; }
.bgx-chart-svg { display: block; max-width: none; }

.bgx-chart-gridline { stroke: var(--x-line-soft); stroke-width: 1; }
.bgx-chart-zero { stroke: var(--x-line); stroke-width: 1.5; }
.bgx-chart-axis { stroke: var(--x-line); stroke-width: 1; }
.bgx-chart-tick,
.bgx-chart-axis-title {
  fill: var(--text-muted);
  font-family: inherit;
  font-size: calc(11px * var(--text-scale, 1));
  font-variant-numeric: tabular-nums;
}

/* One line per player: a wider edge under a narrower line. The second player's line is dashed. */
.bgx-chart-casing { fill: none; stroke-width: 5.5; stroke-linejoin: round; stroke-linecap: round; }
.bgx-chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.bgx-chart-casing[data-side="P1"] { stroke: var(--bgx-p1-border, rgba(10, 30, 55, 0.55)); }
.bgx-chart-line[data-side="P1"] { stroke: var(--bgx-p1-mid, #62b5ff); }
.bgx-chart-casing[data-side="P2"] { stroke: var(--bgx-p2-border, rgba(55, 10, 15, 0.55)); stroke-dasharray: 7 5; stroke-linecap: butt; }
.bgx-chart-line[data-side="P2"] { stroke: var(--bgx-p2-mid, #ff6675); stroke-dasharray: 7 5; stroke-linecap: butt; }

/* The marker of the turn being read (the latest turn unless the reader has moved), and its guide. */
.bgx-chart-marker { stroke-width: 1.8; }
.bgx-chart-marker[data-side="P1"] { fill: var(--bgx-p1-mid, #62b5ff); stroke: var(--bgx-p1-border, rgba(10, 30, 55, 0.55)); }
.bgx-chart-marker[data-side="P2"] { fill: var(--bgx-p2-mid, #ff6675); stroke: var(--bgx-p2-border, rgba(55, 10, 15, 0.55)); }
.bgx-chart-guide { stroke: var(--x-text-faint); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }

/* ── The key and the readout ────────────────────────────────────────── */
.bgx-chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 0; padding: 0; list-style: none; }
.bgx-chart-legend-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bgx-chart-swatch { flex: none; }
.bgx-chart-legend-name { min-width: 0; overflow-wrap: anywhere; font-size: calc(0.8125rem * var(--text-scale, 1)); font-weight: 700; color: var(--x-text); }
.bgx-chart-readout {
  line-height: 1.5;
  min-height: 3em;           /* room for two lines, so the page below does not jump between a one-line and a two-line reading */
  margin: 8px 0 0;
  font-size: calc(0.875rem * var(--text-scale, 1));
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  color: var(--x-text);
}
