/* The cake order form with the choices that change the price: a warm white card on a white page, a real photo of the
   cake on top with the words piped over it as you type, a sliding size control, three flavours, a strip of pick-up
   days and a price that rolls at every choice. One accent: raspberry. */
:root {
  --page: #ffffff;            /* the page */
  --card: #fffdfa;            /* the card */
  --edge: rgba(48, 28, 24, 0.09); /* the 1px edge of the card and the fields */
  --ink: #1f1a19;             /* the words and the button */
  --muted: #8d8480;           /* the small words */
  --well: #f4efea;            /* the groove of the size control and the day strip */
  --accent: #b5345a;          /* raspberry: the choices, the piping, the order */
  --accent-soft: #fbecef;     /* the flavour that is chosen */
}

* {
  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;
  border: 0;
  padding: 0;
  margin: 0;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vh, 24px) 12px;
  overflow: hidden;
}

button {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------------------------------------------------------- the card */
.order {
  position: relative;
  width: min(396px, 92vw);
  padding: clamp(5px, 1.2vh, 7px);
  border-radius: 24px;
  background: var(--card);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(48, 28, 24, 0.05),
    0 6px 14px -6px rgba(48, 28, 24, 0.08),
    0 30px 64px -26px rgba(48, 28, 24, 0.24);
  opacity: 0;
}

/* ---------------------------------------------------------------- the photo and the piping */
.order__photo {
  position: relative;
  margin: 0;
  height: clamp(66px, 19vh, 176px);
  border-radius: 18px;
  overflow: hidden;
  background: #e9e7e5;
  isolation: isolate;
}

/* GSAP scales this wrapper (the cake grows with the size); the image inside keeps its own slow breath */
.order__zoom {
  position: absolute;
  inset: 0;
  transform-origin: 50% 88%;
}

.order__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 26%;
  transform-origin: 50% 70%;
}

/* a hair of light along the top edge like glass, and a soft shade at the bottom so the name reads */
.order__photo::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 16%),
    linear-gradient(0deg, rgba(24, 14, 12, 0.5), rgba(24, 14, 12, 0.08) 40%, transparent 58%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  border-radius: inherit;
  pointer-events: none;
}

/* the words written on the cake, in the empty light wall above the candles */
.order__piping {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 4%;
  z-index: 1;
  display: block;
  height: 1.3em;
  text-align: center;
  white-space: nowrap;
  font-family: 'Dancing Script Variable', 'Snell Roundhand', cursive;
  font-size: clamp(17px, 5.4vh, 31px);
  font-weight: 640;
  line-height: 1.25;
  color: var(--accent);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 14px rgba(255, 255, 255, 0.9),
    0 2px 6px rgba(120, 20, 50, 0.16);
  pointer-events: none;
}

.order__piping .ch {
  display: inline-block;
  white-space: pre;
}

