/* ==========================================================================
   ToxBench charts

   Figures carry the numbers; prose appears only where a number cannot say it.
   Paint for SVG elements is set in style="" attributes by charts.js and never
   here, because a rule in this file would outrank a presentation attribute.
   ========================================================================== */

figure { margin: 0; }

.chart-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2rem;
  margin-top: 1.25rem;
}
.chart-row > .chart-text { flex: 1 1 15rem; min-width: 0; }

.chart-headline {
  font-size: 1.3125rem;
  font-weight: 640;
  letter-spacing: -0.018em;
  line-height: 1.22;
}
.chart-headline em {
  font-style: normal;
  color: color-mix(in srgb, var(--tone, var(--c-pink)) 62%, var(--text));
}
.chart-sub {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-2);
  letter-spacing: 0.002em;
}
.chart-caption {
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.01em;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.875rem;
  font-size: 0.75rem;
  color: var(--text-2);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 0.4375rem; }
.chart-legend i {
  width: 0.625rem; height: 0.625rem; border-radius: 50%;
  display: inline-block; flex: none;
}
.chart-legend b { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

/* ---- fitness rings ------------------------------------------------------ */
.ringset { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; flex: none; }
.ringset-plot { position: relative; }
.ringset-plot svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ringset-plot circle { fill: none; }
.ringset-mid {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.ringset-mid b { font-size: 1.625rem; font-weight: 660; }
.ringset-mid i { font-style: normal; font-size: 0.875rem; font-weight: 560; color: var(--text-3); }
.ringset figcaption {
  font-size: 0.6875rem; font-weight: 580; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-3);
}

/* two triads plus the measures they share */
.ringcompare {
  margin-top: 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 1.25rem 2.25rem;
}
.ring-legend {
  flex: 1 1 15rem; min-width: 0;
  display: grid; gap: 0.5rem;
  font-size: 0.75rem; color: var(--text-2);
}
.ring-legend span {
  display: grid; grid-template-columns: 0.625rem minmax(0, 1fr) 2.25rem 0.75rem 2.25rem;
  align-items: center; gap: 0.5rem;
}
.ring-legend i {
  width: 0.625rem; height: 0.625rem; border-radius: 50%; display: inline-block;
}
.ring-legend b {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 0.75rem; font-weight: 620; text-align: right;
}
.ring-legend em { font-style: normal; color: var(--text-3); text-align: center; }

/* ---- waffle ------------------------------------------------------------- */
.waffle { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.waffle-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  width: 8.25rem;
  flex: none;
}
.waffle-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: color-mix(in srgb, var(--neutral) 15%, transparent);
  display: block;
}
.waffle-cell.is-on {
  background: linear-gradient(145deg,
    color-mix(in srgb, #fff 22%, var(--cell)) 0%, var(--cell) 70%);
  box-shadow: 0 0 8px -2px var(--cell);
  opacity: 0;
}
.waffle figcaption { min-width: 0; flex: 1 1 9rem; }
.waffle figcaption b {
  font-size: 1.875rem; font-weight: 660; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--tone) 58%, var(--text));
}
.waffle figcaption i {
  font-style: normal; font-size: 1.0625rem; font-weight: 560;
  color: color-mix(in srgb, var(--tone) 50%, var(--text-3));
}
.waffle figcaption span {
  display: block; font-size: 0.875rem; color: var(--text-2);
  letter-spacing: 0.002em; line-height: 1.45; margin-top: 0.125rem;
}
.waffle figcaption small {
  display: block; font-size: 0.75rem; color: var(--text-3); margin-top: 0.25rem;
}

