/* LSCharts (js/charts.js): chart palette tokens and the HTML parts around each SVG chart.
 * Colors are the validated categorical slots from the dataviz reference palette (light values, then the
 * same eight hues stepped for the dark surface). Surfaces and text come from the site tokens in brand.css,
 * so the charts follow the site theme automatically. */
:root {
  --ls-c1: #2a78d6; --ls-c2: #eb6834; --ls-c3: #1baf7a; --ls-c4: #eda100;
  --ls-c5: #e87ba4; --ls-c6: #008300; --ls-c7: #6250d6; --ls-c8: #e34948;
  --ls-ink: var(--text, #0e1633); --ls-ink-2: var(--text-2, #3a4568); --ls-muted: var(--muted, #5d6a90);
  --ls-grid: var(--border, rgba(30, 46, 96, 0.12)); --ls-surface: var(--surface, #ffffff);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ls-c1: #3987e5; --ls-c2: #d95926; --ls-c3: #199e70; --ls-c4: #c98500;
    --ls-c5: #d55181; --ls-c6: #008300; --ls-c7: #9085e9; --ls-c8: #e66767;
  }
}
:root[data-theme="dark"] {
  --ls-c1: #3987e5; --ls-c2: #d95926; --ls-c3: #199e70; --ls-c4: #c98500;
  --ls-c5: #d55181; --ls-c6: #008300; --ls-c7: #9085e9; --ls-c8: #e66767;
}

/* figure and header */
.ls-chart { margin: 0 0 18px; padding: 0; min-width: 0; color: var(--text, #0e1633); }
.ls-head { margin-bottom: 8px; }
.ls-title { margin: 0 0 2px; font-size: 1.05rem; font-weight: 700; color: var(--text, #0e1633); }
.ls-sub { margin: 0; font-size: 0.85rem; color: var(--muted, #5d6a90); }

/* legend: buttons toggle series; a dimmed button is hidden */
.ls-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 8px; }
.ls-legend[hidden] { display: none; }
.ls-key { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong, var(--border-strong, rgba(30, 46, 96, 0.24)));
  background: var(--surface, #fff); color: var(--text-2, #3a4568); font: inherit; font-size: 0.8rem; cursor: pointer; }
.ls-key:focus-visible { outline: 2px solid var(--accent, #2f6bff); outline-offset: 2px; }
.ls-key.off { opacity: 0.45; text-decoration: line-through; }
.ls-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* plot */
.ls-plot { position: relative; min-width: 0; border-radius: 12px; outline: none; }
.ls-plot:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring, rgba(47, 107, 255, 0.35)); }
.ls-plot[hidden] { display: none; }
.ls-svg { display: block; width: 100%; height: auto; max-width: 100%; overflow: visible; }
.ls-svg.ls-donut { max-width: 340px; margin: 0 auto; }
.ls-svg .ls-on { stroke: var(--ls-ink); stroke-width: 2; }
.ls-svg text { user-select: none; }

/* hover tooltip */
.ls-tip { position: absolute; z-index: 2; pointer-events: none; max-width: 260px; padding: 7px 10px; border-radius: 9px;
  background: var(--surface, #fff); color: var(--text, #0e1633); border: 1px solid var(--line-strong, rgba(30, 46, 96, 0.24));
  box-shadow: var(--shadow, 0 10px 30px rgba(20, 35, 90, 0.12)); font-size: 0.8rem; line-height: 1.4; }
.ls-tip[hidden] { display: none; }
.ls-tip-line { display: block; }
.ls-tip-line:first-child { font-weight: 700; }

/* tools under the chart */
.ls-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ls-btn { padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line-strong, rgba(30, 46, 96, 0.24)); background: var(--surface, #fff);
  color: var(--text, #0e1633); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.ls-btn:hover { border-color: var(--accent, #2f6bff); }
.ls-btn:focus-visible { outline: 2px solid var(--accent, #2f6bff); outline-offset: 2px; }

/* visually hidden: screen readers get the summary and the data table */
.ls-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
table.ls-sr { position: absolute !important; }
