/* The delivery window picker with the fee that follows demand: the checkout step of a grocery app on a near black
   page with a fine grain. The card is one dark slab with a 1px edge that catches the light at the top; the bars are
   divs scaled by GSAP (their colour comes from the script, mint for quiet hours, amber for peak), the lens is a glass
   pane moved by a spring in the script. */
:root {
  --page: #0a0b0c;          /* the page */
  --card: #131518;          /* the body of the card */
  --card-top: #181b1f;      /* the card, a little lighter at the top */
  --edge: rgba(255, 255, 255, 0.07); /* the 1px edge */
  --ink: #eef0ee;           /* the words */
  --muted: #858b88;         /* the small words */
  --quiet: #8ef0c4;         /* the quiet hours, cheapest */
  --peak: #ffb35a;          /* the peak hours, dearest */
  --button: #f2f4f1;        /* the button */
  --button-ink: #0b0c0d;    /* the words on the button */
}

* {
  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 page: a low light from above and a fine grain */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(60% 46% at 50% 0%, rgba(142, 240, 196, 0.07), transparent 70%),
    radial-gradient(70% 60% at 50% 100%, rgba(255, 179, 90, 0.035), transparent 70%),
    var(--page);
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: overlay;
  background-image: 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.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.slot {
  position: relative;
  z-index: 1;
  width: min(92vw, 360px);
  opacity: 0;
}

/* the light the lens throws on the table under the card, tinted by the fee */
.slot__glow {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -18px;
  height: 60px;
  border-radius: 50%;
  background: var(--quiet);
  filter: blur(34px);
  opacity: 0.16;
  pointer-events: none;
}

.slot__card {
  position: relative;
  border-radius: 22px;
  padding: clamp(13px, 3.4vh, 20px) clamp(14px, 4.4vw, 20px) clamp(13px, 3.4vh, 18px);
  background: linear-gradient(180deg, var(--card-top), var(--card) 40%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 1px rgba(0, 0, 0, 0.5),
    0 12px 24px -10px rgba(0, 0, 0, 0.7),
    0 40px 70px -34px rgba(0, 0, 0, 0.95);
}

.slot__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.slot__title {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
  font-variation-settings: 'wdth' 106;
  letter-spacing: 0.005em;
}

.slot__sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.slot__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 520;
  color: var(--muted);
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.02);
}

.slot__chip svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

/* the days: a segmented row with a pill that slides */
.slot__days {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: clamp(10px, 2.8vh, 16px);
  padding: 3px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.slot__pill {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 20%;
  border-radius: 11px;
  background: linear-gradient(180deg, #262a2f, #1d2024);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 6px rgba(0, 0, 0, 0.5);
}

.slot__day {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: clamp(4px, 1.1vh, 7px) 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  border-radius: 11px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.25s;
}

.slot__day b {
  font-size: 10.5px;
  font-weight: 520;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.slot__day span {
  font-size: 15px;
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
}

.slot__day[aria-checked='true'] {
  color: var(--ink);
}

.slot__day:focus-visible {
  outline: 2px solid var(--quiet);
  outline-offset: -2px;
}

/* the histogram of the hours */
.slot__chart {
  position: relative;
  height: clamp(52px, 15vh, 92px);
  margin-top: clamp(30px, 7.4vh, 40px);
  touch-action: none;
  cursor: grab;
}

.slot__chart.is-dragging {
  cursor: grabbing;
}

.slot__bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0 2px;
}

.slot__bar {
  flex: 1;
  height: 100%;
  transform-origin: 50% 100%;
}

.slot__bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px 4px 2px 2px;
  background: currentColor;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* the lens: a pane of glass two hours wide, moved by the spring */
.slot__lens {
  position: absolute;
  left: 0;
  top: -6px;
  bottom: -6px;
  width: 20%;
  outline: none;
  touch-action: none;
}

.slot__lens-glass {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03) 45%, rgba(255, 255, 255, 0.06));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -8px 16px -10px rgba(255, 255, 255, 0.18),
    0 8px 20px -6px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.slot__lens-shine {
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -40%;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-18deg);
}

.slot__lens:focus-visible .slot__lens-glass {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 0 2px var(--quiet);
}

.slot__lens-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  color: var(--ink);
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.slot__lens-grip {
  position: absolute;
  left: 50%;
  bottom: -9px;
  display: flex;
  gap: 2px;
  padding: 3px 5px;
  border-radius: 5px;
  transform: translateX(-50%);
  background: #2a2e33;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 4px rgba(0, 0, 0, 0.5);
}

.slot__lens-grip i {
  display: block;
  width: 1px;
  height: 6px;
  background: rgba(255, 255, 255, 0.45);
}

.slot__ticks {
  position: relative;
  height: 14px;
  margin-top: 12px;
  font-size: 10.5px;
  color: var(--muted);
}

.slot__ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* the fee */
.slot__fee {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(10px, 2.6vh, 16px);
  padding-top: clamp(10px, 2.6vh, 14px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.slot__fee-left {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.slot__fee-name {
  font-size: 12px;
  color: var(--muted);
}

.slot__tag {
  justify-self: start;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 560;
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--quiet);
  background: rgba(142, 240, 196, 0.08);
  box-shadow: inset 0 0 0 1px rgba(142, 240, 196, 0.18);
}

.slot__tag-words {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot__amount {
  display: flex;
  align-items: baseline;
  font-size: clamp(26px, min(8.4vw, 7.6vh), 32px);
  font-weight: 640;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.02em;
  line-height: 1;
}

.slot__col {
  display: inline-block;
  height: 1.08em;
  overflow: hidden;
  text-align: center;
}

.slot__col--d {
  width: 0.6em;
}

.slot__reel {
  display: block;
}

.slot__reel span {
  display: block;
  height: 1.08em;
  line-height: 1.08em;
}

.slot__fix {
  display: inline-block;
  line-height: 1.08em;
}

.slot__fix--cur {
  font-size: 0.62em;
  margin-right: 1px;
  color: var(--muted);
  align-self: flex-start;
  line-height: 1.2;
}

/* the button */
.slot__btn {
  position: relative;
  display: block;
  width: 100%;
  height: 46px;
  margin-top: clamp(10px, 2.6vh, 16px);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 8px 18px -8px rgba(0, 0, 0, 0.7);
  -webkit-tap-highlight-color: transparent;
}

.slot__btn:focus-visible {
  outline: 2px solid var(--quiet);
  outline-offset: 3px;
}

/* the light that runs round the button while it books */
.slot__btn-beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--a, 0deg), transparent 0 70%, var(--quiet) 86%, #ffffff 92%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
}

.slot__btn-face {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  padding: 0 18px;
}

.slot__btn-words {
  font-size: 14px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot__btn-icon {
  width: 0;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.slot__check {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

@media (hover: hover) {
  .slot__day:hover {
    color: var(--ink);
  }

  .slot__lens:hover .slot__lens-glass {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.45),
      inset 0 -8px 16px -10px rgba(255, 255, 255, 0.24),
      0 10px 24px -6px rgba(0, 0, 0, 0.65);
  }
}