/* ---- grouped columns ---------------------------------------------------- */
.columns { margin-top: 1rem; }
.col-plot {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 1.25rem;
  padding-bottom: 0.125rem;
  border-bottom: 1px solid var(--line);
}
.col-group {
  flex: 1 1 0; min-width: 0;
  /* Without a ceiling, three bins across a wide card give blocks wider than
     they are tall, which reads as a stretched chart rather than a bar. */
  max-width: 10rem;
  display: flex; flex-direction: column; gap: 0.4375rem;
}
.col-stack { display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.col-bar {
  flex: 1 1 0; min-width: 0; max-width: 2.75rem; height: 0;
  background: linear-gradient(180deg, var(--tone) 0%,
    color-mix(in srgb, var(--tone) 48%, transparent) 100%);
  border-radius: 7px 7px 3px 3px;
  position: relative;
  min-height: 2px;
  box-shadow: 0 0 18px -6px var(--tone);
}
.col-bar b {
  position: absolute; left: 50%; bottom: calc(100% + 3px);
  transform: translateX(-50%);
  font-size: 0.625rem; font-weight: 600; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  pointer-events: none;
}
.col-label {
  font-size: 0.6875rem; text-align: center; color: var(--text-3);
  letter-spacing: 0.01em; font-variant-numeric: tabular-nums;
}

/* ---- line chart --------------------------------------------------------- */
.linechart { margin-top: 1rem; }
.line-wrap { display: flex; gap: 0.5rem; align-items: stretch; }
.line-axis {
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 0.625rem; color: var(--text-3); text-align: right;
  font-variant-numeric: tabular-nums; flex: none; padding: 0.375rem 0 0.25rem;
  width: 1.75rem;
}
/* The viewBox is written to match this element's pixel width, so the drawing
   is 1:1. Never give this preserveAspectRatio="none": it turns the ring
   markers into ellipses and smears the reference label sideways. */
.line-svg { flex: 1 1 auto; width: 100%; min-width: 0; height: 140px; overflow: visible; }
.line-reflabel { font-size: 9px; fill: var(--text-3); font-family: var(--mono); }
.line-dot { transform-box: fill-box; transform-origin: center; }
.line-labels {
  display: flex; margin-top: 0.375rem; padding-left: 2.25rem;
  font-size: 0.6875rem; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.line-labels span { flex: 1 1 0; text-align: center; min-width: 0; }
.line-labels span:first-child { text-align: left; }
.line-labels span:last-child { text-align: right; }

/* ---- donut -------------------------------------------------------------- */
.donut { display: flex; align-items: center; gap: 1.125rem; flex-wrap: wrap; }
.donut-plot { position: relative; flex: none; }
.donut-plot svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-plot circle { fill: none; }
.donut-mid {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.0625rem;
}
.donut-mid b {
  font-size: 1.375rem; font-weight: 650; letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.donut-mid i {
  font-style: normal; font-size: 0.5625rem; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.donut-legend { margin-top: 0; flex-direction: column; gap: 0.4375rem; }

/* ---- treemap ------------------------------------------------------------ */
.treemap { margin-top: 1rem; }
.tm-plot {
  position: relative; width: 100%;
  border-radius: var(--radius); overflow: hidden;
}
.tm-cell {
  position: absolute;
  /* lit from the top-left, so a field of tiles reads as depth not as a chart
     of flat slabs */
  background:
    linear-gradient(150deg,
      color-mix(in srgb, #fff 26%, var(--tone)) 0%,
      var(--tone) 46%,
      color-mix(in srgb, #000 20%, var(--tone)) 100%);
  border-radius: 7px;
  outline: 2px solid var(--surface-solid);
  outline-offset: -1px;
  padding: 0.4375rem 0.5625rem;
  overflow: hidden;
  color: #fff;
  display: flex; flex-direction: column; justify-content: flex-start;
  line-height: 1.1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.tm-cell b {
  font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.tm-cell span {
  font-size: 0.625rem; opacity: 0.88; letter-spacing: 0.015em;
  font-weight: 520; margin-top: 0.0625rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- horizontal bar list ------------------------------------------------ */
.barlist { margin-top: 0.875rem; display: grid; gap: 0.4375rem; }
.bl-row {
  display: grid;
  grid-template-columns: minmax(6rem, 11rem) minmax(0, 1fr) 3.5rem;
  align-items: center;
  gap: 0.625rem;
}
.barlist.is-compact .bl-row { grid-template-columns: minmax(4.5rem, 8rem) minmax(0, 1fr) 3rem; }
.bl-name {
  font-size: 0.8125rem; color: var(--text); letter-spacing: 0.002em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bl-track {
  height: 0.5rem; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--neutral) 15%, transparent);
  overflow: hidden;
}
.bl-fill {
  display: block; height: 100%; width: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--tone) 55%, transparent) 0%, var(--tone) 100%);
  box-shadow: 0 0 14px -4px var(--tone);
}
.bl-value {
  font-family: var(--mono); font-size: 0.75rem; text-align: right;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--tone) 50%, var(--text));
}
.bl-note { grid-column: 2 / -1; font-size: 0.6875rem; color: var(--text-3); margin-top: -0.125rem; }

/* a second measure per row, as a column rather than a repeated sentence */
.barlist.has-meta .bl-row {
  grid-template-columns: minmax(6rem, 11rem) minmax(0, 1fr) 3.5rem 3.25rem;
}
.bl-meta {
  font-family: var(--mono); font-size: 0.75rem; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--text-3);
}
.bl-head {
  display: grid;
  grid-template-columns: minmax(6rem, 11rem) minmax(0, 1fr) 3.5rem 3.25rem;
  gap: 0.625rem;
  margin-top: 1rem;
  padding-bottom: 0.3125rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; color: var(--text-3);
}
.bl-head span:nth-child(1) { grid-column: 1 / 3; }
.bl-head span:nth-child(2) { text-align: right; }
.bl-head span:nth-child(3) { text-align: right; }
.bl-head + .barlist { margin-top: 0.5rem; }

/* ---- paired comparison bars --------------------------------------------- */
.pairbars { margin-top: 1.125rem; display: grid; gap: 0.9375rem; }
.pb-row { display: grid; gap: 0.3125rem; }
.pb-head { display: flex; align-items: baseline; gap: 0.5rem; }
.pb-name { font-size: 0.8125rem; color: var(--text); letter-spacing: 0.002em; }
.pb-delta {
  margin-left: auto; font-family: var(--mono); font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}
.pb-delta.is-better { color: color-mix(in srgb, var(--c-green) 60%, var(--text)); }
.pb-delta.is-same { color: var(--text-3); }
.pb-pair { display: grid; gap: 0.25rem; }
.pb-line {
  display: grid; grid-template-columns: minmax(0, 1fr) 3rem;
  align-items: center; gap: 0.5rem;
}
.pb-track {
  height: 0.6875rem; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--neutral) 13%, transparent);
  overflow: hidden;
}
.pb-fill {
  display: block; height: 100%; width: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--tone) 58%, transparent) 0%, var(--tone) 100%);
  box-shadow: 0 0 16px -5px var(--tone);
}
.pb-val {
  font-family: var(--mono); font-size: 0.6875rem; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--text-2);
}

