/* The Schedule pickup button with the time wheel. A warm dark room (an ember light behind, a fine grain) and in the
   middle one pill of smoked lacquer with a copper edge. Inside one rounded box (.pk__body, its height and scale moved
   only by GSAP): the lacquer fill, the light under the pointer, the ember glow of the set slot, the reflection of the
   success, the face of the button (clock disc, words, chevron) and the panel with the time wheel. Under the box the
   receipt waits to slide out by a hair. */
:root {
  --page: #0d0a08;            /* the room */
  --haze: #2b1c12;            /* the warm light behind the button */
  --ember: #ffb05a;           /* the accent: the set slot, the prep time, the success */
  --ember-deep: #c4561d;      /* the ember in shadow */
  --copper: #e8c3a0;          /* the copper edge */
  --lacquer: #17110d;         /* the smoked lacquer of the button */
  --ink: #f7efe5;             /* the words */
  --muted: rgba(247, 239, 229, 0.5); /* the small lines */
  --paper: #f1e7d6;           /* the receipt */
  --paper-ink: #3a2a1d;       /* the receipt's print */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* the room: a warm light behind, a faint ember from below and a fine grain */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(min(74vw, 560px) min(46vh, 320px) at 50% 44%, color-mix(in srgb, var(--haze) 92%, transparent), transparent 72%),
    radial-gradient(min(110vw, 860px) min(70vh, 520px) at 50% 128%, color-mix(in srgb, var(--ember-deep) 18%, transparent), transparent 70%),
    var(--page);
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.9 0 0 0 0 0.8 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* the wrap keeps the room of the open wheel and of the receipt, so the frame never jumps */
.pk-wrap {
  position: relative;
  z-index: 1;
  width: min(86vw, 318px);
  height: min(236px, 56vh);
  display: grid;
  place-items: center;
}

.pk {
  position: relative;
  width: 100%;
}

/* the ember the button throws on the floor */
.pk__spill {
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 100%;
  height: 40px;
  margin-left: -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--ember) 46%, transparent), color-mix(in srgb, var(--ember-deep) 16%, transparent) 55%, transparent);
  filter: blur(14px);
  opacity: 0.14;
  pointer-events: none;
}

/* ------------------------------------------------------------ the receipt */
.pk__slip {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 168px;
  height: 52px;
  margin-left: -84px;
  z-index: 0;
  pointer-events: none;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
}

.pk__slip::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(90, 60, 30, 0.035) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #d9cbb4, var(--paper) 40%, #fbf4e8);
  /* the torn edge: a zigzag of 8 pixel teeth at the bottom */
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 8px 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 8px 100%;
}

.pk__slip-bars {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 9px;
  height: 7px;
  background: repeating-linear-gradient(90deg, var(--paper-ink) 0 1px, transparent 1px 3px, var(--paper-ink) 3px 5px, transparent 5px 6px, var(--paper-ink) 6px 7px, transparent 7px 10px);
  opacity: 0.55;
}

.pk__slip-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7px;
  text-align: center;
  font-size: 10px;
  line-height: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--paper-ink);
  font-stretch: 88%;
  font-weight: 560;
  white-space: nowrap;
}

.pk__slip-text b {
  font-weight: 760;
}

/* ------------------------------------------------------------ the pill */
.pk__body {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 60px;
  border-radius: 30px;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.85),
    0 8px 18px -10px rgba(0, 0, 0, 0.9),
    0 26px 50px -24px rgba(0, 0, 0, 1),
    0 14px 30px -20px color-mix(in srgb, var(--ember) 30%, transparent);
}

.pk__fill,
.pk__light-box,
.pk__glow-box,
.pk__sweep-box,
.pk__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

/* smoked lacquer: deep, lighter at the top, with a faint brushed grain */
.pk__fill {
  background:
    repeating-linear-gradient(90deg, rgba(255, 240, 225, 0.012) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, rgba(255, 228, 200, 0.085), rgba(255, 228, 200, 0.012) 40px, rgba(0, 0, 0, 0.24)),
    var(--lacquer);
}

