/* peak: MENU section. Mobile first (390), then 768 and 1100+. Uses the tokens in styles.css :root.
   Phone: swipeable tab pills + a snap carousel of big cards. Tablet: 2-col grid. Desktop: a grid shaped by
   how many items the category has (5 = one big feature card + 4). */

.menu {
  --menu-pad: var(--gutter);
  position: relative;
  padding: 88px 0 72px;
  background: var(--mist);
  scroll-margin-top: 0;
  overflow: clip;
}
.menu__wrap { max-width: 1320px; margin-inline: auto; padding-inline: var(--menu-pad); }

/* ---------- head ---------- */
.menu__head { display: grid; gap: 18px; margin-bottom: 28px; }
.menu__kicker {
  display: flex; width: fit-content; align-items: center; gap: 10px;
  font-size: var(--fs-label, .75rem); font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
}
.menu__kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); flex: none; }
:lang(ar) .menu__kicker { font-size: .8125rem; }
.menu__title {
  position: relative; width: fit-content; margin-top: 12px;
  font-size: clamp(2.75rem, 1.7rem + 4.3vw, 5.75rem); font-weight: 600; line-height: .95; letter-spacing: -.035em;
}
:lang(ar) .menu__title { font-size: calc(clamp(2.75rem, 1.7rem + 4.3vw, 5.75rem) * 1.04); line-height: 1.25; }
.menu__heart {
  position: absolute; top: -.32em; inset-inline-end: -.62em; width: .62em; height: auto;
  fill: none; stroke: var(--pink-deep); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round;
  rotate: 12deg; overflow: visible;
}
[dir=rtl] .menu__heart { rotate: -12deg; }
.menu__note { display: flex; align-items: flex-start; gap: 10px; max-width: 40ch; font-size: .9375rem; line-height: 1.5; color: rgb(43 43 46 / .8); }
:lang(ar) .menu__note { line-height: 1.7; }
.menu__smile {
  width: 28px; height: 28px; flex: none; margin-top: -2px;
  fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; rotate: -8deg;
}