/* ---- diverging bars ----------------------------------------------------- */
.diverge { margin-top: 0.875rem; display: grid; gap: 0.4375rem; }
.dv-row {
  display: grid; grid-template-columns: minmax(5rem, 9rem) minmax(0, 1fr) 3rem;
  align-items: center; gap: 0.625rem;
}
.dv-name {
  font-size: 0.8125rem; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.dv-track {
  position: relative; height: 0.625rem; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--neutral) 13%, transparent);
}
.dv-track::before {
  content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px;
  width: 1px; background: var(--line);
}
.dv-fill { position: absolute; top: 0; bottom: 0; width: 0; background: var(--tone); }
.dv-fill.is-up { left: 50%; border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }
.dv-fill.is-down { right: 50%; border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.dv-value {
  font-family: var(--mono); font-size: 0.75rem; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--text-2);
}
.dv-foot {
  display: flex; justify-content: space-between;
  padding-left: calc(9rem + 0.625rem); padding-right: calc(3rem + 0.625rem);
  font-size: 0.625rem; color: var(--text-3); font-variant-numeric: tabular-nums;
  margin-top: 0.125rem;
}

/* ---- interval bars ------------------------------------------------------ */
.intervals { margin-top: 0.875rem; display: grid; gap: 0.5rem; }
.iv-row {
  display: grid; grid-template-columns: minmax(6rem, 11rem) minmax(0, 1fr) 3rem;
  align-items: center; gap: 0.625rem;
}
.iv-name {
  font-size: 0.8125rem; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.iv-track {
  position: relative; height: 1.375rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--neutral) 10%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--neutral) 12%, transparent);
}
/* the interval itself: a lit band, widest where the estimate is least pinned */
.iv-span {
  position: absolute; top: 50%; height: 0.75rem; transform: translateY(-50%);
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--tone) 38%, transparent) 0%,
    color-mix(in srgb, var(--tone) 72%, transparent) 50%,
    color-mix(in srgb, var(--tone) 38%, transparent) 100%);
  box-shadow: 0 0 16px -4px var(--tone);
}
/* end caps, so the interval reads as bounded rather than fading out */
.iv-span::before,
.iv-span::after {
  content: ""; position: absolute; top: 50%; width: 3px; height: 1rem;
  transform: translateY(-50%); border-radius: 1.5px;
  background: var(--tone);
}
.iv-span::before { left: 0; }
.iv-span::after { right: 0; }
.iv-dot {
  position: absolute; top: 50%; width: 0.6875rem; height: 0.6875rem;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 0 2.5px var(--surface-solid), 0 0 14px -2px var(--tone);
}
/* the comparison point: hollow, so the solid estimate stays the subject */
.iv-ghost {
  position: absolute; top: 50%; width: 0.625rem; height: 0.625rem;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--surface-solid);
  border: 2px solid color-mix(in srgb, var(--tone) 75%, transparent);
}
.iv-value {
  font-family: var(--mono); font-size: 0.75rem; text-align: right;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--tone) 50%, var(--text));
  font-weight: 600;
}
.intervals.has-meta .iv-row,
.iv-head {
  grid-template-columns: minmax(5rem, 9rem) minmax(0, 1fr) 3.25rem 3.5rem;
}
.iv-meta {
  font-family: var(--mono); font-size: 0.75rem; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--text-3);
}
.iv-meta.is-down { color: color-mix(in srgb, var(--c-pink) 62%, var(--text)); }
.iv-meta.is-up { color: color-mix(in srgb, var(--c-green) 58%, var(--text)); }
.iv-head {
  display: grid; gap: 0.625rem;
  padding-bottom: 0.3125rem; margin-bottom: 0.125rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; color: var(--text-3);
}
.iv-head span:nth-child(1) { grid-column: 1 / 3; }
.iv-head span:nth-child(2),
.iv-head span:nth-child(3) { text-align: right; }

