/* Figures for "The Strategy Belongs at the Bottom": four live simulations and
   a network figure. Colours come from the chart tokens through chart-theme.js,
   so nothing here repeats a hex value. */

.fig-controls { row-gap: 0.6rem; }

.fig-slider {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-right: auto;          /* buttons sit at the far edge */
  color: var(--text-soft);
}
.fig-slider input[type="range"] { width: 9rem; margin: 0; }
.fig-slider output {
  min-width: 2.6em;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart > canvas.fig-canvas {
  background: var(--bg-sunken);
  border-radius: 8px;
}

.fig-readout {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 1.2rem;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-soft);
}
.fig-readout b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Inline legend at the end of a readout line. */
.fig-keys {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  margin-left: auto;
  color: var(--muted);
}
.fig-keys span { display: inline-flex; align-items: center; gap: 0.35rem; }
.fig-keys i {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 2px;
  flex: none;
}

/* Line keys mirror line marks, in legends and tooltips alike. */
.chart-legend i.line,
.fig-keys i.line { width: 0.95rem; height: 2px; border-radius: 1px; }
.fig-tip-key {
  display: inline-block;
  width: 0.8rem;
  height: 2px;
  border-radius: 1px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.fig-plot svg,
.fig-curve svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* The network figure: the same network twice, then the curve. */
.fig-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.fig-panel { min-width: 0; }
.fig-panel svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg-sunken);
  border-radius: 8px;
}
.fig-panel-label {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 0.4rem;
}
.fig-panel-label b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.fig-curve { margin-top: 1.1rem; }

/* The vaccine figure: three runs side by side, each with its own trace. */
.fig-panels.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.chart-legend i.dot { border-radius: 50%; }
.fig-panel svg.fig-spark {
  background: none;
  border-radius: 0;
  margin-top: 0.4rem;
  overflow: visible;
}

@media (max-width: 34rem) {
  .fig-panels,
  .fig-panels.three { grid-template-columns: 1fr; gap: 0.9rem; }
  .fig-slider { width: 100%; margin-right: 0; }
  .fig-slider input[type="range"] { flex: 1; width: auto; }
  .fig-keys { margin-left: 0; }
}
