/* ---------- Charts ---------- */

/* The headings carry no top margin, so the gap between stacked sections has to
   come from the section above. Collapses against .about's own 64px. */
.charts { margin-bottom: 64px; }

.charts h2, .about h2 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0 0 6px;
}
.section-lede { color: var(--color-text-secondary); margin: 0 0 20px; max-width: 640px; }

.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.chart-card {
  margin: 0;
  min-width: 0;
  padding: 20px 20px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--motion-fast) var(--ease-out);
}
/* A chart with one row per model needs the full width to keep 25 labels legible;
   the scatters are happier square. */
.chart-card.wide { grid-column: 1 / -1; }
.chart-card:hover { box-shadow: var(--shadow-2); }
.chart-card figcaption { margin-bottom: 12px; }
.chart-card figcaption strong {
  display: block;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.chart-card figcaption span { display: block; color: var(--color-text-tertiary); font-size: 13px; line-height: 20px; margin-top: 2px; }
.chart-card .metric-toggle { margin-top: 8px; }

.chart-box { position: relative; height: 340px; max-width: 100%; }
.chart-box canvas { max-width: 100%; }
.chart-box.tall { height: 460px; }

/* hammerjs claims one-finger drags by writing touch-action:none inline on the
   canvas, which on a phone would make a column of charts impossible to scroll
   past. These override it (a stylesheet !important beats an inline style) and
   tie the claim to whether there is anything to pan: at full extent a finger
   scrolls the page as usual and the pan the plugin recognizes is clamped to
   nothing, while pan-x/pan-y still keeps the browser's own pinch-zoom off the
   canvas so pinching zooms the chart. Zoomed in, the canvas takes the gesture. */
.chart-box canvas { touch-action: pan-x pan-y !important; }
.chart-box.is-zoomed canvas { touch-action: none !important; }

/* Zoom reset, borrowed from .chip. It only surfaces once a chart has actually
   been moved off its full range, so the cards stay quiet until you explore. */
.chart-reset {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.chart-reset:hover { border-color: var(--color-border-strong); }
.chart-box.is-zoomed .chart-reset { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .chart-box { height: 300px; }
}
