/* ============================================================================
 *  The public digital menu.
 *
 *  Built for one situation: somebody at a table, one-handed, on a phone,
 *  possibly on a slow connection. So it is a single column of rows, the type
 *  is large enough to read at arm's length, and nothing moves.
 *
 *  Colours come from the shop's own theme via tokens.css and theme.css — the
 *  same two variables the stamp card uses — so a shop's menu looks like their
 *  shop and never like ours.
 *
 *  The last section is the printable table-tent sheet from the panel. It lives
 *  here rather than in admin.css because the sheet is a document of its own —
 *  it loads this file and nothing else, so that a print stylesheet never has
 *  to fight a sidebar it cannot see.
 * ==========================================================================*/

*, *::before, *::after { box-sizing: border-box; }

/* Anything the script hides has to actually go. Rows below are flex, which
   beats the browser's own [hidden] rule, and a "hidden" row that still takes
   up space is worse than no search at all. */
[hidden]{ display: none !important; }

/* For labels that belong to the screen reader and to nobody else. */
.vh{
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.menu-body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body, system-ui, -apple-system, 'Segoe UI', sans-serif);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

img{ max-width: 100%; height: auto; display: block; }

/* ----------------------------------------------------------------- head --- */
.menu-head{
  background: var(--main);
  color: var(--on-main);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
}
/* The name lines up with the dishes on a wide screen. Left against the window
   edge while every card was centred read as two different pages. */
@media (min-width: 673px){
  .menu-head{
    padding-inline: calc((100% - 640px) / 2 + 16px);
  }
}
.menu-logo{
  flex: none; width: 44px; height: 44px; margin: 0;
  border-radius: 12px; background: #fff; object-fit: cover;
}
.menu-head h1{
  margin: 0; font-size: 1.2rem; line-height: 1.2; font-weight: 700;
  letter-spacing: -0.01em;
}
.menu-sub{
  margin: 1px 0 0; font-size: .68rem; letter-spacing: .14em;
  text-transform: uppercase; opacity: .72;
}
.menu-note{ flex-basis: 100%; }
.menu-note{
  margin: 12px auto 0; max-width: 34ch; font-size: .82rem; opacity: .8;
}

/* ------------------------------------------------------- the sticky bar --- */
/* The search box and the section chips ride together at the top of the page.
   The bar itself is bare: with scripting off the search box is not there, and
   a shop with one section has no chips, so an empty bar has to leave no trace.
   Each child carries its own padding and rule instead. */
.menu-bar{
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  /* Without this the chips scroll over the cards with nothing between them,
     and a dish name shows through the gaps as it passes underneath. */
  box-shadow: 0 1px 0 var(--line), 0 6px 14px -12px rgb(16 24 40 / 35%);
}

/* --------------------------------------------------------------- search --- */
/* Hidden until the page has proved it can run a script. A search box that
   does not search is worse than no search box. */
