:root {
  --page: #efe9e1;          /* warm paper behind the phone screen */
  --card: #fbf9f6;          /* the screen */
  --ink: #1f1a16;           /* the chosen words */
  --ink-soft: #6e665d;      /* the notes */
  --ink-mute: #a69c91;      /* the quiet words */
  --line: rgba(60, 40, 20, 0.09);
  --accent: #2f7a52;        /* agave green: the one accent, the price, the order, the favourite */
  --wood: #b98a5e;          /* the turntable */
  --wood-deep: #8a5f3b;     /* its rings and edge */
  --ceramic: #fbf7f0;       /* the rim of the plates */

  --side: clamp(14px, 4.6vw, 22px);
  --P: 80px;                /* the size of a plate, worked out by the script from the room there is */
  --D: 220px;               /* the size of the tray */
  --cy: 50%;                /* where the middle of the tray sits */
  --H: clamp(72px, min(34vw, 21vh), 150px);   /* the photo at the top of the sheet */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(120% 80% at 50% 0%, #f8f4ee 0%, transparent 60%),
    var(--page);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

.stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 12px;
}

/* ---- the screen of the app: phone shaped on a big screen, the whole screen on a phone ---- */
.app {
  position: relative;
  width: min(400px, 100%);
  height: min(860px, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 34px;
  background: linear-gradient(180deg, #ffffff 0%, var(--card) 30%);
  border: 1px solid rgba(70, 45, 20, 0.08);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 1px 1px rgba(60, 35, 10, 0.06),
    0 10px 24px -10px rgba(60, 35, 10, 0.16),
    0 40px 80px -30px rgba(60, 35, 10, 0.26);
  overflow: hidden;
  isolation: isolate;
}
@media (max-width: 480px) {
  .stage { padding: 0; }
  .app { width: 100%; height: 100%; border-radius: 0; border: 0; box-shadow: none; }
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(10px, 2.4vh, 18px) var(--side) clamp(6px, 1.2vh, 10px);
  font-size: 12.5px;
}
.brand { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.brand__mark { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.brand__name { font-family: "Fraunces Variable", Georgia, serif; font-size: 18px; font-weight: 560; letter-spacing: -0.01em; }

/* the order pill with the basket: the dishes ordered drop into it */
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  background: #f4efe8;
  box-shadow: inset 0 0 0 1px rgba(70, 45, 20, 0.07), inset 0 1px 0 #fff;
  white-space: nowrap;
  font-weight: 520;
}
.tab > :not(.tab__fill) { position: relative; }
.tab__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(47, 122, 82, 0.2), rgba(47, 122, 82, 0.12));
  box-shadow: inset 0 0 0 1px rgba(47, 122, 82, 0.28);
  clip-path: inset(0 100% 0 0 round 999px);
  pointer-events: none;
}
.cart { display: inline-block; width: 16px; height: 16px; color: var(--ink); }
.cart__item { position: absolute; left: 50%; top: -2px; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px #fff; visibility: hidden; }
.cart__body { fill: #ece4d8; }
.cart svg { position: relative; display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.cart__slats { opacity: 0.55; }
.tab__plus { position: absolute !important; right: 6px; top: -5px; font-size: 11px; font-weight: 650; color: var(--accent); visibility: hidden; pointer-events: none; }
.tab__count { display: inline-block; height: 1.25em; line-height: 1.25em; overflow: hidden; color: var(--accent); font-weight: 650; margin-left: 2px; padding-left: 8px; border-left: 1px solid rgba(70, 45, 20, 0.14); }
.tab__col { display: inline-block; width: 0.66em; height: 1.25em; overflow: hidden; vertical-align: top; text-align: center; -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 16%, #000 84%, transparent 100%); mask-image: linear-gradient(180deg, transparent 0%, #000 16%, #000 84%, transparent 100%); }
.tab__col > span { display: block; }
.tab__col > span > span { display: block; height: 1.25em; }

/* ---- the favourites: the words on top, the turntable, the bar under the thumb ---- */
.fav {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 0 var(--side) max(clamp(10px, 2.4vh, 22px), env(safe-area-inset-bottom));
  will-change: opacity, transform;
}
.words { display: grid; justify-items: center; text-align: center; gap: clamp(1px, 0.5vh, 5px); padding-top: clamp(2px, 1vh, 10px); }
.words__kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-mute); }
.mask { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; }
.mask > span { display: inline-block; }
.words__part { font-size: 13px; font-weight: 600; color: var(--accent); font-variation-settings: "wdth" 104; }
.words__name { font-size: clamp(22px, min(7.4vw, 4.6vh), 32px); line-height: 1.05; font-weight: 640; letter-spacing: -0.025em; font-variation-settings: "wdth" 106; white-space: nowrap; min-height: 1.1em; }
.words__line { font-size: 13px; line-height: 1.4; color: var(--ink-soft); min-height: 1.4em; white-space: nowrap; }
@media (max-height: 600px) { .words__kicker { display: none; } }
@media (max-height: 470px) { .words__line { display: none; } }

/* the turntable: drag sideways to turn it */
.spin {
  position: relative;
  min-height: 0;
  touch-action: none;
  cursor: grab;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
.spin.is-dragging { cursor: grabbing; }
.spin:focus-visible .tray__wood { box-shadow: 0 0 0 3px rgba(47, 122, 82, 0.45), inset 0 0 0 1px rgba(255, 235, 210, 0.35); }
.tray, .spin__lamp, .spin__shadow {
  position: absolute;
  left: calc(50% - var(--D) / 2);
  top: calc(var(--cy) - var(--D) / 2);
  width: var(--D);
  height: var(--D);
  border-radius: 50%;
}
.spin__shadow {
  transform: translateY(calc(var(--D) * 0.05)) scale(0.97);
  background: radial-gradient(closest-side, rgba(60, 35, 10, 0.32), rgba(60, 35, 10, 0.12) 70%, transparent 100%);
  filter: blur(10px);
}
.tray { will-change: transform; }
/* turned wood: rings of growth around the middle, a lighter face and a darker bevelled edge */
.tray__wood {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 230, 200, 0) 0 7px, rgba(110, 70, 35, 0.08) 7px 8px, rgba(255, 230, 200, 0) 8px 13px),
    radial-gradient(circle at 50% 50%, #c99b6d 0%, var(--wood) 55%, #a87a4f 86%, var(--wood-deep) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 235, 210, 0.35),
    inset 0 0 0 calc(var(--D) * 0.035) rgba(120, 75, 35, 0.22),
    inset 0 -6px 14px rgba(70, 40, 15, 0.25);
}
/* the brass pin the tray turns on */
.tray__pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--D) * 0.07);
  height: calc(var(--D) * 0.07);
  margin: calc(var(--D) * -0.035) 0 0 calc(var(--D) * -0.035);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3dcae 0%, #c79b55 45%, #7d5a26 100%);
  box-shadow: 0 1px 2px rgba(40, 20, 5, 0.4), inset 0 0 0 1px rgba(255, 245, 220, 0.4);
}
.spin__lamp {
  pointer-events: none;
  /* a plain see-through light, not a blend mode: a blend over a turning tray makes the phone repaint all of it on every frame */
  background: radial-gradient(70% 55% at 38% 22%, rgba(255, 240, 215, 0.2), transparent 70%);
}

.plate {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--P);
  height: var(--P);
  margin: calc(var(--P) / -2) 0 0 calc(var(--P) / -2);
  border-radius: 50%;
  outline: none;
  /* each plate on its own layer: lifting one never makes the phone draw the tray and the others again */
  will-change: transform;
}
/* the wide soft shadow of the plate at the front: drawn once, only its opacity changes */
.plate__glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 28px 2px rgba(40, 20, 5, 0.44);
  opacity: 0;
  will-change: opacity;
}
.plate__lift { position: absolute; inset: 0; display: block; will-change: transform; }
.plate__rim {
  position: absolute;
  inset: 0;
  display: block;
  padding: 6%;
  border-radius: 50%;
  background: linear-gradient(150deg, #ffffff 0%, var(--ceramic) 50%, #ece4d8 100%);
  /* the shadow falls straight down: the plates turn with the tray, so a shadow to one side would turn with them. It
     never changes: the plate at the front gets its wider shadow from .plate__glow */
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 rgba(120, 90, 60, 0.18),
    0 0 2px 0 rgba(40, 20, 5, 0.3),
    0 0 10px -2px rgba(40, 20, 5, 0.3);
}
.plate__img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; user-select: none; -webkit-user-select: none; pointer-events: none; }
.plate__gloss {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  pointer-events: none;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 32%),
    radial-gradient(60% 40% at 24% 12%, rgba(255, 255, 255, 0.12), transparent 70%);
}
/* the veil over the plates that are not at the front: only its opacity changes */
.plate__veil {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(120, 80, 45, 0.5);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}
.plate:focus-visible .plate__rim { outline: 2px solid var(--accent); outline-offset: 3px; }