/* the light under the pointer (GSAP moves it) */
.pk__light {
  position: absolute;
  left: 0;
  top: 0;
  width: 220px;
  height: 220px;
  margin: -110px 0 0 -110px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 214, 170, 0.15), rgba(255, 214, 170, 0.04) 55%, transparent);
  opacity: 0;
}

/* the ember glow of the set slot (GSAP scales it) */
.pk__glow {
  position: absolute;
  left: 30px;
  top: 30px;
  width: 140px;
  height: 90px;
  margin: -45px 0 0 -70px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--ember) 42%, transparent), color-mix(in srgb, var(--ember-deep) 14%, transparent) 60%, transparent);
  opacity: 0;
}

.pk__sweep {
  position: absolute;
  top: -20%;
  left: 0;
  width: 34%;
  height: 140%;
  background: linear-gradient(90deg, transparent, rgba(255, 236, 214, 0.13) 45%, rgba(255, 246, 236, 0.22) 50%, rgba(255, 236, 214, 0.13) 55%, transparent);
}

/* the copper hairline: light at the top, shadow at the bottom */
.pk__edge {
  z-index: 5;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--copper) 18%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--copper) 46%, transparent),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------ the face of the button */
.pk__face {
  appearance: none;
  border: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 0;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 10px;
  border-radius: 30px;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.pk__face:focus-visible,
.pk__set:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--copper) 85%, white);
  outline-offset: -4px;
}

.pk__disc {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
}

.pk__plate {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(120% 90% at 35% 20%, rgba(255, 230, 205, 0.16), transparent 60%),
    #241912;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--copper) 26%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--copper) 40%, transparent),
    0 2px 5px rgba(0, 0, 0, 0.5);
}

/* the plate of the success: ember lacquer under the dark one, shown by GSAP */
.pk__plate::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(110% 90% at 35% 18%, #ffe0b5, transparent 55%),
    linear-gradient(180deg, var(--ember), var(--ember-deep));
  box-shadow: inset 0 1px 0 rgba(255, 248, 236, 0.6), inset 0 -2px 4px rgba(110, 40, 10, 0.4);
  opacity: var(--lit, 0);
}

.pk__clock,
.pk__ok {
  position: absolute;
  inset: 8px;
  width: 24px;
  height: 24px;
  overflow: visible;
}

.pk__clock-rim {
  fill: none;
  stroke: color-mix(in srgb, var(--copper) 40%, transparent);
  stroke-width: 1;
}

.pk__clock-dot {
  stroke: color-mix(in srgb, var(--copper) 55%, transparent);
  stroke-width: 1;
  stroke-linecap: round;
}

.pk__hand {
  stroke-linecap: round;
}

.pk__hand--h {
  stroke: var(--ink);
  stroke-width: 1.8;
}

.pk__hand--m {
  stroke: var(--ember);
  stroke-width: 1.4;
}

.pk__ok path {
  fill: none;
  stroke: #2a1408;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.pk__words {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
}

.pk__state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.pk__title {
  font-size: 16px;
  line-height: 19px;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.pk__sub {
  font-size: 12px;
  line-height: 14px;
  color: var(--muted);
  font-stretch: 92%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.pk__state[data-state='ok'] .pk__sub {
  color: color-mix(in srgb, var(--ember) 78%, var(--ink));
}

.pk__chev {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--copper) 22%, transparent), inset 0 1px 0 color-mix(in srgb, var(--copper) 30%, transparent);
  background: rgba(255, 230, 205, 0.035);
}

.pk__chev svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
}

/* ------------------------------------------------------------ the panel with the time wheel */
.pk__panel {
  --row: 34px;
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  top: 0;
  height: 184px;
  visibility: hidden;
  opacity: 0;
}

.pk__head {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-stretch: 92%;
  font-weight: 560;
  white-space: nowrap;
}

.pk__head-l {
  color: var(--ink);
}

.pk__head-r {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* a hairline under the head */
.pk__head::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--copper) 20%, transparent) 20%, color-mix(in srgb, var(--copper) 20%, transparent) 80%, transparent);
}