.menu-search{ display: none; }
.js .menu-search{
  display: block;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.menu-search input{
  width: 100%; max-width: 640px; margin: 0 auto; display: block;
  padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface, #fff); color: var(--text);
  font: inherit; font-size: 1rem;   /* 16px — anything smaller zooms iOS in */
  -webkit-appearance: none; appearance: none;
}
.menu-search input:focus-visible{
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* ---------------------------------------------------------------- chips --- */
/* Scrolls sideways rather than wrapping — a menu can have ten sections and
   three lines of wrapped chips would push the food off the screen. */
.menu-chips{
  display: flex; gap: 8px; overflow-x: auto;
  /* The bar spans the window so its underline does, but the chips line up
     with the items below. justify-content:center would do it on a phone and
     then clip the first chip the moment the sections overflow, so the
     centring is padding instead. */
  padding: 10px 16px;
  padding-inline-start: max(16px, calc((100% - 640px) / 2 + 16px));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.menu-chips::-webkit-scrollbar{ display: none; }
.menu-chips a{
  flex: none; padding: 7px 14px; border-radius: 999px;
  background: var(--surface-2, rgb(0 0 0 / 5%));
  color: var(--text); text-decoration: none;
  font-size: .85rem; font-weight: 600; white-space: nowrap;
}
.menu-chips a:active{ background: var(--accent); color: var(--accent-ink, #fff); }

/* ----------------------------------------------------------------- body --- */
.menu-wrap{ max-width: 640px; margin: 0 auto; padding: 8px 16px 40px; }

.menu-section{ padding-top: 22px; scroll-margin-top: 60px; }
.menu-section h2{
  margin: 0; font-size: 1.1rem; font-weight: 700;
  color: var(--accent-ink, var(--text));
  display: flex; align-items: center; gap: 10px;
}
/* A rule running off to the right, so a category reads as a divider rather
   than as one more bold line among the dish names. */
.menu-section h2::after{
  content: ''; flex: 1 1 auto; height: 1px; background: var(--line);
}
.menu-secsub{ margin: 2px 0 0; font-size: .84rem; color: var(--text-muted); }
.menu-hours{ font-weight: 600; }

.menu-list{ list-style: none; margin: 12px 0 0; padding: 0; }

/* Favourites sit above the food, are built in the browser, and say so — a
   diner who cleared their phone should not think the shop lost their list. */
.menu-favs{ padding-top: 18px; }
.menu-favs h2::before{ content: '♥ '; color: #b3261e; }

/* ------------------------------------------------------------- the item --- */
/* A card, not a row between two hairlines. Cards give the eye somewhere to
   stop, which matters most on the menus that have no photographs at all. */
.menu-item{
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 4%);
  transition: box-shadow .16s ease, transform .16s ease;
}
@media (hover: hover){
  .menu-item:hover{ box-shadow: 0 6px 18px rgb(16 24 40 / 8%); transform: translateY(-1px); }
}
.menu-item:last-child{ margin-bottom: 0; }

/* ------------------------------------------------------ the picture slot --- */
/* ALWAYS drawn, photograph or not — see the note in menu.php. A slot that
   disappears on the items without a photo is what left the old list with a
   ragged edge and nothing to rest on. */
.mi-pic{
  flex: none; width: 76px; height: 76px;
  border-radius: 12px; object-fit: cover;
  background: var(--surface-2, rgb(0 0 0 / 4%));
}

/* The stand-in: the item's initial on a tint fixed by its own name, so the
   same dish is always the same colour. Deliberately not a drawing of food —
   a picture of somebody else's momo beside a shop that sells coffee would be
   a lie about their menu. */
.mi-pic-none{
  display: grid; place-items: center;
  font-family: var(--font-display, inherit);
  font-size: 1.75rem; font-weight: 700; line-height: 1;
  color: var(--on-main, #fff);
  background: var(--main);
  user-select: none;
}
/* Six genuinely different tiles, each still half the shop's own colour so a
   list of them reads as one menu rather than a paint chart. Mixing six shades
   of --main alone was the first attempt and produced six near-identical
   browns — a placeholder that varies invisibly is not varying at all. */
.mi-pic-none[data-tint="0"]{ background: linear-gradient(145deg, color-mix(in oklab, var(--main) 55%, #C2703C), color-mix(in oklab, var(--main) 80%, #8A4520)); }
.mi-pic-none[data-tint="1"]{ background: linear-gradient(145deg, color-mix(in oklab, var(--main) 52%, #3F7D5A), color-mix(in oklab, var(--main) 80%, #1F4A33)); }
.mi-pic-none[data-tint="2"]{ background: linear-gradient(145deg, color-mix(in oklab, var(--main) 50%, var(--accent)), color-mix(in oklab, var(--main) 82%, var(--accent))); }
.mi-pic-none[data-tint="3"]{ background: linear-gradient(145deg, color-mix(in oklab, var(--main) 52%, #3C6E8F), color-mix(in oklab, var(--main) 80%, #1E4055)); }
.mi-pic-none[data-tint="4"]{ background: linear-gradient(145deg, color-mix(in oklab, var(--main) 55%, #8E4A6B), color-mix(in oklab, var(--main) 82%, #58253E)); }
.mi-pic-none[data-tint="5"]{ background: linear-gradient(145deg, color-mix(in oklab, var(--main) 58%, #6B6152), color-mix(in oklab, var(--main) 84%, #3A342B)); }

.mi-body{ flex: 1 1 auto; min-width: 0; }

/* The name and the price on one line, price hard right — the two things
   somebody is actually comparing down the page. */
.mi-top{ display: flex; align-items: baseline; gap: 12px; }
.mi-top h3{
  margin: 0; font-size: 1rem; font-weight: 650; line-height: 1.35;
  flex: 1 1 auto; min-width: 0;
}
.mi-price{ flex: none; font-weight: 700; white-space: nowrap; }

/* The veg / non-veg mark, beside the NAME rather than in the chip row.
   It is the one badge a lot of people scan a menu for, and down among four
   others in four colours it was the hardest of the five to find. The square
   outline with a dot inside is the convention here; keeping it means nobody
   has to be taught what it is. */
.mi-diet{
  display: inline-block; vertical-align: 2px;
  width: 13px; height: 13px; margin-right: 5px;
  border-radius: 3px; border: 1.5px solid currentColor;
  position: relative;
}
.mi-diet::after{
  content: ''; position: absolute; inset: 2.5px;
  border-radius: 50%; background: currentColor;
}
.mi-diet.is-veg{    color: #1a7f4b; }
.mi-diet.is-nonveg{ color: #b3261e; }

.mi-desc{
  margin: 4px 0 0; font-size: .87rem; color: var(--text-muted);
}

/* ------------------------------------------------------------ the heart --- */
/* Shown only once a script has run, because it saves into localStorage and
   there is nothing for it to do otherwise. 44px of touch target: this is
   pressed with a thumb, next to a price. */
.mi-fav{ display: none; }
.js .mi-fav{
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 40px; height: 40px; margin: -9px -8px -9px 0;
  padding: 0; border: 0; cursor: pointer;
  border-radius: 50%;
  background: var(--surface-2, rgb(0 0 0 / 4%));
  color: var(--text-soft, var(--text-muted)); line-height: 1;
  -webkit-tap-highlight-color: transparent;
  transition: background .14s ease, color .14s ease;
}
.mi-heart{ font-size: 1.05rem; transition: transform .12s ease; }
.mi-fav:active .mi-heart{ transform: scale(1.25); }
.mi-fav.is-on{ background: #fdecea; color: #b3261e; }
.mi-fav:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------------- the sizes --- */
/* When an item is priced by its options, this list IS the price. Rows on their
   own tinted strip rather than joined by leader dots: the dots were a line of
   noise across every row, and at three sizes they made the item look like a
   table of contents. */
.mi-opts{
  list-style: none; margin: 10px 0 0; padding: 0;
  font-size: .88rem;
  border-radius: 10px; overflow: hidden;
  background: var(--surface-2, rgb(0 0 0 / 3%));
}
.mi-opts li{
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 10px;
}
.mi-opts li + li{ border-top: 1px solid var(--line); }
.mo-name{ color: var(--text-muted); min-width: 0; }
.mo-dots{ display: none; }   /* the strip does the joining now */
.mo-price{ flex: none; font-weight: 700; white-space: nowrap; }

/* ------------------------------------------------------------- the tags --- */
/* Everything except the diet mark. Quieter and fewer: five chips in five
   colours under every item turned the list into a bag of stickers. */
.mi-tags{ display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.mi-tag{
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .7rem; font-weight: 650; letter-spacing: .02em;
  background: var(--surface-2, rgb(0 0 0 / 5%)); color: var(--text-muted);
}
.mi-dot{ width: 8px; height: 8px; border-radius: 2px; }

.mi-tag.is-popular{ background: var(--accent); color: var(--accent-ink, #3a2a00); }
.mi-tag.is-spice{   color: #8c1d18; }
/* Sold out stays on the page, faded and labelled. Removing it would mean the
   shop retyping it tomorrow — and a customer wondering where it went.
   The heart is deliberately left at full strength: a sold-out favourite is
   still a favourite, and a faded control reads as a disabled one. */
.menu-item.is-out .mi-pic,
.menu-item.is-out .mi-top h3,
.menu-item.is-out .mi-price,
.menu-item.is-out .mi-opts,
.menu-item.is-out .mi-desc{ opacity: .45; }
.menu-item.is-out .mi-top h3{ text-decoration: line-through; }
.mi-tag.is-soldout{ background: #b3261e; color: #fff; }

.menu-empty{
  margin: 48px auto; max-width: 30ch; text-align: center; color: var(--text-muted);
}

/* ----------------------------------------------------------------- foot --- */
.menu-foot{
  padding: 24px 16px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
}
.menu-foot p{ margin: 0; font-size: .78rem; color: var(--text-muted); }

/* ---------------------------------------------------------------- wider --- */
@media (min-width: 620px){
  .menu-head{ padding: 40px 20px 32px; }
  .menu-head h1{ font-size: 1.9rem; }
  .mi-pic{ width: 88px; height: 88px; }
}

/* ============================================================================
 *  THE PRINTABLE SHEET  —  admin/menu.php?print=tents
 *
 *  One A4 page carrying the same QR at three sizes: a folding table tent for
 *  the middle of a table, two counter cards, and three small stickers for the
 *  edge of a table or the back of a bill folder.
 *
 *  Everything is in millimetres, because the output is paper. Black on white
 *  and no photographs, because the printer this comes out of belongs to a
 *  small shop and toner is money. The dashed rules are cut and fold lines.
 * ==========================================================================*/

.tent-body{
  margin: 0; background: var(--bg, #f4f4f5);
  color: #111; font-family: var(--font-body, system-ui, -apple-system, 'Segoe UI', sans-serif);
}

/* The instructions above the paper — screen only. */
.tent-bar{
  max-width: 210mm; margin: 0 auto; padding: 20px 16px;
  color: var(--text, #111);
}
.tent-bar h1{ margin: 0; font-size: 1.35rem; }
.tent-bar p{ margin: 8px 0 0; font-size: .9rem; color: var(--text-muted, #555); max-width: 68ch; }
.tent-bar .tent-acts{ display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tent-bar a, .tent-bar button{
  font: inherit; font-size: .9rem; font-weight: 650; cursor: pointer;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line, #d4d4d8); background: transparent;
  color: var(--text, #111); text-decoration: none;
}
.tent-bar button{ background: var(--main, #16323f); color: var(--on-main, #fff); border-color: transparent; }

.tent-sheet{
  width: 210mm; min-height: 297mm; margin: 0 auto 40px;
  padding: 10mm; background: #fff; color: #111;
  box-shadow: 0 2px 24px rgb(0 0 0 / 14%);
}
.tent-row{ display: flex; gap: 6mm; justify-content: center; margin-bottom: 6mm; }
.tent-row:last-child{ margin-bottom: 0; }

.tent{
  border: 1px dashed #9a9a9a; border-radius: 2mm;
  background: #fff; text-align: center;
  break-inside: avoid; page-break-inside: avoid;
}
.tent-face{ padding: 5mm 4mm; }

/* The big one folds down the middle and stands up, so the upper half is
   printed upside down — folded, both sides read the right way round. */
.tent-lg{ width: 190mm; }
.tent-lg .is-flip{ transform: rotate(180deg); }
.tent-fold{
  border-top: 1px dashed #9a9a9a;
  font-size: 7pt; letter-spacing: .18em; text-transform: uppercase; color: #777;
  padding: 1mm 0;
}
.tent-md{ width: 92mm; }
.tent-sm{ width: 58mm; }
.tent-sm .tent-face{ padding: 3mm 2mm; }

.tent-shop{ font-size: 13pt; font-weight: 700; line-height: 1.2; }
.tent-lg .tent-shop{ font-size: 17pt; }
.tent-sm .tent-shop{ font-size: 10pt; }

.tent-kicker{
  font-size: 7.5pt; letter-spacing: .2em; text-transform: uppercase;
  color: #555; margin-top: 1mm;
}
.tent-qr{ display: flex; justify-content: center; margin: 3mm 0 2mm; }
.tent-qr canvas, .tent-qr img{ width: 30mm; height: 30mm; }
.tent-lg .tent-qr canvas, .tent-lg .tent-qr img{ width: 34mm; height: 34mm; }
.tent-sm .tent-qr canvas, .tent-sm .tent-qr img{ width: 26mm; height: 26mm; }

.tent-call{ font-size: 9.5pt; font-weight: 700; }
.tent-sm .tent-call{ font-size: 8pt; }
.tent-url{
  font-size: 7pt; color: #555; margin-top: 1mm;
  word-break: break-all; line-height: 1.3;
}
.tent-sm .tent-url{ display: none; }   /* 26mm of QR and a URL is a smudge */

.tent-fallback{
  padding: 6mm; font-size: 9pt; color: #8c1d18;
}

@media print{
  @page{ size: A4; margin: 0; }
  .tent-body{ background: #fff; }
  .no-print{ display: none !important; }
  .tent-sheet{
    width: auto; min-height: 0; margin: 0; padding: 8mm;
    box-shadow: none;
  }
  .tent{ border-color: #bbb; }
}

/* A phone looking at the sheet before printing: let the paper scroll sideways
   rather than squashing millimetres into something that will not match the
   print. */
@media (max-width: 230mm){
  .tent-sheet{ margin-left: 0; margin-right: 0; }
  body.tent-body{ overflow-x: auto; }
}

/* Diet and allergen tags.
 *
 * They are drawn differently on purpose, because they are different promises.
 * A diet is a choice and reads as a quiet fact. An allergen is a warning and
 * carries a border so it is findable by somebody scanning a long menu for the
 * one thing they must avoid — the person with the strongest reason to be
 * reading these is the one who cannot afford to miss one. */
.mi-tag.is-diet{
  color: #14603a;
  background: color-mix(in srgb, #1a7f4b 10%, transparent);
}
.mi-tag.is-allergen{
  color: #8c1d18;
  background: color-mix(in srgb, #b3261e 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #b3261e 35%, transparent);
}

/* ---------------------------------------------------------- order ahead --- */
/* Only rendered for a signed-in customer of a shop with ordering on, so the
   ordinary menu reader never pays for any of this. */
.mi-qty{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted, #6b6257);
}
.mi-qty input{
  width: 64px;
  padding: 6px 8px;
  font: inherit;
  border: 1px solid var(--line, #e2dcd2);
  border-radius: 8px;
  background: var(--surface, #fff);
  text-align: center;
}
.menu-order-note{
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2, #f6f2ea);
  border: 1px solid var(--line, #e2dcd2);
}
.menu-order-note.is-ok{ border-color: #7fae7f; }
.menu-order-note.is-err{ border-color: #c96a5b; }
.menu-order-bar{
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  background: var(--bg, #fbf7ef);
  border-top: 1px solid var(--line, #e2dcd2);
}
.menu-order-bar input{
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  font: inherit;
  border: 1px solid var(--line, #e2dcd2);
  border-radius: 10px;
  background: var(--surface, #fff);
}
.menu-order-btn{
  flex: none;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  background: var(--main, #16323F);
  color: var(--on-main, #fff);
  cursor: pointer;
}

/* The card-side panels (order status, year, devices) live in app.css. */
