.chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.chart__frame {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 190px auto;
  column-gap: var(--space-2);
}

.chart__axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  margin: -7px 0;
  font-size: var(--text-xs);
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.chart__plot {
  position: relative;
  min-width: 0;
  cursor: crosshair;
  touch-action: pan-y;
}

.chart__plot:focus-visible {
  outline-offset: 4px;
}

.chart__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart__grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.chart__baseline {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.chart__line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart__line--compare {
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.chart__area,
.chart__bar {
  stroke: none;
}

.chart__crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -0.5px;
  background: var(--color-faint);
  pointer-events: none;
}

.chart__crosshair--band {
  width: 2px;
  margin-left: -1px;
  background: var(--color-ink);
  opacity: 0.25;
}

.chart__dot {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border: 2px solid var(--color-page);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 0 1px var(--color-divider);
  pointer-events: none;
}

.chart__ticks {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  padding-top: 6px;
  font-size: var(--text-xs);
  color: var(--color-muted);
  white-space: nowrap;
}

.chart__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-body);
}

.chart__key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart__swatch {
  width: 14px;
  height: 2px;
}

.chart__swatch--compare {
  height: 0;
  border-top: 2px dashed var(--chart-compare);
  background: transparent;
}

.chart__readout {
  margin-left: auto;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

.chart__data > summary {
  width: fit-content;
  font-size: var(--text-xs);
  color: var(--color-muted);
  cursor: pointer;
}

.chart__data[open] > summary {
  margin-bottom: var(--space-2);
}

.series-primary {
  stroke: var(--chart-primary);
  fill: var(--chart-primary);
  background: var(--chart-primary);
}

.series-compare {
  stroke: var(--chart-compare);
  fill: var(--chart-compare);
  background: var(--chart-compare);
}

.series-second {
  stroke: var(--chart-second);
  fill: var(--chart-second);
  background: var(--chart-second);
}

.series-third {
  stroke: var(--chart-third);
  fill: var(--chart-third);
  background: var(--chart-third);
}

.chart__line.series-primary,
.chart__line.series-compare,
.chart__line.series-second,
.chart__line.series-third {
  fill: none;
}

.chart__area.series-primary {
  fill: var(--chart-primary-fill);
  stroke: none;
}

.mini-chart {
  display: block;
  width: 100%;
  height: 32px;
}

.mini-chart__line {
  fill: none;
  stroke: var(--chart-primary);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.mini-chart__compare {
  fill: none;
  stroke: var(--chart-compare);
  stroke-width: 1.25;
  stroke-dasharray: 3 3;
}