.order__shop {
  position: absolute;
  left: clamp(10px, 3.6vw, 14px);
  right: 10px;
  bottom: clamp(6px, 1.6vh, 10px);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.order__shop-name {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(13px, 3.4vh, 16px);
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
  font-weight: 520;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* a small frosted label that says how many the cake serves */
.order__shop-tag {
  display: inline-block;
  padding: 3px 8px 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.3);
  backdrop-filter: blur(8px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-size: 10.5px;
  font-weight: 560;
  font-stretch: 104%;
  text-shadow: none;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the body */
.order__body {
  padding: clamp(7px, 1.8vh, 15px) clamp(9px, 3.2vw, 13px) clamp(3px, 0.8vh, 7px);
  display: grid;
  gap: clamp(6px, 1.6vh, 13px);
}

.order__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.order__title {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(16px, 4.6vh, 23px);
  font-variation-settings: 'opsz' 48, 'SOFT' 30;
  font-weight: 480;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

.order__sub {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  line-height: 1.25;
  min-width: 0;
}

/* ---------------------------------------------------------------- the size control */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row__label {
  font-size: 12px;
  font-weight: 540;
  color: var(--muted);
}

.seg {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(204px, 62%);
  padding: 3px;
  border-radius: 999px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(48, 28, 24, 0.08), inset 0 0 0 1px rgba(48, 28, 24, 0.04);
}

/* GSAP moves and sizes the thumb in pixels; the face inside carries the squash */
.seg__thumb {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 0;
  pointer-events: none;
}

.seg__thumb-face {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #fbf8f5);
  box-shadow:
    0 0 0 1px rgba(48, 28, 24, 0.08),
    0 1px 1px rgba(48, 28, 24, 0.06),
    0 3px 8px -2px rgba(48, 28, 24, 0.16),
    inset 0 1px 0 #fff;
}

.seg__opt {
  position: relative;
  z-index: 1;
  height: clamp(24px, 6.4vh, 30px);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 560;
  font-stretch: 100%;
  color: var(--muted);
  font-feature-settings: 'lnum' 1;
  transition: color 0.25s ease, font-stretch 0.3s ease;
}

.seg__opt[aria-checked='true'] {
  color: var(--ink);
  font-stretch: 112%;
}

.seg__opt:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

/* ---------------------------------------------------------------- the flavours */
.flavours {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.chip {
  border-radius: 999px;
  flex: 1 1 auto;
  min-width: 0;
}

.chip__face {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: clamp(26px, 7vh, 33px);
  padding: 0 clamp(7px, 2.4vw, 11px);
  border-radius: inherit;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--edge), 0 1px 2px rgba(48, 28, 24, 0.05);
  font-size: 12.5px;
  font-weight: 520;
  font-stretch: 96%;
  white-space: nowrap;
  transition: background-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease, font-stretch 0.3s ease;
}

/* the tick lives in a box that opens from zero width, so the word slides over to make room */
.chip__tick {
  width: 0;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  overflow: visible;
}

.chip__tick path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.chip__add {
  font-size: 10.5px;
  font-weight: 560;
  color: var(--accent);
  opacity: 0.8;
}

.chip[aria-checked='true'] .chip__face {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent), 0 1px 2px rgba(181, 52, 90, 0.08);
  font-stretch: 104%;
}

.chip:focus-visible {
  outline: none;
}

.chip:focus-visible .chip__face {
  box-shadow: inset 0 0 0 1px var(--edge), 0 0 0 2px var(--card), 0 0 0 3.5px var(--accent);
}

/* ---------------------------------------------------------------- the words on the cake */
.words {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: clamp(30px, 7.8vh, 38px);
  padding: 0 11px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 1px 2px rgba(48, 28, 24, 0.04);
  cursor: text;
  transition: box-shadow 0.25s ease;
}

.words:focus-within,
.words.is-typing {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.words__pen {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.25s ease;
}

.words:focus-within .words__pen,
.words.is-typing .words__pen {
  stroke: var(--accent);
}

.words__field {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}

.words__field::placeholder {
  color: #b5aca7;
}

.words__price {
  font-size: 11px;
  font-weight: 560;
  color: #b5aca7;
  transition: color 0.25s ease;
}

.words.has-text .words__price {
  color: var(--accent);
}

/* ---------------------------------------------------------------- the pick-up days */
.days {
  display: grid;
  gap: clamp(3px, 0.8vh, 6px);
}

.days__head {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 540;
  color: var(--muted);
}

.days__time {
  font-weight: 450;
}

.days__strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 3px;
  border-radius: 14px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(48, 28, 24, 0.07), inset 0 0 0 1px rgba(48, 28, 24, 0.04);
}

.days__thumb {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 0;
  border-radius: 11px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 84%, #fff), var(--accent) 62%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 1px 1px rgba(120, 20, 50, 0.2),
    0 4px 10px -3px rgba(181, 52, 90, 0.5);
  opacity: 0;
  pointer-events: none;
}

.day {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0;
  height: clamp(32px, 8.6vh, 44px);
  border-radius: 11px;
  color: var(--ink);
  transition: color 0.25s ease;
}

.day__w {
  font-size: 10px;
  font-weight: 520;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: color 0.25s ease;
}

.day__n {
  font-size: clamp(13px, 3.4vh, 15px);
  font-weight: 600;
  font-stretch: 100%;
  font-feature-settings: 'lnum' 1;
  line-height: 1.1;
  transition: font-stretch 0.3s ease;
}

.day[aria-checked='true'] {
  color: #fff;
}

.day[aria-checked='true'] .day__w {
  color: rgba(255, 255, 255, 0.82);
}

.day[aria-checked='true'] .day__n {
  font-stretch: 112%;
}

/* closed on Mondays: struck through with a thin line */
.day:disabled {
  cursor: not-allowed;
  color: #c2b9b4;
}

.day:disabled .day__w {
  color: #c9c1bc;
}

.day:disabled::after {
  content: '';
  position: absolute;
  left: 30%;
  right: 30%;
  top: 50%;
  height: 1px;
  background: currentColor;
  transform: rotate(-24deg);
}

.day:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

/* ---------------------------------------------------------------- the price and the button */
.foot {
  display: flex;
  align-items: center;
  gap: 10px;
}

.price {
  position: relative;
  display: flex;
  align-items: flex-start;
  flex: none;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-variation-settings: 'opsz' 96, 'SOFT' 0;
  font-weight: 460;
  letter-spacing: -0.03em;
  font-size: clamp(24px, 6.8vh, 34px);
  line-height: 1;
}

.price__cur {
  font-size: 0.56em;
  margin: 0.08em 0.06em 0 0;
  color: var(--muted);
}

.price__digits {
  display: flex;
}

.price__win {
  position: relative;
  display: block;
  width: 0.6em;
  height: 1em;
  overflow: hidden;
  /* soft edges so the digits roll in from nothing */
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent);
}

.price__drum {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
}

.price__digit {
  display: block;
  height: 1em;
  line-height: 1;
  text-align: center;
  font-feature-settings: 'lnum' 1;
}

/* the small +$14 that rises from the price when a choice changes it */
.price__delta {
  position: absolute;
  left: 100%;
  top: -0.25em;
  margin-left: 2px;
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.place {
  flex: 1;
  min-width: 0;
  border-radius: 14px;
}

.place__face {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(36px, 9.6vh, 46px);
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(180deg, #37302e, var(--ink) 55%);
  color: #fffaf8;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 1px rgba(24, 14, 12, 0.2),
    0 8px 18px -8px rgba(24, 14, 12, 0.45);
  font-size: 13.5px;
  font-weight: 560;
  font-stretch: 104%;
  letter-spacing: 0.005em;
}

/* a slow sheen that crosses the dark button now and then */
.place__face::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 34%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(var(--sheen, 0%));
  pointer-events: none;
}

/* the accent that sweeps in while it orders, and stays for the confirmation */
.place__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 84%, #fff), var(--accent) 60%);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.place__state {
  grid-area: 1 / 1;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.place__state--done {
  opacity: 0;
  font-stretch: 94%;
  gap: 6px;
}

.place__arrow,
.place__check {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.place__arrow {
  transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.place__check path {
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.place:focus-visible {
  outline: none;
}

.place:focus-visible .place__face {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--accent);
}

@media (hover: hover) {
  .seg__opt:not([aria-checked='true']):hover {
    color: var(--ink);
  }

  .chip:hover .chip__face {
    box-shadow: inset 0 0 0 1px rgba(48, 28, 24, 0.18), 0 2px 6px -2px rgba(48, 28, 24, 0.12);
  }

  .chip[aria-checked='true']:hover .chip__face {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 2px 6px -2px rgba(181, 52, 90, 0.2);
  }

  .day:not(:disabled):not([aria-checked='true']):hover {
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 1px 2px rgba(48, 28, 24, 0.06);
  }

  .words:hover:not(:focus-within) {
    box-shadow: inset 0 0 0 1px rgba(48, 28, 24, 0.16), inset 0 1px 2px rgba(48, 28, 24, 0.04);
  }

  .place:hover .place__face {
    background: linear-gradient(180deg, #433a37, #2a2321 55%);
  }

  .place:hover .place__arrow {
    transform: translateX(2px);
  }
}

/* on short screens (the phone box) the line under the title goes, everything else stays */
@media (max-height: 470px) {
  .order__sub {
    display: none;
  }
}

@media (max-width: 360px) {
  .chip__add {
    display: none;
  }
}

/* on a low photo (the phone box) the frame shows the candles and the top of the cake, with the wall for the words */
@media (max-height: 560px) {
  .order__img {
    object-position: 50% 14%;
  }
}
