/* The delivery street: the delivery choice of a plant shop's checkout, alone on a white page. Three cards; the chosen
   one opens a window onto a street drawn by the script in SVG, with the colours below. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #15241d;           /* titles, the ring of the card chosen */
  --muted: #5b6861;         /* the quieter words */
  --line: #dde3df;          /* the edge of a card */
  --line-strong: #b4c0b9;   /* the edge of a card under the pointer */
  --free: #17784a;          /* Free */
  --slot: #879289;          /* the empty slot where the parcel goes */
  --kraft: #c9965a;         /* the parcel that marks the choice */
  --tape: #ecd3a9;          /* its tape */
  --sky: #cfe7f0;           /* the sky over the street */
  --van: #2d6a4f;           /* the van, the courier's helmet */
  --bike: #f1ab3a;          /* the cargo bike's box, the courier's jacket */
  --shop: #245a42;          /* the shopfront */
  --road: #47504b;          /* the road */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

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

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

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

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 32px 16px;
}

.ship {
  width: min(400px, 100%);
  margin: 0;
}

.ship__set {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.ship__title {
  float: left;
  width: 100%;
  margin: 0 0 4px;
  padding: 0 4px;
  font-size: 18px;
  line-height: 24px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------- a card */
.opt {
  position: relative;
  display: block;
  border-radius: 18px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow 0.2s ease, transform 0.16s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.2s ease;
}

/* the ring of the card chosen: it comes in as the card opens */
.opt::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.opt.is-chosen::after {
  opacity: 1;
}

/* the radio itself is hidden but stays in the page: it takes the focus, the arrows and the clicks */
.opt__input {
  position: absolute;
  top: 50%;
  left: 24px;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.opt:has(.opt__input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.opt:active {
  transform: scale(0.985);
}

@media (hover: hover) {
  .opt:not(.is-chosen):not(:has(.opt__input:disabled)):hover {
    box-shadow: inset 0 0 0 1px var(--line-strong);
  }

  /* the slot fills with a shadow of the parcel that would go in it */
  .opt:not(.is-chosen):not(:has(.opt__input:disabled)):hover .sign__slot {
    stroke: var(--kraft);
    fill-opacity: 0.2;
    stroke-dasharray: none;
  }
}

/* a choice that cannot be made today */
.opt:has(.opt__input:disabled) {
  cursor: not-allowed;
  opacity: 0.5;
}

.opt:has(.opt__input:disabled):active {
  transform: none;
}

/* ---------------------------------------------------------------- the window onto the street */
/* the script sets the heights: the window keeps its round corners while it opens from its top edge, and the street
   inside stays on the card's words */
.opt__bay {
  position: relative;
  display: block;
  height: 0;
  overflow: hidden;
}

.opt__win {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 0;
  display: block;
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #f3f7ee;
  /* Safari: keep the round corners while the street inside moves */
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.world {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the words of a card */
.opt__row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  min-height: 64px;
  padding: 11px 18px 11px 14px;
}

.opt__text {
  display: grid;
  min-width: 0;
}

.opt__name {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.opt__when {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 450;
}

.opt__price {
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.opt__price.is-free {
  color: var(--free);
}

/* ---------------------------------------------------------------- the sign: a slot, and the parcel dropped in it */
.opt__sign {
  display: block;
  width: 28px;
  height: 28px;
  overflow: visible;
}

.sign__slot {
  fill: var(--kraft);
  fill-opacity: 0;
  stroke: var(--slot);
  stroke-width: 1.5;
  stroke-dasharray: 3.2 2.6;
  transition: stroke 0.2s ease, fill-opacity 0.2s ease;
}

.sign__kraft {
  fill: var(--kraft);
}

.sign__tape {
  fill: var(--tape);
  opacity: 0.9;
}

.sign__label {
  fill: #ffffff;
}

.sign__box {
  opacity: 0;
}

/* ---------------------------------------------------------------- when it arrives */
.ship__sum {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  min-height: 24px;
  margin: 16px 0 0;
  padding: 0 4px;
  color: var(--muted);
  font-size: 15px;
  line-height: 24px;
  white-space: nowrap;
}

/* every word is a slot that changes its width, and the word inside rolls */
.sum__w {
  position: relative;
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  height: 24px;
}

.sum__w + .sum__w {
  margin-left: 0.27em;
}

.sum__w > span {
  display: block;
}

.sum__w.is-date {
  color: var(--ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- the street's own colours */
.world,
.defs {
  --sky-low: #f3f7ec;
  --cloud: #ffffff;
  --hill-far: #d6e8da;
  --hill: #b9d7c0;
  --tree: #8dbb95;
  --tree-dark: #6f9f7a;
  --trunk: #8c7058;
  --house-a: #f0dfc6;
  --house-b: #dae6ec;
  --house-c: #efd6cd;
  --roof: #a7b9c2;
  --window: #a8c4d1;
  --grass: #a9ce97;
  --pavement: #e7e2d8;
  --kerb: #cfc8bb;
  --lane: #eef1ea;
  --van-dark: #215039;
  --glass: #d4e9ee;
  --cream: #f4eedf;
  --tyre: #1f2522;
  --hub: #c6cec9;
  --frame: #25332d;
  --skin: #c48d6a;
  --trousers: #33413b;
  --shop-dark: #1a4231;
  --wall: #efe6d6;
  --leaf: #4f9a5f;
  --leaf-dark: #3a7c4a;
  --pot: #ebe4d6;
}

.w-sky-top { stop-color: var(--sky); }
.w-sky-low { stop-color: var(--sky-low); }
.w-cloud { fill: var(--cloud); opacity: 0.92; }
.w-hill-far { fill: var(--hill-far); }
.w-hill { fill: var(--hill); }
.w-tree { fill: var(--tree); }
.w-tree-dark { fill: var(--tree-dark); }
.w-trunk { fill: var(--trunk); }
.w-house-a { fill: var(--house-a); }
.w-house-b { fill: var(--house-b); }
.w-house-c { fill: var(--house-c); }
.w-roof { fill: var(--roof); }
.w-window { fill: var(--window); }
.w-grass { fill: var(--grass); }
.w-pavement { fill: var(--pavement); }
.w-kerb { fill: var(--kerb); }
.w-road { fill: var(--road); }
.w-lane { fill: var(--lane); }
.w-van { fill: var(--van); }
.w-van-dark { fill: var(--van-dark); }
.w-glass { fill: var(--glass); }
.w-cream { fill: var(--cream); }
.w-tyre { fill: var(--tyre); }
.w-hub { fill: var(--hub); }
.w-bike { fill: var(--bike); }
.w-skin { fill: var(--skin); }
.w-shop { fill: var(--shop); }
.w-shop-dark { fill: var(--shop-dark); }
.w-wall { fill: var(--wall); }
.w-leaf { fill: var(--leaf); }
.w-leaf-dark { fill: var(--leaf-dark); }
.w-pot { fill: var(--pot); }
.w-kraft { fill: var(--kraft); }
.w-tape { fill: var(--tape); }
.w-shade { fill: #000000; opacity: 0.16; }
.w-frame { fill: none; stroke: var(--frame); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.w-spokes { fill: none; stroke: #9aa39e; stroke-width: 0.6; }
.w-tyre-ring { fill: none; stroke: var(--tyre); stroke-width: 2.6; }
.w-rim { fill: none; stroke: #8b948f; stroke-width: 0.8; }
.w-limb { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.w-leg { stroke: var(--trousers); stroke-width: 6.2; }
.w-leg-far { stroke: #26312c; stroke-width: 6.2; }
.w-arm { stroke: var(--bike); stroke-width: 5; }
.w-torso { stroke: var(--bike); stroke-width: 11; }
.w-shoe { stroke: #1d2420; stroke-width: 4; }
.w-crank { fill: none; stroke: #59615d; stroke-width: 1.8; stroke-linecap: round; }
.w-hand { stroke: #1f2a25; stroke-width: 1.4; stroke-linecap: round; fill: none; }
.w-text { fill: var(--cream); font-family: 'Gabarito Variable', system-ui, sans-serif; font-weight: 700; }

@media (max-width: 380px) {
  .opt__row {
    padding-right: 14px;
    column-gap: 10px;
  }
}
