:root {
  --page: #f2ede6;          /* warm paper behind the card */
  --card: #fbf9f6;          /* the card */
  --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 table */
  --wood-deep: #8a5f3b;     /* the table's grain and edge */
  --ceramic: #fbf7f0;       /* the rim of the plates */

  --plate: clamp(58px, min(15vw, 17.5vh), 150px);
  --pad: clamp(12px, 3vh, 28px);
  --gap: clamp(16px, 4vw, 44px);
}

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

html, body { height: 100%; }

body {
  background:
    radial-gradient(120% 80% at 50% 0%, #fbf8f3 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;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 8px;
}

/* ---- the card ---- */
.card {
  position: relative;
  width: min(860px, 96vw);
  padding: var(--pad);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, var(--card) 40%);
  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 6px 14px -6px rgba(60, 35, 10, 0.12),
    0 24px 48px -18px rgba(60, 35, 10, 0.18),
    0 60px 90px -40px rgba(70, 90, 40, 0.16);
  isolation: isolate;
}

/* the top edge catches the lamp */
.card__edge {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: radial-gradient(90% 50% at 28% 0%, rgba(255, 200, 150, 0.55), transparent 60%);
  -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 exclude, linear-gradient(#000 0 0);
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  padding-bottom: clamp(8px, 2.2vh, 16px);
  margin-bottom: clamp(10px, 2.6vh, 22px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; 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: 17px; font-weight: 560; letter-spacing: -0.01em; }
.brand__sub { color: var(--ink-mute); font-variation-settings: "wdth" 92; white-space: nowrap; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  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;
  position: relative;
  padding-left: 8px;
}
.tab > :not(.tab__fill) { position: relative; }
/* the green that runs through the pill when a dish arrives; drawn with a clip so the round ends stay round */
.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); }
/* the dish that went in: it sits behind the front of the basket and peeks over the rim */
.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: -4px;
  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 two views share the same place */
.views { position: relative; display: grid; }
.views > * { grid-area: 1 / 1; }
/* both views keep their own layer for good: when the browser drops a layer after a fade it draws the text again, and the
   whole card twitches a second after everything has stopped */
.fav, .cat { will-change: opacity, transform; }

/* ---- the landing: the table and the words ---- */
.fav {
  display: grid;
  grid-template-columns: calc(var(--plate) * 2.75) minmax(0, 300px);
  justify-content: center;
  align-items: center;
  gap: var(--gap);
}

.table {
  position: relative;
  width: calc(var(--plate) * 2.75);
  height: calc(var(--plate) * 2.6);
  border-radius: 22px;
}
/* oiled wood: long soft grain, darker towards the edges, a lamp from the top left */
.table__wood {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    repeating-linear-gradient(92deg, rgba(90, 55, 25, 0) 0 9px, rgba(90, 55, 25, 0.07) 9px 10px, rgba(90, 55, 25, 0) 10px 23px, rgba(255, 230, 200, 0.05) 23px 24px),
    repeating-linear-gradient(88deg, rgba(70, 40, 15, 0) 0 37px, rgba(70, 40, 15, 0.08) 37px 39px),
    radial-gradient(140% 110% at 50% 50%, transparent 55%, rgba(60, 30, 10, 0.32) 100%),
    linear-gradient(170deg, #c79b6c 0%, var(--wood) 45%, #a8784d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 235, 210, 0.35),
    inset 0 0 0 1px rgba(80, 45, 20, 0.25),
    0 2px 3px rgba(60, 35, 10, 0.18),
    0 20px 36px -16px rgba(60, 35, 10, 0.4);
}
.table__lamp {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(70% 60% at 30% 22%, rgba(255, 236, 205, 0.32), transparent 70%);
  mix-blend-mode: soft-light;
}

/* a plate: a ceramic rim with the photo inside, a paper tag with its part of the menu */
.plate {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--plate);
  height: var(--plate);
  margin: calc(var(--plate) / -2) 0 0 calc(var(--plate) / -2);
  border-radius: 20px;
  z-index: 1;
}
.plate.is-on { z-index: 2; }
.plate:focus-visible { outline: none; }
.plate:focus-visible .plate__rim { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.plate__lift {
  position: absolute;
  inset: 0;
  display: block;
  will-change: transform;
}
.plate__rim {
  position: absolute;
  inset: 0;
  display: block;
  padding: 5%;
  border-radius: 20px;
  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 calc(2px + var(--lift, 0) * 4px) calc(3px + var(--lift, 0) * 6px) rgba(40, 20, 5, calc(0.28 - var(--lift, 0) * 0.08)),
    0 calc(10px + var(--lift, 0) * 16px) calc(18px + var(--lift, 0) * 26px) calc(-8px - var(--lift, 0) * 4px) rgba(40, 20, 5, calc(0.4 + var(--lift, 0) * 0.08));
}
.plate__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
/* the gloss of the glaze: it sits on the rim, under the lamp */
.plate__gloss {
  position: absolute;
  inset: 5%;
  border-radius: 14px;
  pointer-events: none;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0) 32%),
    radial-gradient(60% 40% at 24% 12%, rgba(255, 255, 255, 0.18), transparent 70%);
  mix-blend-mode: screen;
}
/* the veil over the plates you are not on */
.plate__rim::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(120, 80, 45, 0.5);
  opacity: var(--dim, 0);
  pointer-events: none;
}
.plate__tag {
  position: absolute;
  left: 50%;
  bottom: -9px;
  translate: -50% 0;
  rotate: calc(var(--r) * -1.4);
  padding: 2px 7px 3px;
  border-radius: 3px;
  background: #fffdf8;
  color: var(--ink-soft);
  font-size: clamp(8.5px, 1.4vh, 10.5px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-variation-settings: "wdth" 92;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 5px -1px rgba(40, 20, 5, 0.3);
}
.plate.is-on .plate__tag { color: var(--accent); }

/* ---- the words of the plate you are on ---- */
.info {
  display: grid;
  justify-items: start;
  gap: clamp(3px, 0.9vh, 8px);
  min-width: 0;
}
.info__kicker {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.info__mask { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; }
.info__mask > span { display: inline-block; }
.info__cat {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-variation-settings: "wdth" 104;
}
.info__name {
  font-size: clamp(20px, min(3.4vw, 5vh), 32px);
  line-height: 1.05;
  font-weight: 640;
  letter-spacing: -0.025em;
  font-variation-settings: "wdth" 106;
  min-height: 1.1em;
  white-space: nowrap;
}
.info__line {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  max-width: 30ch;
  /* always the room of two lines: ingredients on one line or two must not move the price and the buttons */
  min-height: 2.8em;
}
.price {
  display: inline-flex;
  align-items: flex-start;
  height: 1.2em;
  overflow: hidden;
  font-size: clamp(20px, min(3vw, 4.4vh), 26px);
  line-height: 1.2em;
  font-weight: 650;
  color: var(--accent);
  margin-top: clamp(0px, 0.6vh, 4px);
}
.price__cur { font-size: 0.62em; margin-right: 2px; line-height: 1.6; }
/* the digit window fades at its top and bottom edges, so a figure rolling past shows as a soft blur and not as a cut sliver */
.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; }

.info__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: clamp(4px, 1.2vh, 10px); }

