/*
  The menu, on a phone held in one hand in a restaurant.
  Every choice below follows from that sentence.

  Mobile first: no min-width query moves anything until 560px, because the
  phone layout IS the layout — the wider screens just get a centred column and
  two items per row rather than a different design.
*/

:root {
  --brand: #F64829;
  --brand-ink: #C3341A;
  --brand-tint: #FFF1ED;

  --ink: #15181D;
  --ink-soft: #5C6370;
  --ink-faint: #8B929D;
  --ink-ghost: #C2C7CF;

  --canvas: #F6F6F7;
  --surface: #FFFFFF;
  --border: #E9EAEE;
  --hairline: #F1F2F4;

  --radius: 14px;
  --radius-sm: 10px;

  /* Room for the home indicator on a notched phone. */
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/*
  `hidden` has to win.

  The attribute only sets `display: none` at the very bottom of the cascade, so
  any class below that sets a display — `.clear { display: flex }` — quietly
  beats it, and the element the markup says is hidden is on screen anyway.
  That is exactly what happened to the search box's clear button.
*/
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  /* Stops iOS inflating text when the phone is turned sideways. */
  -webkit-text-size-adjust: 100%;
}

body { overflow-x: hidden; }

/* The three faces of the page. */
.app, .message { display: none; }
body.is-loading .skeleton { display: block; }
body.is-ready .app { display: block; }
body.is-message .message { display: flex; }
.skeleton { display: none; }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

/* ── loading ───────────────────────────────────────────────────────────── */

/*
  A shape of the thing that is coming, not a spinner. On a slow connection
  outside a restaurant, a page that already looks like a menu is a far better
  wait than a turning circle on white.
*/
.skeleton { padding: 28px 16px 0; max-width: 620px; margin: 0 auto; }
.sk-head { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 30px; }
.sk-logo { width: 68px; height: 68px; border-radius: 999px; }
.sk-name { width: 170px; height: 20px; border-radius: 6px; }
.sk-list { display: flex; flex-direction: column; gap: 14px; }
.sk-row { display: flex; gap: 14px; align-items: center; background: var(--surface);
          border-radius: var(--radius); padding: 12px; }
