:root {
  --fondo: #ffffff;
  --pillola: #ffffff;
  --pillola-2: #f6f5f2;     /* the bottom of the pill's soft gradient */
  --bordo: rgba(20, 18, 16, 0.08);
  --testo: #151412;
  --testo-2: #8a857e;
  --tacca: #d9d5cf;
  --accento: #ff5b2e;       /* the waveform, the slider fill and the thumb */
  --accento-tenue: rgba(255, 91, 46, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
}

/* the frame is as wide as the open slider, so the preview never has to move when it stretches */
.frame {
  width: min(340px, calc(100vw - 28px));
  height: 84px;
  display: grid;
  place-items: center;
}

/* GSAP squashes this one; the pill inside keeps its own CSS transform for hover */
.press { display: grid; place-items: center; will-change: transform; }

.pill {
  position: relative;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 22px 0 21px;
  border-radius: 30px;
  background: linear-gradient(180deg, var(--pillola) 0%, var(--pillola-2) 100%);
  box-shadow:
    0 0 0 1px var(--bordo),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(20, 18, 16, 0.04),
    0 1px 2px rgba(20, 18, 16, 0.06),
    0 8px 18px -8px rgba(20, 18, 16, 0.16),
    0 22px 40px -22px rgba(20, 18, 16, 0.22);
  overflow: hidden;
  white-space: nowrap;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}
.pill:focus { outline: none; }
.pill:focus-visible { box-shadow: 0 0 0 1px var(--bordo), 0 0 0 4px #fff, 0 0 0 6px var(--accento), 0 8px 18px -8px rgba(20, 18, 16, 0.16); }
@media (hover: hover) {
  .pill:hover { transform: scale(1.035); }
  .pill.is-open:hover { transform: none; }
}

/* a thin light along the top edge, like a lip of glass */
.pill__shine {
  position: absolute; left: 18px; right: 18px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 1) 30%, rgba(255, 255, 255, 1) 70%, transparent);
  pointer-events: none;
}

.bars {
  --gap: 2.6px;
  flex: none;
  height: 20px;
  display: flex;
  align-items: center;
  gap: var(--gap);
}
.bars i {
  display: block;
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: var(--accento);
  transform-origin: 50% 50%;
  transform: scaleY(0.4);
}

.num {
  flex: none;
  display: flex;
  align-items: center;
  height: 20px;
  font-size: 23px;
  font-weight: 620;
  font-variation-settings: "wdth" 96;
  letter-spacing: -0.01em;
  line-height: 20px;
}
.slot {
  position: relative;
  display: block;
  height: 20px;           /* the window is exactly as tall as a digit: what rolls in or out is cut at the line */
  overflow: hidden;
}
.col { display: block; margin-top: -3px; will-change: transform; }
.col span { display: block; height: 26px; line-height: 26px; text-align: center; }
.dot { display: block; height: 20px; line-height: 20px; text-align: center; }

.times {
  flex: none;
  width: 10px; height: 10px;
  margin-left: -6px;
  fill: none;
  stroke: var(--testo-2);
  stroke-width: 1.7;
  stroke-linecap: round;
}

/* ---- the fine slider, hidden until the pill is held ---- */
.track {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--track-left, 140px);
  right: 22px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.track__rail {
  position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -3px;
  border-radius: 3px;
  background: #ecebe7;
  overflow: hidden;
}
.track__fill { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: var(--accento); opacity: 0.9; }
.track__ticks { position: absolute; inset: 0; }
.tick {
  position: absolute; top: 50%; width: 1px; height: 6px; margin: -15px 0 0 -0.5px;
  background: var(--tacca);
  border-radius: 1px;
  transform-origin: 50% 100%;
}
.tick--major { height: 9px; margin-top: -18px; background: #bdb8b0; }
.tick__label {
  position: absolute; top: 50%; margin-top: 7px;
  font-size: 10px; font-weight: 560; letter-spacing: 0.01em;
  color: var(--testo-2);
  transform: translateX(-50%);
}
.track__thumb {
  position: absolute; top: 50%; left: 0;
  width: 4px; height: 26px; margin: -14.5px 0 0 -2px;
  border-radius: 3px;
  background: var(--accento);
  box-shadow: 0 0 0 3px var(--accento-tenue), 0 2px 6px rgba(255, 91, 46, 0.35);
}

/* pressed: the shadow tightens under the pill */
.pill.is-down {
  box-shadow:
    0 0 0 1px var(--bordo),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(20, 18, 16, 0.04),
    0 1px 1px rgba(20, 18, 16, 0.08),
    0 4px 10px -6px rgba(20, 18, 16, 0.2);
  transition-duration: 0.12s;
}