/* the parts of the menu under the tray: the one at the front in ink */
.parts {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: clamp(10px, 4vw, 18px);
  font-size: 11.5px;
  font-weight: 560;
  letter-spacing: 0.02em;
  color: var(--ink-mute);
  pointer-events: none;
}
/* only the colour fades: a change of width on the letters would make the phone set the text again on every frame */
.parts span { transition: color 0.35s ease; }
.parts span.is-on { color: var(--ink); }

/* ---- the bar under the thumb ---- */
.bar { display: flex; align-items: center; gap: 8px; padding-top: clamp(6px, 1.4vh, 12px); }
.price {
  display: inline-flex;
  align-items: flex-start;
  height: 1.2em;
  overflow: hidden;
  margin-right: auto;
  font-size: clamp(22px, 6.4vw, 28px);
  line-height: 1.2em;
  font-weight: 650;
  color: var(--accent);
}
.price__cur { font-size: 0.6em; margin-right: 2px; line-height: 1.6; }
.price__col {
  display: inline-block;
  width: 0.62em;
  height: 1.2em;
  overflow: hidden;
  text-align: center;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 86%, transparent 100%);
}
.price__col > span { display: block; }
.price__col > span > span { display: block; height: 1.2em; }

.order { height: 44px; border-radius: 999px; }
.order__face {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding: 0 17px 0 14px;
  border-radius: inherit;
  background: linear-gradient(180deg, #2b2520 0%, #171310 100%);
  color: #fbf6ef;
  font-size: 14px;
  font-weight: 560;
  font-variation-settings: "wdth" 100;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 1px rgba(30, 15, 5, 0.25), 0 8px 18px -8px rgba(30, 15, 5, 0.45);
  white-space: nowrap;
  transition: background 0.35s ease, font-variation-settings 0.35s ease;
}
.order.is-added .order__face { background: linear-gradient(180deg, #3a8c61 0%, #276b46 100%); }
.order__icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.order__tick { stroke-dasharray: 1; stroke-dashoffset: 1; }
.order__words, .all__words { display: inline-block; overflow: hidden; height: 1.3em; line-height: 1.3em; vertical-align: middle; }
.order__words > span, .all__words > span { display: inline-block; }
.all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 14px 0 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 560;
  box-shadow: inset 0 0 0 1px rgba(70, 45, 20, 0.16);
  font-variation-settings: "wdth" 100;
  white-space: nowrap;
  transition: box-shadow 0.3s ease, font-variation-settings 0.35s ease;
}
.all__arrow, .back__arrow { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: translate 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.order:active .order__face { font-variation-settings: "wdth" 112; }
@media (hover: hover) {
  .order:hover .order__face { font-variation-settings: "wdth" 112; }
  .all:hover { box-shadow: inset 0 0 0 1px rgba(47, 122, 82, 0.55); font-variation-settings: "wdth" 110; }
  .all:hover .all__arrow { translate: 3px 0; }
  .back:hover .back__arrow { translate: -3px 0; }
}
@media (max-width: 350px) {
  .order__face, .all { font-size: 13px; }
  .order__face { padding: 0 14px 0 12px; }
  .all { padding: 0 12px 0 13px; }
}

/* ---- the sheet with one part of the menu ---- */
.veil { position: absolute; inset: 0; z-index: 4; background: rgba(35, 22, 10, 0.26); opacity: 0; visibility: hidden; pointer-events: none; }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: calc(100% - clamp(40px, 9vh, 70px));
  display: flex;
  flex-direction: column;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #ffffff 0%, var(--card) 22%);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.9) inset, 0 -12px 30px -14px rgba(40, 20, 5, 0.3);
  visibility: hidden;
  will-change: transform;
}
.sheet__grip { flex: none; display: grid; place-items: center; height: 22px; touch-action: none; cursor: grab; }
.sheet__handle { width: 38px; height: 4px; border-radius: 999px; background: rgba(70, 45, 20, 0.18); }
.sheet__top {
  flex: none;
  display: grid;
  grid-template-columns: var(--H) minmax(0, 1fr);
  align-items: end;
  gap: 14px;
  padding: 2px var(--side) clamp(8px, 1.8vh, 14px);
  touch-action: none;
}
.hero {
  position: relative;
  display: block;
  width: var(--H);
  height: var(--H);
  border-radius: 50%;
  background: linear-gradient(150deg, #ffffff 0%, var(--ceramic) 50%, #ece4d8 100%);
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 rgba(120, 90, 60, 0.18),
    0 0 4px 0 rgba(40, 20, 5, 0.18),
    0 10px 24px -8px rgba(40, 20, 5, 0.36),
    /* a fifth, empty shadow: the plate that flies here has five, and both must have the same list to blend into each other */
    0 0 0 0 rgba(40, 20, 5, 0);
}
.hero__img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: cover; border-radius: 50%; }
.hero .plate__gloss { border-radius: 50%; }
.sheet__words { display: grid; justify-items: start; gap: 4px; min-width: 0; padding-bottom: 4px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  margin-bottom: 4px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 1px rgba(70, 45, 20, 0.16);
}
.sheet__title { font-size: clamp(24px, min(8vw, 5vh), 36px); line-height: 1; font-weight: 680; letter-spacing: -0.03em; font-variation-settings: "wdth" 112; }
.sheet__count { font-size: 12.5px; color: var(--ink-mute); }
.dishes { list-style: none; flex: 1; min-height: 0; overflow: auto; padding: 0 var(--side) 16px; overscroll-behavior: contain; }
.dish {
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr auto;
  grid-template-areas: "name lead price" "line line line";
  align-items: baseline;
  column-gap: 8px;
  padding: clamp(7px, 1.6vh, 13px) 0;
  border-bottom: 1px solid var(--line);
}
.dish__name { grid-area: name; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; font-variation-settings: "wdth" 104; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dish__lead { grid-area: lead; align-self: end; height: 1px; margin-bottom: 0.32em; background-image: radial-gradient(circle, rgba(70, 45, 20, 0.35) 0.7px, transparent 0.9px); background-size: 5px 1px; }
.dish__price { grid-area: price; font-size: 14px; font-weight: 600; }
.dish__line { grid-area: line; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.dish__fav { display: inline-block; margin-left: 7px; padding: 1px 6px 2px; border-radius: 999px; background: rgba(47, 122, 82, 0.1); color: var(--accent); font-size: 10px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; vertical-align: 2px; }
.dish.is-fav .dish__price { color: var(--accent); }
@media (max-height: 520px) { .dish__line { display: none; } }

/* ---- the plate that flies, the little copy that goes to the order ---- */
.flyer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  display: block;
  border-radius: 50%;
  background: linear-gradient(150deg, #ffffff 0%, var(--ceramic) 50%, #ece4d8 100%);
  pointer-events: none;
  visibility: hidden;
}
.flyer img { position: absolute; inset: 6%; display: block; width: 88%; height: 88%; object-fit: cover; border-radius: 50%; }
.chip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 7;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2px #fff, 0 6px 14px -4px rgba(40, 20, 5, 0.5);
  pointer-events: none;
  visibility: hidden;
}
.chip img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* the drawn pointer of the pilot */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #ffffff;
  stroke: #1d1a17;
  stroke-width: 1.4;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 9;
  filter: drop-shadow(0 2px 3px rgba(30, 15, 5, 0.25));
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
