/* ==========================================================================
   Charts — thin marks, recessive chrome, the data is the only loud thing.
   Text always wears text tokens, never a series color.
   ========================================================================== */

.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 6px; }

.ax text, .tick {
  font-family: var(--font-mono);
  font-size: 10.5px;
  fill: var(--muted);
  font-variant-numeric: tabular-nums;
}
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }

.series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-area { stroke: none; opacity: 0.1; }
.forecast-line { fill: none; stroke-width: 2; stroke-dasharray: 5 4; stroke-linecap: round; opacity: 0.8; }
.forecast-band { stroke: none; opacity: 0.1; }
.crosshair { stroke: var(--ink-2); stroke-width: 1; opacity: 0; pointer-events: none; shape-rendering: crispEdges; }
.chart.hovering .crosshair { opacity: 0.5; }
.hover-dot { stroke: var(--surface); stroke-width: 2; opacity: 0; pointer-events: none; }
.chart.hovering .hover-dot { opacity: 1; }
.end-dot { stroke: var(--surface); stroke-width: 2; }
.end-label { font-family: var(--font-body); font-size: 12px; font-weight: 600; fill: var(--ink); }
.note-marker { fill: var(--ink); cursor: pointer; }
.note-rule { stroke: var(--ink-2); stroke-width: 1; opacity: 0.35; }
.today-rule { stroke: var(--line-strong); stroke-width: 1; }

.bar { transition: opacity var(--t-fast) var(--ease), filter var(--t-fast) var(--ease); }
.mark-hit { fill: transparent; cursor: pointer; }
.mark-group { outline: none; }
.mark-group:hover .bar, .mark-group:focus-visible .bar { filter: brightness(1.12) saturate(1.05); }
.mark-group:focus-visible .mark-hit { stroke: var(--focus); stroke-width: 2; }
.chart.has-pick .mark-group:not(.picked) .bar { opacity: 0.35; }
.bar-label { font-family: var(--font-body); font-size: 12px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.bar-cat { font-family: var(--font-body); font-size: 12.5px; fill: var(--ink-2); }

.cell { transition: filter var(--t-fast) var(--ease); }
.mark-group:hover .cell, .mark-group:focus-visible .cell { filter: brightness(1.15); stroke: var(--ink); stroke-width: 1.5; }

.slice { transition: transform var(--t-med) var(--ease), opacity var(--t-fast) var(--ease); transform-origin: center; }
.mark-group:hover .slice, .mark-group:focus-visible .slice { transform: scale(1.04); }
.donut-center-v { font-family: var(--font-display); font-weight: 800; font-size: 24px; fill: var(--ink); }
.donut-center-k { font-family: var(--font-body); font-size: 11.5px; fill: var(--muted); }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-key { width: 14px; height: 2px; border-radius: 2px; }
.legend-key.box { width: 10px; height: 10px; border-radius: 3px; }
.legend-key.dash { background: none !important; border-top: 2px dashed; height: 0; }

.donut-wrap { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 420px) { .donut-wrap { grid-template-columns: 1fr; } }
.donut-legend { display: flex; flex-direction: column; gap: 2px; }
.donut-legend button {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.donut-legend button:hover { background: var(--surface-2); }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .val { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }

.heat-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.heat-legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }

/* tooltip — values lead, labels follow */
.tip {
  position: fixed;
  z-index: 120;
  min-width: 140px;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-3);
  font-size: 12.5px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 90ms linear, transform 90ms linear;
}
.tip.show { opacity: 1; transform: none; }
.tip-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-family: var(--font-mono); }
.tip-row { display: grid; grid-template-columns: 12px auto 1fr; align-items: center; gap: 6px; line-height: 1.7; }
.tip-row .key { width: 12px; height: 2px; border-radius: 2px; }
.tip-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.tip-row .nm { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-note { margin-top: 6px; color: var(--ink-2); font-size: 12px; line-height: 1.4; }
.tip-hint { margin-top: 6px; font-size: 11px; color: var(--muted); }

/* small multiples (topic trends) */
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.multiple {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.multiple:hover { border-color: var(--ink-2); transform: translateY(-1px); }
.multiple .m-name { font-weight: 600; font-size: 13.5px; }
.multiple .m-val { font-size: 12px; color: var(--muted); }
.multiple svg { margin-top: 6px; width: 100%; height: 36px; }

@media (forced-colors: active) {
  .series-line, .forecast-line { stroke: CanvasText; }
  .bar, .cell, .slice { fill: Highlight; }
}
