/*
 * csec-age — the rate by age as a suture thread, with a hundred-birth field
 * for the selected age. Wide: field and readout on the left, thread on the
 * right. Narrow: field and readout side by side above the thread.
 */
.csa { display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); gap: 24px clamp(24px, 4vw, 48px); align-items: center; }
.csa-out { display: flex; flex-direction: column; gap: 18px; }
.csa-mini { display: block; width: 100%; aspect-ratio: 1; overflow: visible; }
.csa-read p { margin: 0; }
.csa-age { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.csa-num { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; color: var(--cat-emph); }
.csa-val { font-family: var(--font-display); font-size: clamp(52px, 5.6vw, 72px); font-weight: 380; letter-spacing: -.04em; }
.csa-of { font-family: var(--font-sans); font-size: 14px; color: var(--muted); }
.csa-n { margin-top: 4px !important; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }

.csa-plot { min-width: 0; }
.csa-svg { display: block; overflow: visible; touch-action: pan-y; cursor: crosshair; }
.csa-svg:focus-visible { outline: 2px solid var(--accent2); outline-offset: 4px; border-radius: 4px; }
.csa-grid line { stroke: var(--fig-line); stroke-width: 1; }
.csa-grid text, .csa-axis text, .csa-hist-lbl { font-family: var(--font-mono); font-size: 11.5px; fill: var(--label-ink); }
.csa-axis .csa-axis-name { font-size: 12px; fill: var(--muted); }
.csa-ref line { stroke: var(--ref-ink); stroke-width: 1; stroke-dasharray: 3 4; }
.csa-ref text { font-family: var(--font-mono); font-size: 11.5px; fill: var(--ref-ink); }
.csa-hist rect { fill: rgba(var(--ink-rgb), .12); transition: fill .2s ease; }
.csa-hist rect.on { fill: rgba(var(--ink-rgb), .38); }

.csa-thread {
  fill: none;
  stroke: var(--cat-emph);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.csa-tick { fill: none; stroke: rgba(var(--ink-rgb), .55); stroke-width: 1.3; stroke-linecap: round; }
/* first view: the thread is sewn from left to right, the stitches follow */
.csa[data-rv="pending"] .csa-thread { stroke-dashoffset: 1; }
.csa[data-rv="pending"] .csa-tick { opacity: 0; }
.csa[data-rv="shown"] .csa-thread { transition: stroke-dashoffset 1.6s cubic-bezier(.45, 0, .2, 1) .1s; }
.csa[data-rv="shown"] .csa-tick { transition: opacity .25s ease calc(.2s + var(--i) * 75ms); }

.csa-sel-rule { stroke: rgba(var(--ink-rgb), .35); stroke-width: 1; }
.csa-sel-dot { fill: var(--bg); stroke: var(--cat-emph); stroke-width: 2.4; }
.csa-sel-lbl { font-family: var(--font-mono); font-size: 13px; font-weight: 600; fill: var(--cat-emph); paint-order: stroke; stroke: var(--fig-bg); stroke-width: 4px; }
.csa-sel > * { transition: cx .35s var(--rv-ease), cy .35s var(--rv-ease), x .35s var(--rv-ease), y .35s var(--rv-ease), x1 .35s var(--rv-ease), x2 .35s var(--rv-ease), y1 .35s var(--rv-ease); }

@container (width < 620px) {
  .csa { grid-template-columns: minmax(0, 1fr); }
  .csa-out { flex-direction: row; align-items: center; gap: 18px; }
  .csa-mini { width: 112px; flex: none; }
  .csa-val { font-size: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .csa-thread, .csa-tick, .csa-sel > *, .csa-hist rect { transition: none !important; }
}