/* ---- findings, collapsed by default ------------------------------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.875rem; }
.findings { margin-top: 0.75rem; display: grid; gap: 0.25rem; }
.finding {
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  overflow: hidden;
}
.finding > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.6875rem;
  font-size: 0.8125rem; font-weight: 520; color: var(--text);
  letter-spacing: 0.002em;
}
.finding > summary::-webkit-details-marker { display: none; }
.finding > summary::after {
  content: ""; margin-left: auto; flex: none;
  width: 0.4375rem; height: 0.4375rem;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 180ms var(--ease-out);
}
.finding[open] > summary::after { transform: rotate(-135deg) translate(-1px, -1px); }
.finding-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none;
  background: var(--tone);
}
.finding-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.finding-body {
  padding: 0 0.6875rem 0.6875rem 1.6875rem;
  font-size: 0.8125rem; line-height: 1.55; color: var(--text-2);
  letter-spacing: 0.002em;
}
@media (hover: hover) and (pointer: fine) {
  .finding > summary:hover { background: color-mix(in srgb, var(--neutral) 7%, transparent); }
}

/* ---- upload slots -------------------------------------------------------- */
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.625rem;
}
.slot {
  appearance: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  background: var(--surface-sunken);
  color: var(--text);
  display: grid;
  gap: 0.1875rem;
  transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .slot:hover { border-color: var(--accent); }
}
.slot:active { transform: scale(0.985); }
.slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.slot-name {
  font-size: 0.8125rem; font-weight: 560; letter-spacing: 0.002em;
  display: flex; align-items: center; gap: 0.375rem;
}
.slot-name::before {
  content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none;
  background: color-mix(in srgb, var(--neutral) 35%, transparent);
}
.slot-state {
  font-size: 0.6875rem; color: var(--text-3); letter-spacing: 0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot.is-loaded {
  border-style: solid;
  border-color: color-mix(in srgb, var(--c-green) 45%, transparent);
  background: color-mix(in srgb, var(--c-green) 9%, var(--surface-sunken));
}
.slot.is-loaded .slot-name::before { background: var(--c-green); }
.slot.is-loaded .slot-state { color: color-mix(in srgb, var(--c-green) 45%, var(--text-2)); }
.slot-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}
.slot-foot .chip { margin-left: auto; }

/* ---- dumbbells, brought up to the same finish as the other charts -------- */
.dumbbell-track {
  background: color-mix(in srgb, var(--neutral) 10%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--neutral) 12%, transparent);
}
/* The connector carries the direction of the change: cyan end is the random
   split, pink end the scaffold split. */