/* Order: the elastic pill */
.order { height: 40px; border-radius: 999px; }
.order__face {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding: 0 18px 0 14px;
  border-radius: inherit;
  background: linear-gradient(180deg, #2b2520 0%, #171310 100%);
  color: #fbf6ef;
  font-size: 13.5px;
  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 starters: the quiet pill with an arrow that leans forward */
.all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--ink);
  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); }

@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; }
}

/* ---- one part of the menu ---- */
/* the page of a part stays in the layout, only hidden: so the card keeps the same height going there and back, and
   nothing on the table moves when the page goes away */
.cat {
  visibility: hidden;
  display: grid;
  align-content: start;
  gap: clamp(8px, 2.2vh, 18px);
  min-width: 0;
}
.cat__top { display: flex; align-items: center; gap: 14px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  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.14);
  flex: none;
}
.cat__title {
  font-size: clamp(24px, min(4.4vw, 6.4vh), 44px);
  line-height: 1;
  font-weight: 660;
  letter-spacing: -0.03em;
  font-variation-settings: "wdth" 112;
  white-space: nowrap;
}
.cat__body {
  display: grid;
  grid-template-columns: calc(var(--plate) * 1.9) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
.cat__hero {
  position: relative;
  display: block;
  width: calc(var(--plate) * 1.9);
  aspect-ratio: 1;
  border-radius: 24px;
  background: linear-gradient(150deg, #ffffff 0%, var(--ceramic) 50%, #ece4d8 100%);
  /* the same four shadows as a plate, in the same order: the plate that flies turns from one into the other */
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 rgba(120, 90, 60, 0.18),
    0 2px 3px 0 rgba(40, 20, 5, 0.2),
    0 18px 34px -14px rgba(40, 20, 5, 0.42);
}
.cat__hero .plate__gloss { border-radius: 18px; }
.cat__img { position: absolute; inset: 5%; display: block; width: 90%; height: 90%; object-fit: cover; border-radius: 18px; }

.dishes { list-style: none; display: grid; gap: 0; min-width: 0; }
.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(6px, 1.5vh, 12px) 0;
  border-bottom: 1px solid var(--line);
}
.dish__name { grid-area: name; font-size: clamp(14px, 2.4vh, 16px); 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; color: var(--ink); }
.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); }

/* ---- 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: 20px;
  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 4px 8px 0 rgba(40, 20, 5, 0.2),
    0 26px 44px -16px rgba(40, 20, 5, 0.5);
  pointer-events: none;
  visibility: hidden;
}
/* the photo sits 5% in from the rim of the flyer itself: a padding in percent would count the card's width */
.flyer img { position: absolute; inset: 5%; display: block; width: 90%; height: 90%; object-fit: cover; border-radius: 14px; }
.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; }

/* ---- narrow: the table on top, the words under it ---- */
@media (max-width: 640px) {
  :root {
    --plate: clamp(52px, min(23vw, 15.5vh), 120px);
    --pad: clamp(10px, 2.6vh, 18px);
    --gap: clamp(10px, 2.6vh, 18px);
  }
  .card { width: min(440px, 96vw); border-radius: 20px; }
  .brand__sub { display: none; }
  .fav { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .table { width: min(100%, calc(var(--plate) * 3)); height: calc(var(--plate) * 2.5); }
  .info { width: 100%; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 12px; }
  .info__kicker, .info__line { display: none; }
  .info__cat, .info__name { grid-column: 1; }
  .price { grid-column: 2; grid-row: 1 / span 2; justify-self: end; align-self: end; }
  .info__actions { grid-column: 1 / -1; margin-top: 2px; }
  .order, .all { height: 36px; }
  .order__face, .all { font-size: 13px; }
  .cat__body { grid-template-columns: calc(var(--plate) * 1.3) minmax(0, 1fr); }
  .cat__hero { width: calc(var(--plate) * 1.3); border-radius: 18px; }
  .cat__img, .cat__hero .plate__gloss { border-radius: 13px; }
  .dish__line { display: none; }
  .cat__title { font-size: clamp(20px, 5.6vh, 30px); }
}
@media (max-height: 520px) {
  .dish__line, .info__line { display: none; }
}
