/* Area chart. Tokens only — no literal colour, radius, duration or ease. */

.area-chart .card__head { align-items: flex-start; }
.area-chart__heading { min-width: 0; }
.area-chart .card__body { display: flex; flex-direction: column; gap: var(--sp-3); }

/* --- range switch: a segmented radiogroup built on the kit's control sizes --- */

.range-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.range-switch__opt {
  height: var(--control-h-sm);
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.range-switch__opt:hover { background: var(--surface-hover); color: var(--ink); }
.range-switch__opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.range-switch__opt[aria-checked="true"] {
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}

/* --- plot --- */

.area-chart__plot {
  position: relative;
  height: 260px;
}
.area-chart__svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  touch-action: pan-y;
}
.area-chart__svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.area-chart__grid line {
  stroke: var(--line);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.area-chart__line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.area-chart__fill { fill: url(#areaChartWash); stroke: none; }

/* Gradient stops read the series token, so the wash follows the theme with no
   JS branch. */
.area-chart__stop--top { stop-color: var(--series-1); stop-opacity: 0.30; }
.area-chart__stop--bottom { stop-color: var(--series-1); stop-opacity: 0; }

.area-chart__cursor { opacity: 0; }
.area-chart__cursor-line {
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.area-chart__cursor-dot {
  fill: var(--series-1);
  stroke: var(--surface);
  stroke-width: 2.5;
}

/* --- readout --- */

.area-chart__readout {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 92px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-overlay);
  box-shadow: var(--shadow-2);
  pointer-events: none;
  white-space: nowrap;
}
.area-chart__readout[hidden] { display: none; }
.area-chart__readout-label {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.area-chart__readout-value {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 600;
}

/* --- axis --- */

.area-chart__axis {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 0 var(--sp-1);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}
.area-chart__axis span { white-space: nowrap; }

@media (max-width: 640px) {
  .area-chart__plot { height: 200px; }
  .area-chart .card__head { flex-wrap: wrap; }
}