.sk-thumb { width: 66px; height: 66px; border-radius: var(--radius-sm); flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.sk-lines i { display: block; height: 13px; width: 62%; border-radius: 5px; }
.sk-lines b { display: block; height: 13px; width: 32%; border-radius: 5px; }

.shimmer {
  background: linear-gradient(100deg, #ECEDEF 30%, #F6F6F8 50%, #ECEDEF 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -120% 0; } }

@media (prefers-reduced-motion: reduce) {
  .shimmer { animation: none; }
}

/* ── the shop ──────────────────────────────────────────────────────────── */

.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(26px + env(safe-area-inset-top, 0px)) 16px 22px;
  text-align: center;
}
.masthead-inner { max-width: 620px; margin: 0 auto; }

.logo {
  width: 76px; height: 76px;
  margin: 0 auto 13px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--brand-tint);
  color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 27px; font-weight: 800; letter-spacing: -0.5px;
  border: 1px solid var(--border);
}
.logo img { width: 100%; height: 100%; object-fit: cover; }

.shop {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.25;
  /* A long name wraps rather than pushing the page sideways. */
  overflow-wrap: anywhere;
}
.tagline {
  margin: 5px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── jump to a course ──────────────────────────────────────────────────── */

/*
  Sticky, and scrolled horizontally with a finger. A menu with eight courses
  is a lot of thumb-work otherwise, and this is the one control that earns its
  place at the top of the screen permanently.
*/
.jumper {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  padding: 11px 16px;
  overflow-x: auto;
  background: rgba(246, 246, 247, 0.94);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.jumper::-webkit-scrollbar { display: none; }
.jumper:empty { display: none; }

.chip {
  flex: none;
  scroll-snap-align: start;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip[aria-current="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ── search ────────────────────────────────────────────────────────────── */

.search-wrap { padding: 14px 16px 2px; max-width: 620px; margin: 0 auto; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 8px 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.search svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--ink-faint);
              stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  /* 16px exactly: anything smaller and iOS zooms the page on focus. */
  font-size: 16px;
  color: var(--ink);
}
.search input::-webkit-search-cancel-button { display: none; }
.clear {
  flex: none; width: 30px; height: 30px; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.clear svg { width: 15px; height: 15px; stroke: var(--ink-faint); }

/* ── the menu ──────────────────────────────────────────────────────────── */

.menu { max-width: 620px; margin: 0 auto; padding: 4px 16px 0; }

.course { padding-top: 20px; }

.course h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.course h2 .count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0;
}

/*
  Two cards a row on a phone. Not three — at 390px wide, three columns leave a
  picture about 110px across, which is too small to tell one stew from another,
  and that picture is the whole reason a card beats a list.
*/
.items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.item {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* The picture runs to the card's edges, so the radius has to be clipped
     here rather than repeated on the image. */
  overflow: hidden;
}

/*
  Every picture is the same square, whatever shape the photograph is.

  Two things are needed for that, and only having the first is the bug this
  replaced — a 1:3 portrait shot of muufo came out three times taller than the
  burger beside it:

  `aspect-ratio` alone is only a PREFERRED size. This box is a flex item, and a
  flex item will not shrink below its own content, so an `<img>` reporting its
  natural height pushed the box open and the aspect ratio was quietly ignored.

  So the image is taken out of the flow with `position: absolute`. An absolutely
  positioned child contributes nothing to its parent's size, which leaves the
  box free to be exactly what `aspect-ratio` says it is. `flex: none` stops the
  column stretching it as well, and `object-fit: cover` fills the square by
  cropping the long edge rather than squashing the picture.
*/
.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  flex: none;
  overflow: hidden;
  background: var(--brand-tint);
  color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Crop towards the middle, which is where the food is in almost every
     photograph somebody takes of a plate. */
  object-position: center;
}

/* Older phones that never got `aspect-ratio` still get a square. */
@supports not (aspect-ratio: 1 / 1) {
  .thumb { height: 0; padding-top: 100%; }
}

.item-body {
  padding: 11px 12px 13px;
  display: flex;
  flex-direction: column;
  /* Pushes the price to the bottom, so prices line up across a row even when
     one name wraps to two lines and its neighbour does not. */
  flex: 1;
}
.item-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  /* Two lines, then an ellipsis — a very long name must not push the price
     out of line with the card beside it. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-price {
  /* `auto`, not a fixed gap: this is what actually pushes the price to the
     bottom of the card, so prices sit on one line across a row even when one
     name wraps to two lines and its neighbour does not. `flex: 1` on the body
     only makes the box tall enough — it does not move anything inside it. */
  margin-top: auto;
  padding-top: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
}

.nothing {
  max-width: 620px;
  margin: 34px auto;
  padding: 0 16px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}

.foot {
  max-width: 620px;
  margin: 34px auto 0;
  padding: 20px 16px calc(26px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.6;
}
.foot .mark { font-weight: 800; letter-spacing: 0.4px; color: var(--ink-ghost); font-size: 11px; }

/* ── something went wrong ──────────────────────────────────────────────── */

.message {
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.message-inner { max-width: 340px; text-align: center; }
.message-icon {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 999px;
  background: var(--brand-tint);
  display: flex; align-items: center; justify-content: center;
}
.message-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--brand-ink);
                    stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.message h2 { margin: 0 0 8px; font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.message p { margin: 0; font-size: 14px; line-height: 1.65; color: var(--ink-soft); }
.retry {
  margin-top: 22px;
  height: 46px;
  padding: 0 26px;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* ── a bit more room ───────────────────────────────────────────────────── */

@media (min-width: 560px) {
  .items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .masthead { padding-top: 40px; padding-bottom: 28px; }
  .shop { font-size: 26px; }
  .logo { width: 88px; height: 88px; }
  .menu, .search-wrap, .foot, .masthead-inner { max-width: 820px; }
  .item-name { font-size: 14.5px; }
}

@media (min-width: 900px) {
  .items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .menu, .search-wrap, .foot, .masthead-inner { max-width: 1040px; }
}

/* ── dark ──────────────────────────────────────────────────────────────── */

/*
  Worth having: a menu gets read across a dinner table in low light, on a
  phone that has already switched itself dark.
*/
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #121317;
    --surface: #1B1D22;
    --border: #2A2D34;
    --hairline: #24272D;
    --ink: #F2F3F5;
    --ink-soft: #A8AEB9;
    --ink-faint: #7C838F;
    --ink-ghost: #4E545E;
    --brand-tint: #3A1A12;
    --brand-ink: #FF8266;
  }
  .jumper { background: rgba(18, 19, 23, 0.94); }
  .shimmer {
    background: linear-gradient(100deg, #1F2126 30%, #262930 50%, #1F2126 70%);
    background-size: 220% 100%;
  }
}
