/* The delivery step of Fenwick Supply, a made-up stationery shop: one card alone on white, a single teal accent. */
:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: #e8e8e6;
  --tinta: #f4f4f2;          /* the segmented control, the tiles, the map land */
  --testo: #141414;
  --testo-2: #5b5b58;
  --testo-3: #9a9a95;
  --accento: #0f766e;        /* the single accent: the pill text, the chosen pin, the frame, the button */
  --accento-chiaro: #e3f2ef;
  --strada: #ffffff;         /* the roads on the map */
  --acqua: #e6ecee;
  --parco: #ecefe8;
  --ombra: 20, 22, 20;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(9px, min(3.55vw, 2.72vh), 16px); }
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; }
ul { list-style: none; }

.stage { height: 100vh; display: grid; place-items: center; padding: 2vh 4vw; }

/* the card: a body, a 1px edge that is lighter at the top, three soft shadows */
.card {
  position: relative;
  width: min(23em, 92vw);
  padding: 1.3em 1.3em 1.2em;
  border-radius: 1.5em;
  background: var(--carta);
  box-shadow:
    0 1px 1px rgba(var(--ombra), .05),
    0 6px 14px -6px rgba(var(--ombra), .10),
    0 24px 48px -24px rgba(var(--ombra), .22);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1em;
  isolation: isolate;
  overflow: clip;
}
.card__edge {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  padding: 1px;
  background: linear-gradient(180deg, #f2f2f0, var(--bordo) 30%, #e0e0dd);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.head { display: grid; gap: .3em; }
.head__eyebrow { font-size: .74em; color: var(--testo-3); font-stretch: 105%; letter-spacing: .02em; }
.head__title { font-size: 1.32em; font-weight: 620; letter-spacing: -.015em; font-stretch: 96%; }

/* the segmented control: two halves, a white pill that slides between them */
.seg {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  padding: .25em; border-radius: .9em;
  background: var(--tinta);
  box-shadow: inset 0 1px 1px rgba(var(--ombra), .06);
}
.seg__pill {
  position: absolute; top: .25em; bottom: .25em; left: .25em;
  width: calc(50% - .25em);
  border-radius: .7em; background: #fff;
  box-shadow: 0 1px 2px rgba(var(--ombra), .10), 0 3px 8px -3px rgba(var(--ombra), .14);
}
.seg__opt {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: .45em;
  height: 2.4em; border-radius: .7em;
  font-size: .92em; font-weight: 560; color: var(--testo-2);
  transition: color .3s ease;
}
.seg__opt[aria-checked="true"] { color: var(--testo); }
.seg__opt svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.seg__opt[aria-checked="true"] svg { stroke: var(--accento); }

/* the two panels share one cell; the cell's height is set by the script */
.panels { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); overflow: clip; }
.panel { grid-area: 1 / 1; align-self: start; display: grid; gap: .8em; align-content: start; }
.panel--pickup { visibility: hidden; }

.tile {
  flex: none;
  display: grid; place-items: center;
  width: 2.3em; height: 2.3em; border-radius: .7em;
  background: var(--tinta); color: var(--testo-2);
  transition: background-color .35s ease, color .35s ease;
}
.tile svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.addr {
  display: flex; align-items: center; gap: .8em;
  padding: .75em .85em; border-radius: 1em;
  border: 1px solid var(--bordo);
}
.addr__txt, .point__txt { display: grid; gap: .12em; min-width: 0; flex: 1; }
.addr__name, .point__name { font-size: .92em; font-weight: 600; }
.addr__line, .point__line { font-size: .78em; color: var(--testo-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr__price, .point__dist { font-size: .84em; font-weight: 560; font-variant-numeric: tabular-nums; color: var(--testo); }
.note { font-size: .78em; color: var(--testo-3); padding-left: .2em; }

/* the map: drawn, not a real place; the world moves inside a fixed window */
.map {
  position: relative;
  height: 7.6em;
  border-radius: 1em;
  overflow: hidden;
  background: var(--tinta);
  box-shadow: inset 0 0 0 1px rgba(var(--ombra), .06);
}
.map__svg { display: block; width: 100%; height: 100%; }
.map__fade {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 140% at 50% 50%, transparent 60%, rgba(255, 255, 255, .55));
}
.m-land { fill: var(--tinta); }
.m-park { fill: var(--parco); }
.m-water { fill: none; stroke: var(--acqua); stroke-width: 16; stroke-linecap: round; }
.m-blocks rect { fill: #ebebe7; }
.m-roads path { fill: none; stroke: var(--strada); stroke-width: 5.5; stroke-linecap: round; }
.m-lanes path { fill: none; stroke: var(--strada); stroke-width: 2.4; stroke-linecap: round; }
.m-you path { fill: var(--testo); }
.m-you__halo { fill: rgba(20, 20, 20, .06); stroke: rgba(20, 20, 20, .12); stroke-width: .8; }
.pin__drop { fill: #fff; stroke: #cfcfca; stroke-width: 1; }
.pin__glyph { fill: none; stroke: var(--testo-3); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.pin__shadow { fill: rgba(20, 20, 20, .16); }
.pin.is-on .pin__drop { fill: var(--accento); stroke: var(--accento); }
.pin.is-on .pin__glyph { stroke: #fff; }

/* the points: one row each; the frame of the chosen one draws itself */
.points { display: grid; gap: .4em; }
.point {
  position: relative;
  display: flex; align-items: center; gap: .8em;
  padding: .55em .75em .55em .55em;
  border-radius: 1em;
  cursor: pointer;
  outline: none;
  transition: background-color .3s ease;
}
.point::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  border: 1px solid var(--bordo); pointer-events: none;
  transition: opacity .3s ease;
}
.point.is-on::before { opacity: 0; }
.point.is-on .tile { background: var(--accento-chiaro); color: var(--accento); }
.point.is-on .point__dist { color: var(--accento); }
.point:focus-visible::before { border-color: var(--accento); }
@media (hover: hover) {
  .point:hover { background: #fafaf8; }
}
.point__frame { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.point__frame rect { fill: none; stroke: var(--accento); stroke-width: 1.5; stroke-dasharray: 1; stroke-dashoffset: 1; }

/* the button: three faces in the same place, each centred on its own */
.go {
  position: relative;
  height: 3em; border-radius: 1em;
  background: var(--testo); color: #fff;
  font-weight: 580; font-size: .95em;
  box-shadow: 0 1px 1px rgba(var(--ombra), .2), 0 8px 18px -10px rgba(var(--ombra), .5);
  overflow: hidden;
}
.go::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), transparent 55%);
}
.go__face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .5em; white-space: nowrap; }
.go__face svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.go__face--idle svg { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
@media (hover: hover) {
  .go:hover .go__face--idle svg { transform: translateX(3px); }
}
.go__face--busy, .go__face--done { opacity: 0; }
.go__face--busy svg { width: 1.45em; height: 1.45em; }
.go__track { stroke: rgba(255, 255, 255, .22); }
.go__face--done path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.go.is-done { background: var(--accento); }
.go { transition: background-color .4s ease; }
