/* iOS-style wheel picker.
   Geometry contract with number_swiper_controller.js: rows have a uniform
   height and the column's vertical padding is (wheel height - row height) / 2,
   so the first and last rows can rest at the centre and
   scrollTop = row index * row height. */
.number-swiper {
  --row-height: 2.5rem;
  --visible-rows: 5;
  /* Fixed width so the active row's scale transform can't widen the column
     and shift the wheel sideways. Wide enough that "0:30" at 1.15× fits
     without the overflow-x clip cutting into the glyphs. */
  --column-width: 6rem;
  position: relative;
  width: var(--column-width);
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: black;
}

:where(.dark, .dark *) .number-swiper {
  color: white;
}

/* Selection band behind the centred value */
.number-swiper::before {
  content: "";
  position: absolute;
  inset-inline: -0.375rem;
  top: 50%;
  height: var(--row-height);
  transform: translateY(-50%);
  border-radius: 0.625rem;
  background: rgb(0 0 0 / 0.05);
  pointer-events: none;
}

:where(.dark, .dark *) .number-swiper::before {
  background: rgb(255 255 255 / 0.1);
}

.number-swiper-column {
  height: calc(var(--row-height) * var(--visible-rows));
  padding-block: calc(var(--row-height) * (var(--visible-rows) - 1) / 2);
  margin: 0;
  list-style: none;
  overflow-y: scroll;
  overflow-x: hidden;
  /* Stop overscroll from chaining to the page/PWA shell: without this, scrolling
     past the wheel's top or bottom on iOS drags the whole app away. */
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* Drum-style fade towards the edges */
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
}

.number-swiper-column::-webkit-scrollbar {
  display: none;
}

.number-swiper-column li {
  height: var(--row-height);
  line-height: var(--row-height);
  padding-inline: 0.25rem;
  scroll-snap-align: center;
  text-align: center;
  transform-origin: center;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 120ms ease-out, transform 120ms ease-out;
}

/* Emphasise via transform and opacity only: changing the font weight would
   change glyph widths and make the whole column shift. */
.number-swiper-column li.number-swiper-active-number {
  opacity: 1;
  transform: scale(1.15);
}
