/* ATELIER 04 — number roll.
   Each digit is a 1em window onto a reel of glyphs. Markup is built by
   number-roll.js inside <div class="number" role="img"></div>. */

.number {
  display: flex;
  height: 1.5em;
  line-height: 1;
  font-variant-numeric: tabular-nums;      /* every glyph the same width */
  /* Fade the top and bottom 0.25em so glyphs arrive out of nothing instead
     of getting sliced at a clip edge. */
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 0.25em, black calc(100% - 0.25em), transparent);
  mask-image: linear-gradient(to bottom, transparent, black 0.25em, black calc(100% - 0.25em), transparent);
}

.digit, .sep {
  display: block;
  width: 1ch;
  height: 1.5em;
  padding: 0.25em 0;                       /* the 0.25em the mask fades */
  overflow: hidden;
}

/* .live lands one frame after the first render, so the initial value does
   not animate itself in. */
.live .digit, .live .sep {
  transition: width var(--dur-state, 240ms) var(--ease-out, ease),
              opacity var(--dur-state, 240ms) var(--ease-out, ease);
}
@starting-style {
  .live .digit, .live .sep { width: 0; opacity: 0; }   /* 999 → 1,000 */
}
.digit.exit, .sep.exit { width: 0; opacity: 0; }       /* 1,000 → 999 */

.reel {
  display: block;
  will-change: transform;
  /* --spring-panel is a linear() curve baked from a solved spring, so this
     one line carries physics. 484ms per roll whatever the distance. */
  transition: transform var(--spring-panel-dur, 484ms) var(--spring-panel, ease-out);
}
.reel span { display: block; height: 1em; }   /* reels translate whole rows */

.instant .reel { transition: none; }          /* prefers-reduced-motion */
