/*
 * Stitches (kit/stitch.js) — chapter 3's unit: one birth per cell. A dot is a
 * birth; a sewn incision (line + three cross-stitches) is a C-section.
 *   .st.on      C-section
 *   .st.base    a C-section counted in a comparison's baseline (ghost ink)
 *   .st.extra   a C-section above that baseline (chapter colour)
 * --d is set per cell by the kit: the order in which the cells are sewn.
 */
.st-field { --st-ink: var(--cat-emph); --st-x: color-mix(in srgb, var(--cat-emph) 62%, var(--ink)); }

.st-dot {
  fill: rgba(var(--ink-rgb), .3);
  transition: scale .28s var(--rv-ease) var(--d, 0ms), opacity .28s ease var(--d, 0ms);
}
.st-cut, .st-x { fill: none; stroke-linecap: round; }
.st-cut {
  stroke: var(--st-ink);
  stroke-width: var(--st-w, 2px);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset .36s cubic-bezier(.5, 0, .2, 1) var(--d, 0ms), stroke .4s ease;
}
.st-x {
  stroke: var(--st-x);
  stroke-width: calc(var(--st-w, 2px) * .72);
  scale: 1 0;
  opacity: 0;
  transition: scale .22s cubic-bezier(.3, 1.6, .5, 1) calc(var(--d, 0ms) + .2s), opacity .15s ease calc(var(--d, 0ms) + .2s), stroke .4s ease;
}
.st.on .st-dot { scale: 0; opacity: 0; }
.st.on .st-cut { stroke-dashoffset: 0; }
.st.on .st-x { scale: 1 1; opacity: 1; }

.st.base { --st-ink: rgba(var(--ink-rgb), .42); --st-x: rgba(var(--ink-rgb), .3); }
.st-field.dim .st:not(.extra) { opacity: .45; }
.st { transition: opacity .3s ease; }

/* reduced motion, first paint and resizes: no sewing */
.st-still .st-dot, .st-still .st-cut, .st-still .st-x { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .st-dot, .st-cut, .st-x, .st { transition: none; }
}

/* ---- the rolling number ---------------------------------------------------- */
.odo { display: inline-flex; align-items: flex-start; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.odo-c { display: inline-block; height: 1em; overflow: hidden; }
.odo-s { display: flex; flex-direction: column; transition: transform .8s cubic-bezier(.16, 1, .3, 1); }
.odo-s > span { display: block; height: 1em; line-height: 1; text-align: center; }
.odo-still .odo-s { transition: none; }
@media (prefers-reduced-motion: reduce) { .odo-s { transition: none; } }
