/*
 * csec-hundred — one hundred births as a measuring glass (chapter 3 opener).
 * HUD on top (benchmark name, rolling number, source); below it the stitch
 * field with the benchmarks marked on its right side at their own height.
 * Roles: who / india in ink, world in ghost ink, cohort in the chapter colour.
 */
.csh { display: flex; flex-direction: column; height: 100%; color: var(--ink); }
.csh:not(.in-scrolly) { height: clamp(520px, 64vw, 700px); }
/* in the scroll story the number and the field form one group, centred on the screen; csec-hundred.js cuts the stage
   to the field's height so no gap opens between them on tall screens */
.csh.in-scrolly { justify-content: center; }
.csh.in-scrolly .csh-stage { flex: none; }
.csh-stage { position: relative; flex: 1; min-height: 0; }
.csh-svg { position: absolute; inset: 0; overflow: visible; }

/* ---- HUD -------------------------------------------------------------------- */
.csh-hud { flex: none; padding-bottom: clamp(12px, 2vh, 24px); }
.csh-kicker {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .4s ease;
}
.csh-kicker.r-cohort { color: var(--cat-emph); }
.csh-num {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  color: var(--ink);
  transition: color .5s ease;
}
.csh-num.r-cohort { color: var(--cat-emph); }
.csh-num.r-world { color: var(--cat-ghost); }
.csh-val {
  font-family: var(--font-display);
  font-size: clamp(72px, 8.4vw, 132px);
  font-weight: 380;
  letter-spacing: -.04em;
}
.csh-of {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--muted);
}
.csh-src {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  min-height: 1.4em;
}
.csh-cmp {
  margin: 10px 0 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
.csh-cmp b { font-weight: 600; color: var(--cat-emph); }
.csh-key { display: inline-block; width: 20px; height: 12px; margin: 0 5px 0 0; vertical-align: -1px; fill: none; stroke-linecap: round; }
.csh-key path:first-child { stroke-width: 2.2; }
.csh-key path:last-child { stroke-width: 1.5; }
.csh-key.extra path:first-child { stroke: var(--cat-emph); }
.csh-key.extra path:last-child { stroke: color-mix(in srgb, var(--cat-emph) 62%, var(--ink)); }
.csh-key.base path:first-child { stroke: rgba(var(--ink-rgb), .42); }
.csh-key.base path:last-child { stroke: rgba(var(--ink-rgb), .3); }

/* ---- the glass ------------------------------------------------------------- */
.csh-glassline { fill: none; stroke: rgba(var(--ink-rgb), .2); stroke-width: 1; }
.csh-whoband { fill: rgba(var(--ink-rgb), .07); }
.csh-tideline {
  stroke: rgba(var(--ink-rgb), .55);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  transition: y1 .7s var(--rv-ease), y2 .7s var(--rv-ease), stroke .4s ease;
}
.csh-tideline.r-cohort { stroke: var(--cat-emph); }
.csh[data-state="world"] .csh-tideline { opacity: 0; }

.csh-lead {
  fill: none;
  stroke: rgba(var(--ink-rgb), .3);
  stroke-width: 1;
  opacity: 0;
  transition: opacity .4s ease, d .6s var(--rv-ease);
}
.csh-lead.on { opacity: 1; }
.csh-lead.r-cohort { stroke: var(--cat-emph); }
.csh-lead.r-world { stroke: rgba(var(--ink-rgb), .18); }

/* ---- benchmark labels (buttons) ------------------------------------------- */
.csh-labels { position: absolute; inset: 0; pointer-events: none; }
.csh-lab {
  position: absolute;
  left: 0; top: 0;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 6px;
  margin-left: -6px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  color: rgba(var(--ink-rgb), .78);
  opacity: 0;
  cursor: default;
  transition: translate .6s var(--rv-ease), opacity .4s ease, color .3s ease, background .2s ease;
}
.csh-lab.on { opacity: 1; }
.csh-lab-val { font-variant-numeric: tabular-nums; color: var(--muted); }
.csh-lab.r-world { color: var(--label-ink); }
.csh-lab.r-cohort, .csh-lab.r-cohort .csh-lab-val { color: var(--cat-emph); font-weight: 600; }
.csh-lab.hot:not(.r-cohort) { color: var(--ink); font-weight: 600; }
.csh-lab.hot .csh-lab-val { color: inherit; }

/* the last state: every benchmark can be picked */
.csh[data-state="world"] .csh-lab.on:not(.r-cohort) { pointer-events: auto; cursor: pointer; }
.csh[data-state="world"] .csh-lab.on:not(.r-cohort):hover { background: rgba(var(--ink-rgb), .07); }
.csh-lab.cmp { color: var(--ink); background: rgba(var(--ink-rgb), .09); }
.csh-lab.cmp .csh-lab-val { color: var(--ink); }
.csh-lab:focus-visible { outline: 2px solid var(--accent2); outline-offset: 1px; }

.csh.snap .csh-lab, .csh.snap .csh-lead, .csh.snap .csh-tideline { transition: none; }

@media (width < 900px) {
  /* the step cards pass over the lower part of the stage */
  .csh.in-scrolly { height: 64%; }
  .csh-val { font-size: 64px; }
  .csh-of { font-size: 13px; }
  .csh-cmp { font-size: 13.5px; }
  .csh-lab { font-size: 11.5px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .csh-lab, .csh-lead, .csh-tideline, .csh-kicker, .csh-num { transition: none; }
}