.pk__wheel {
  position: absolute;
  left: 0;
  right: 0;
  top: 40px;
  bottom: 6px;
  outline: none;
  cursor: grab;
  touch-action: none;
  perspective: 380px;
  -webkit-user-select: none;
  user-select: none;
}

.pk__wheel:active {
  cursor: grabbing;
}

.pk__rows {
  position: absolute;
  inset: 0;
  z-index: 1;
  -webkit-mask: linear-gradient(180deg, transparent 2%, #000 30%, #000 70%, transparent 98%);
  mask: linear-gradient(180deg, transparent 2%, #000 30%, #000 70%, transparent 98%);
}

.pk__row {
  --k: 0;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--row);
  display: flex;
  align-items: center;
  padding-left: 22px;
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

/* the small tick of each slot: it grows in the band */
.pk__row-tick {
  width: calc(4px + 6px * var(--k));
  height: 1px;
  margin-right: calc(8px - 2px * var(--k));
  background: color-mix(in srgb, var(--ember) calc(var(--k) * 100%), var(--muted));
}

.pk__row-time {
  font-size: 19px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: calc(400 + 260 * var(--k));
  font-stretch: calc((90% + 12% * var(--k)));
  letter-spacing: -0.01em;
  color: color-mix(in srgb, var(--ink) calc(var(--k) * 100%), var(--muted));
}

.pk__wheel:focus-visible .pk__band-rim {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--copper) 80%, white);
}

/* the band: the slot that is chosen, with its prep time */
.pk__band {
  position: absolute;
  z-index: 0;
  left: 10px;
  right: 10px;
  top: 50%;
  height: var(--row);
  margin-top: calc(var(--row) / -2);
  border-radius: 17px;
  background:
    linear-gradient(180deg, rgba(255, 228, 200, 0.075), rgba(255, 228, 200, 0.03)),
    rgba(255, 176, 90, 0.035);
  box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(0, 0, 0, 0.35);
}

.pk__band-rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--copper) 20%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--copper) 36%, transparent);
}

.pk__prep {
  position: absolute;
  left: 100px;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.pk__prep-win {
  position: relative;
  display: block;
  width: 17px;
  height: 16px;
  overflow: hidden;
}

.pk__prep-col {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
}

.pk__prep-col span {
  display: block;
  height: 16px;
  line-height: 16px;
  text-align: right;
  font-size: 13px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  color: var(--ember);
}

.pk__prep-unit {
  font-size: 11px;
  line-height: 16px;
  font-stretch: 90%;
  color: var(--muted);
}

.pk__meter {
  position: absolute;
  left: 178px;
  top: 50%;
  width: 19px;
  height: 12px;
  margin-top: -6px;
  overflow: visible;
}

.pk__meter rect {
  fill: var(--ember);
  opacity: 0.18;
}

/* the set disc, on the right of the band */
.pk__set {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  position: absolute;
  z-index: 4;
  right: 14px;
  top: calc(40px + (184px - 46px) / 2 - 15px);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.pk__set-plate {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(110% 90% at 35% 18%, #ffe0b5, transparent 55%),
    linear-gradient(180deg, var(--ember), var(--ember-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 236, 0.6),
    inset 0 -2px 4px rgba(110, 40, 10, 0.4),
    0 4px 10px -3px color-mix(in srgb, var(--ember-deep) 70%, transparent),
    0 1px 2px rgba(0, 0, 0, 0.5);
}

.pk__set svg {
  position: absolute;
  inset: 5px;
  width: 20px;
  height: 20px;
}

.pk__set path {
  fill: none;
  stroke: #2a1408;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
}

/* ------------------------------------------------------------ the drawn pointer */
.pk__cursor {
  position: absolute;
  z-index: 10;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  opacity: 0;
  pointer-events: none;
  overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}

.pk__cursor path {
  fill: #fbf6ef;
  stroke: #1a120c;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .pk__set:hover .pk__set-plate {
    filter: brightness(1.08);
  }
}

/* on a narrow phone the small line keeps only the takeaway and the items */
@media (max-width: 380px) {
  .pk__wide {
    display: none;
  }
}