.dumbbell-bar {
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--c-cyan) 55%, transparent),
    color-mix(in srgb, var(--c-pink) 55%, transparent));
}
.dot {
  width: 0.6875rem; height: 0.6875rem;
  margin: -0.34375rem 0 0 -0.34375rem;
}
.dot-random {
  background: var(--surface-solid);
  border: 2.5px solid var(--c-cyan);
  box-shadow: 0 0 10px -2px var(--c-cyan);
}
.dot-scaffold {
  background: linear-gradient(145deg,
    color-mix(in srgb, #fff 24%, var(--c-pink)), var(--c-pink));
  box-shadow: 0 0 0 2px var(--surface-solid), 0 0 12px -2px var(--c-pink);
}

/* ---- a card accepting a dropped file ------------------------------------- */
.composer.is-over {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}
.composer.is-over::after {
  content: "Drop the file to load it";
  position: absolute; inset: auto 0 0.75rem 0;
  text-align: center; font-size: 0.75rem; font-weight: 560;
  color: var(--accent); pointer-events: none;
}
.composer { position: relative; }

/* ---- compact stat strip -------------------------------------------------- */
.statstrip { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.stat {
  --tone: var(--c-blue);
  flex: 1 1 6.5rem; min-width: 0;
  position: relative; overflow: hidden; isolation: isolate;
  padding: 0.75rem 0.875rem 0.8125rem;
  border-radius: var(--radius);
  background:
    linear-gradient(150deg,
      color-mix(in srgb, var(--tone) 16%, transparent) 0%,
      color-mix(in srgb, var(--tone) 4%, transparent) 55%,
      transparent 100%),
    var(--surface-sunken);
  border: 1px solid color-mix(in srgb, var(--tone) 24%, transparent);
}
/* a soft corner bloom, so a tile reads as lit rather than boxed */
.stat::after {
  content: ""; position: absolute; z-index: -1;
  right: -28%; top: -72%; width: 82%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--tone) 34%, transparent), transparent 70%);
  pointer-events: none;
}
.stat-name {
  font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: color-mix(in srgb, var(--tone) 38%, var(--text-3));
  font-weight: 620;
}
.stat-value {
  margin-top: 0.25rem; font-size: 1.5rem; font-weight: 680;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
  line-height: 1.05;
  color: color-mix(in srgb, var(--tone) 58%, var(--text));
}
.stat-value small {
  font-size: 0.55em; font-weight: 560; letter-spacing: 0;
  color: color-mix(in srgb, var(--tone) 40%, var(--text-3));
}

@media (max-width: 40rem) {
  .chart-row { gap: 1rem 1.25rem; }
  .chart-headline { font-size: 1.125rem; }
  .waffle-grid { width: 7rem; }
  .waffle figcaption b { font-size: 1.5rem; }
  .bl-row,
  .barlist.is-compact .bl-row { grid-template-columns: minmax(4.5rem, 8rem) minmax(0, 1fr) 3rem; gap: 0.5rem; }
  .barlist.has-meta .bl-row,
  .bl-head { grid-template-columns: minmax(4rem, 7rem) minmax(0, 1fr) 2.75rem 2.5rem; gap: 0.4375rem; }
  .dv-row, .iv-row { grid-template-columns: minmax(4.5rem, 7rem) minmax(0, 1fr) 2.75rem; gap: 0.5rem; }
  /* The four-column variants are declared later in this file, so they need an
     explicit narrow form or the name column eats the whole track. */
  .intervals.has-meta .iv-row,
  .iv-head { grid-template-columns: minmax(3.75rem, 5.5rem) minmax(0, 1fr) 2.75rem 2.75rem; gap: 0.4375rem; }
  .dv-foot { padding-left: calc(7rem + 0.5rem); padding-right: calc(2.75rem + 0.5rem); }
  .col-plot { gap: 0.3125rem; }
  .col-label { font-size: 0.5625rem; }
  .col-bar b { display: none; }
  .line-labels { font-size: 0.5625rem; padding-left: 2.25rem; }
  .donut { gap: 0.875rem; }
  .ringset-mid b { font-size: 1.25rem; }
  /* Keep the two triads side by side: stacked, the comparison stops being one.
     The size is inline from charts.js, so this needs !important to win. */
  .ringcompare { gap: 0.75rem 1rem; justify-content: center; }
  .ringcompare .ringset-plot { width: 7rem !important; height: 7rem !important; }
  .ring-legend { flex-basis: 100%; }
  .ring-legend span { grid-template-columns: 0.625rem minmax(0, 1fr) 2.25rem 0.75rem 2.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .finding > summary::after { transition: none; }
}

@media (prefers-contrast: more) {
  .tm-cell { outline-color: var(--text); }
  .waffle-cell { background: color-mix(in srgb, var(--neutral) 30%, transparent); }
}