/* ---------- tabs: scrollable pills with one dark thumb that springs between them ---------- */
.menu__tabs {
  position: relative; isolation: isolate;
  display: flex; gap: 6px;
  margin-inline: calc(-1 * var(--menu-pad)); padding: 6px var(--menu-pad);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  scroll-padding-inline: var(--menu-pad);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--menu-pad), #000 calc(100% - var(--menu-pad)), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 var(--menu-pad), #000 calc(100% - var(--menu-pad)), transparent);
}
.menu__tabs::-webkit-scrollbar { display: none; }
.menu__thumb {
  position: absolute; z-index: -1; top: 6px; left: 0; height: 48px; width: 0;
  border-radius: 999px; background: var(--ink);
  box-shadow: 0 8px 20px rgb(43 43 46 / .22);
}
.menu__thumb.is-ready { transition: transform .62s var(--spring), width .5s var(--spring); }
.menu__tab {
  position: relative; flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  height: 48px; padding-inline: 18px 8px;
  border: 0; border-radius: 999px; background: rgb(43 43 46 / .06);
  font-size: .9375rem; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer;
  transition: color .3s var(--ease) .08s, background-color .3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.menu__tab[aria-selected=true] { color: var(--paper); background: transparent; }
@media (hover: hover) { .menu__tab:not([aria-selected=true]):hover { background: rgb(43 43 46 / .11); } }
.menu__tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--paper); }
.menu__count {
  display: grid; place-items: center; min-width: 30px; height: 30px; padding-inline: 6px;
  border-radius: 999px; background: rgb(43 43 46 / .08);
  font-size: .75rem; font-weight: 600;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.menu__tab[aria-selected=true] .menu__count { background: var(--pink); color: var(--ink); }
/* the signature tab gets a tiny pink heart */
.menu__tab--star > span:first-child::after {
  content: ""; display: inline-block; width: 11px; height: 10px; margin-inline-start: 6px; vertical-align: 1px;
  background: var(--pink-deep);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 20'%3E%3Cpath d='M11 19C4 14 0 10 .4 5.6.8 2 3.6 0 6.4.2 8.6.4 10 2 11 4c1-2 2.6-3.6 4.8-3.8C18.6 0 21.6 2.4 21.6 6 21.4 10.6 17 14.4 11 19z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 20'%3E%3Cpath d='M11 19C4 14 0 10 .4 5.6.8 2 3.6 0 6.4.2 8.6.4 10 2 11 4c1-2 2.6-3.6 4.8-3.8C18.6 0 21.6 2.4 21.6 6 21.4 10.6 17 14.4 11 19z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.menu__tab--star[aria-selected=true] > span:first-child::after { background: var(--pink); }

/* ---------- panel + phone carousel ---------- */
.menu__panel { margin-top: 22px; outline: none; timeline-scope: --menu-x; }
.menu__panel:focus-visible .menu__grid { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 30px; }
.menu__grid {
  display: flex; gap: 12px;
  margin-inline: calc(-1 * var(--menu-pad)); padding: 4px var(--menu-pad) 10px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--menu-pad);
  scroll-timeline: --menu-x inline;
}
.menu__grid::-webkit-scrollbar { display: none; }

/* ---------- card ---------- */
.dish {
  flex: 0 0 min(84vw, 360px); scroll-snap-align: start;
  display: flex; flex-direction: column;
  padding: 8px; border-radius: 30px; background: var(--paper);
  box-shadow: 0 1px 0 rgb(255 255 255 / .8) inset, 0 18px 40px -22px rgb(43 43 46 / .35);
  transition: translate .5s var(--ease), box-shadow .5s var(--ease);
}
.dish__media {
  position: relative; aspect-ratio: 1; overflow: hidden;
  border-radius: 23px 23px 0 0;
  background: var(--mist-2);
  /* the wavy door cut-out along the photo's bottom edge */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 0H100V95.5C92 99.5 84 99.5 75 96.5S58 92 50 95 33 99.5 25 96.5 8 92 0 95.5Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 0H100V95.5C92 99.5 84 99.5 75 96.5S58 92 50 95 33 99.5 25 96.5 8 92 0 95.5Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.dish__media img { width: 100%; height: 100%; object-fit: cover; transition: scale 1.1s var(--ease); }
.dish__price {
  position: absolute; top: 14px; inset-inline-end: 14px;
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 9px 13px 8px; border-radius: 999px;
  background: var(--pink); color: var(--ink);
  box-shadow: 0 6px 16px -6px rgb(43 43 46 / .45);
  rotate: -4deg; transition: rotate .6s var(--spring);
  white-space: nowrap;
}
[dir=rtl] .dish__price { rotate: 4deg; }
.dish__amt { font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dish__cur { font-size: .6875rem; font-weight: 600; letter-spacing: .08em; }
:lang(ar) .dish__cur { font-size: .8125rem; }
.dish__body { padding: 14px 12px 14px; }
.dish__name { font-size: 1.25rem; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; }
:lang(ar) .dish__name { line-height: 1.45; }
.dish__desc { margin-top: 6px; font-size: .9375rem; line-height: 1.45; color: rgb(43 43 46 / .74); }
:lang(ar) .dish__desc { line-height: 1.7; }

/* no photo yet (UBE Latte): a pink tile with the p */
.dish__ph {
  display: grid; place-items: center; align-content: center; gap: 14px; height: 100%;
  background: radial-gradient(120% 90% at 30% 20%, #EFA3C2, var(--pink) 60%);
}
.dish__ph svg { width: 34%; height: auto; fill: var(--paper); filter: drop-shadow(0 10px 18px rgb(43 43 46 / .18)); }
.dish__soon { font-size: .8125rem; font-weight: 600; color: var(--ink); }

@media (hover: hover) and (pointer: fine) {
  .dish:hover { translate: 0 -6px; box-shadow: 0 1px 0 rgb(255 255 255 / .8) inset, 0 28px 50px -24px rgb(43 43 46 / .45); }
  .dish:hover .dish__media img { scale: 1.05; }
  .dish:hover .dish__price { rotate: 3deg; }
  [dir=rtl] .dish:hover .dish__price { rotate: -3deg; }
}

/* scroll progress under the phone carousel (native scroll timeline; just hidden where unsupported) */
.menu__progress { display: none; }
@supports (animation-timeline: scroll()) {
  .menu__progress {
    display: block; height: 3px; margin: 14px auto 0; width: 96px; border-radius: 3px;
    background: rgb(43 43 46 / .12); overflow: hidden;
  }
  .menu__progress span {
    display: block; height: 100%; background: var(--ink); border-radius: inherit;
    transform-origin: left; animation: menu-progress linear both; animation-timeline: --menu-x;
  }
  [dir=rtl] .menu__progress span { transform-origin: right; }
}
@keyframes menu-progress { from { transform: scaleX(.18); } to { transform: scaleX(1); } }

/* ---------- tablet: 2-col grid; an odd count opens with a wide card ---------- */
@media (min-width: 768px) {
  .menu { --menu-pad: 32px; padding: 120px 0 104px; }
  .menu__head { gap: 22px; margin-bottom: 36px; }
  .menu__grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
    margin-inline: 0; padding: 0; overflow: visible; scroll-snap-type: none;
  }
  .menu__progress { display: none !important; }
  .dish { flex: none; }
  .menu__grid[data-count="3"] .dish:first-child,
  .menu__grid[data-count="5"] .dish:first-child {
    grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: end;
  }
  .menu__grid[data-count="3"] .dish:first-child .dish__body,
  .menu__grid[data-count="5"] .dish:first-child .dish__body { padding: 24px 22px; }
  .menu__grid[data-count="3"] .dish:first-child .dish__name,
  .menu__grid[data-count="5"] .dish:first-child .dish__name { font-size: 1.75rem; }
}

/* ---------- desktop: grid by count ---------- */
@media (min-width: 1100px) {
  .menu { --menu-pad: 40px; padding: 150px 0 140px; }
  .menu__head { grid-template-columns: 1fr auto; align-items: end; gap: 24px 48px; margin-bottom: 44px; }
  .menu__note { max-width: 34ch; margin-bottom: 8px; }
  .menu__tabs {
    width: fit-content; max-width: 100%; margin-inline: 0; padding: 6px;
    border-radius: 999px; background: var(--mist-2);
    -webkit-mask-image: none; mask-image: none;
  }
  .menu__tab { background: transparent; }
  .menu__panel { margin-top: 32px; }
  .menu__grid { gap: 20px; }
  .menu__grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 940px; }
  .menu__grid[data-count="3"],
  .menu__grid[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .menu__grid[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .menu__grid[data-count="5"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  /* undo the tablet wide card */
  .menu__grid[data-count="3"] .dish:first-child,
  .menu__grid[data-count="5"] .dish:first-child { grid-column: auto; display: flex; align-items: stretch; }
  .menu__grid[data-count="3"] .dish:first-child .dish__body { padding: 16px 14px; }
  .menu__grid[data-count="3"] .dish:first-child .dish__name { font-size: 1.375rem; }

  /* 5 items: the first is a 2x2 feature, its photo fills the height of two rows */
  .menu__grid[data-count="5"] .dish:first-child { grid-column: span 2; grid-row: span 2; }
  .menu__grid[data-count="5"] .dish:first-child .dish__media { flex: 1; aspect-ratio: auto; min-height: 0; }
  .menu__grid[data-count="5"] .dish:first-child .dish__media img,
  .menu__grid[data-count="5"] .dish:first-child .dish__ph { position: absolute; inset: 0; }
  .menu__grid[data-count="5"] .dish:first-child .dish__body { padding: 20px 18px 18px; }
  .menu__grid[data-count="5"] .dish:first-child .dish__name { font-size: 2rem; }
  .menu__grid[data-count="5"] .dish:first-child .dish__price { top: 22px; inset-inline-end: 22px; padding: 12px 18px 11px; }
  .menu__grid[data-count="5"] .dish:first-child .dish__amt { font-size: 1.5rem; }

  .dish__name { font-size: 1.375rem; }
  .menu__grid[data-count="4"] .dish__name { font-size: 1.1875rem; }
  .dish__body { padding: 16px 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .menu__thumb.is-ready, .menu__tab, .menu__count, .dish, .dish__media img, .dish__price { transition: none !important; }
}

/* ---------- motion v4: sizes, odometer price, wobble, tab squish, item loops ---------- */
.dish__vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s var(--ease), scale 1.1s var(--ease); pointer-events: none; }
.dish__vid.is-on { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .dish:hover .dish__vid { scale: 1.05; } }
.dish__body { flex: 1; display: flex; flex-direction: column; }
.dish__amt { display: inline-flex; direction: ltr; unicode-bidi: isolate; } /* digits stay in reading order in RTL */
.dg { position: relative; display: inline-block; overflow: clip; line-height: 1.15; }
.dg > span { display: inline-block; }
.dg > .dg__in { position: absolute; inset-inline-start: 0; top: 0; }
.dish__media { transform-style: preserve-3d; }

/* M / L: native radios (arrow keys move between them), one charcoal thumb springs to the checked one */
.size {
  position: relative; isolation: isolate; align-self: flex-start;
  display: inline-grid; grid-template-columns: 1fr 1fr; margin: auto 0 0; padding: 4px; border: 0;
  border-radius: 999px; background: var(--mist);
}
.dish__body:has(.size) .dish__desc { margin-bottom: 14px; }
.size__opt { position: relative; display: grid; place-items: center; min-width: 52px; height: 40px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.size__opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.size__opt span { font-size: .9375rem; font-weight: 600; transition: color .3s var(--ease) .05s; }
.size__opt:has(:checked) span { color: var(--paper); }
.size__opt:has(:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 999px; }
.size__thumb {
  position: absolute; z-index: -1; top: 4px; bottom: 4px; inset-inline-start: 4px; width: calc(50% - 4px);
  border-radius: 999px; background: var(--ink); box-shadow: 0 4px 10px rgb(43 43 46 / .25);
  transition: translate .55s var(--spring);
}
.size:has(input[value=L]:checked) .size__thumb { translate: 100% 0; }
[dir=rtl] .size:has(input[value=L]:checked) .size__thumb { translate: -100% 0; }
@media (hover: hover) { .size__opt:not(:has(:checked)):hover span { color: var(--pink-deep); } }

/* the tab presses in; the active count pops */
.menu__tab { transition: color .3s var(--ease) .08s, background-color .3s var(--ease), scale .3s var(--spring); }
.menu__tab:active { scale: .93; }

@media (prefers-reduced-motion: no-preference) {
  .menu__tab[aria-selected=true] .menu__count { animation: menu-pop .6s var(--spring); }
  @keyframes menu-pop { 0% { scale: .4; } 60% { scale: 1.18; } 100% { scale: 1; } }
  /* the price sticker wobbles like a loose sticker when you hover the card */
  @media (hover: hover) and (pointer: fine) {
    .dish:hover .dish__price { animation: dish-wobble .75s var(--ease) forwards; }
    [dir=rtl] .dish:hover .dish__price { animation-name: dish-wobble-rtl; }
  }
  @keyframes dish-wobble { 0% { rotate: -4deg; } 25% { rotate: 7deg; } 50% { rotate: -3deg; } 75% { rotate: 5deg; } 100% { rotate: 3deg; } }
  @keyframes dish-wobble-rtl { 0% { rotate: 4deg; } 25% { rotate: -7deg; } 50% { rotate: 3deg; } 75% { rotate: -5deg; } 100% { rotate: -3deg; } }
}
@media (prefers-reduced-motion: reduce) {
  .size__thumb, .size__opt span, .menu__tab { transition: none; }
}
