/*!
 * Menuleaf — menu.css (guest menu)
 *
 * Table of contents
 *   1. Fonts (bundled, OFL)
 *   2. Design tokens (light + dark)
 *   3. Base and utilities
 *   4. Masthead and the table ticket
 *   5. Category rail
 *   6. Search and filter chips
 *   7. Kitchen picks
 *   8. Sections and dish rows (dotted leaders)
 *   9. Footer and legend
 *  10. List pill, sheets (dialogs), toast
 *  11. Motion preferences
 *
 * Change the brand colour in Admin > Settings (it sets --accent), or edit the tokens below.
 */

/* 1. Fonts ---------------------------------------------------------- */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 500; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 800; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url("../fonts/instrument-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-display: swap; src: url("../fonts/instrument-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-display: swap; src: url("../fonts/instrument-sans-latin-600-normal.woff2") format("woff2"); }

/* 2. Tokens --------------------------------------------------------- */
:root {
  --bottle: #173A31;      /* deep bottle green: ink, masthead */
  --leaf-paper: #EEF3EF;  /* page background */
  --accent: #E3A21A;      /* turmeric (overridden from settings) */
  --sea: #8DBFAE;         /* sea glass: secondary */
  --chili: #C8432B;       /* spicy tag + errors only */

  --bg: var(--leaf-paper);
  --surface: #F9FBFA;
  --ink: var(--bottle);
  --muted: #546E66;
  --line: #C6D6CE;
  --leader: #9DB4AB;
  --mast-bg: var(--bottle);
  --mast-ink: #EEF3EF;
  --on-accent: #241A00;
  --shadow: 0 18px 40px -24px rgba(23, 58, 49, .45);

  --font-display: "Bricolage Grotesque", "Avenir Next Condensed", "Arial Narrow", sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --wrap: 44rem;
  --radius-s: 6px;
  --radius-l: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1F1A; --surface: #142A23; --ink: #E4EEE9; --muted: #9DB5AC; --line: #2A4339; --leader: #3D5A4F;
  --mast-bg: #0A1814; --mast-ink: #E4EEE9; --shadow: 0 18px 40px -20px rgba(0, 0, 0, .7); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1F1A; --surface: #142A23; --ink: #E4EEE9; --muted: #9DB5AC; --line: #2A4339; --leader: #3D5A4F;
    --mast-bg: #0A1814; --mast-ink: #E4EEE9; --shadow: 0 18px 40px -20px rgba(0, 0, 0, .7); color-scheme: dark;
  }
}

/* 3. Base ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.skip { position: absolute; left: .75rem; top: -6rem; z-index: 50; background: var(--accent); color: var(--on-accent); padding: .5rem .9rem; border-radius: var(--radius-s); }
.skip:focus { top: .75rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
#menu:focus { outline: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.05rem; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .15s ease, background-color .15s ease;
}
.btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: scale(.97); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-ghost { border-color: currentColor; background: transparent; }
.btn[disabled] { opacity: .55; cursor: default; }

/* 4. Masthead + ticket ---------------------------------------------- */
.masthead { background: var(--mast-bg); color: var(--mast-ink); padding: 1rem 0 1.75rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 44px; }
.logo { height: 40px; width: auto; }
.logo-text { font-size: .875rem; opacity: .75; }
.theme-toggle { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(238, 243, 239, .25); background: transparent; color: var(--mast-ink); display: grid; place-items: center; cursor: pointer; }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

.venue {
  margin-top: 1.4rem; font-weight: 800; letter-spacing: -.035em;
  font-size: clamp(2.5rem, 11vw, 4.25rem); line-height: .92; text-wrap: balance;
}
.tagline { margin-top: .7rem; max-width: 36ch; font-size: 1.05rem; opacity: .82; }

/* The ticket: a perforated stub on the left, actions on the right. */
.ticket {
  --notch: 9px;
  margin-top: 1.5rem; display: grid; grid-template-columns: 6.5rem 1fr;
  background: var(--surface); color: var(--ink); border-radius: var(--radius-l);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.ticket-stub {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 1rem .5rem; background: var(--accent); color: var(--on-accent); position: relative;
}
/* perforation: a dotted line of punched holes between stub and body */
.ticket-stub::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: -3px; width: 6px;
  background: radial-gradient(circle at 3px 6px, var(--surface) 2.6px, transparent 3px) 0 0 / 6px 12px repeat-y;
}
.ticket::before, .ticket::after { /* half-moon notches top and bottom of the tear line */
  content: ""; position: absolute; left: calc(6.5rem - var(--notch)); width: calc(var(--notch) * 2); height: calc(var(--notch) * 2);
  border-radius: 50%; background: var(--mast-bg); z-index: 2;
}
.ticket::before { top: calc(var(--notch) * -1); }
.ticket::after { bottom: calc(var(--notch) * -1); }
.ticket-kicker { font-size: .8125rem; font-weight: 600; }
.ticket-no { font-family: var(--font-display); font-weight: 800; font-size: 3.4rem; line-height: .9; letter-spacing: -.04em; }
.ticket-no.is-long { font-size: 1.35rem; line-height: 1.1; word-break: break-word; }
.ticket-area { font-size: .75rem; margin-top: .25rem; opacity: .8; }
.ticket-leaf { fill: none; stroke: var(--on-accent); stroke-width: 2.5; stroke-linecap: round; }
.ticket-body { padding: 1rem 1rem 1.1rem 1.25rem; display: grid; gap: .75rem; align-content: center; min-width: 0; }
.ticket-lead { font-size: .95rem; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.ticket-actions .btn { flex: 1 1 9.5rem; }
.ticket-status { font-size: .875rem; color: var(--muted); min-height: 1.3em; }
.ticket-status:empty { display: none; }
.ticket-status.is-done { color: var(--ink); font-weight: 600; }
.ticket-status.is-error { color: var(--chili); }
.hours { list-style: none; margin: 0; padding: 0; font-size: .9rem; color: var(--muted); white-space: pre-wrap; }

/* 5. Category rail -------------------------------------------------- */
.rail {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.rail-inner { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; padding-block: .55rem; }
.rail-inner::-webkit-scrollbar { display: none; }
.rail a {
  flex: none; padding: .45rem .85rem; border-radius: 999px; text-decoration: none; font-weight: 500; font-size: .9375rem;
  color: var(--muted); white-space: nowrap; transition: background-color .2s ease, color .2s ease;
}
.rail a[aria-current="true"] { background: var(--ink); color: var(--bg); }

/* 6. Tools ---------------------------------------------------------- */
.tools { display: grid; gap: .75rem; padding-block: 1.25rem .5rem; }
.search { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 0 1rem; min-height: 48px; }
.search:focus-within { border-color: var(--ink); }
.search svg { flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; padding: .7rem 0; }
.search input:focus { outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { min-height: 38px; padding: .35rem .85rem; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; cursor: pointer; font-size: .875rem; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--sea); border-color: var(--sea); color: #0E2A22; }

/* 7. Picks ---------------------------------------------------------- */
.picks { padding-top: 1rem; }
.picks-title { font-size: 1.05rem; font-weight: 700; color: var(--muted); }
.picks-row { display: grid; grid-auto-flow: column; grid-auto-columns: 10.5rem; gap: .75rem; overflow-x: auto; padding: .75rem 0 .5rem; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.pick { scroll-snap-align: start; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: .5rem .5rem .8rem; cursor: pointer; display: grid; gap: .35rem; align-content: start; }
.pick img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: var(--bg); }
.pick-name { font-family: var(--font-display); font-weight: 700; line-height: 1.15; padding-inline: .2rem; }
.pick-price { font-size: .875rem; color: var(--muted); padding-inline: .2rem; }

/* 8. Sections and dishes -------------------------------------------- */
.cat { padding-top: 2.25rem; }
.cat[hidden] { display: none; }
.cat-head { padding-bottom: .6rem; border-bottom: 2px solid var(--ink); }
.cat-head h2 { font-size: clamp(1.6rem, 6vw, 2.1rem); font-weight: 800; letter-spacing: -.02em; }
.cat-head p { margin-top: .35rem; color: var(--muted); font-size: .9375rem; max-width: 52ch; }
.dishes { list-style: none; margin: 0; padding: 0; }
.dish { border-bottom: 1px solid var(--line); }
.dish[hidden] { display: none; }
.dish-hit {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start;
  padding: 1rem 0; background: none; border: 0; text-align: left; cursor: pointer;
}
.dish-main { display: grid; gap: .3rem; min-width: 0; }
.dish-line { display: flex; align-items: baseline; align-items: last baseline; gap: .4rem; }
.dish-name { font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; line-height: 1.2; }
/* The menu-card leader: a dotted line that runs from the name to the price */
.dish-leader { flex: 1; min-width: 1rem; border-bottom: 2px dotted var(--leader); transform: translateY(-.3em); }
.dish-price { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dish-desc { color: var(--muted); font-size: .9375rem; }
.dish-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .15rem; }
.dish-img { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; background: var(--surface); }
.dish.is-out .dish-name, .dish.is-out .dish-desc, .dish.is-out .dish-img { opacity: .5; }
.dish.is-out .dish-price { color: var(--chili); font-size: .875rem; }
.dish-hit:hover .dish-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.tag { display: inline-flex; align-items: center; height: 1.35rem; padding: 0 .45rem; border-radius: 4px; font-size: .72rem; font-weight: 600; border: 1px solid var(--line); color: var(--muted); }
.tag-veg, .tag-vegan { border-color: var(--sea); color: var(--ink); background: color-mix(in srgb, var(--sea) 28%, transparent); }
.tag-gf { border-style: dashed; }
.tag-spicy { border-color: var(--chili); color: var(--chili); }
.tag-chef { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag-new { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.empty { padding: 3rem 0; display: grid; gap: 1rem; justify-items: start; }
.empty[hidden] { display: none; }

/* 9. Footer --------------------------------------------------------- */
.foot { margin-top: 3rem; padding: 2rem 0 7rem; background: var(--surface); border-top: 1px solid var(--line); }
.foot-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.foot-h { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; }
.foot p { font-size: .9375rem; }
.link-btn { background: none; border: 0; padding: .25rem 0; text-decoration: underline; cursor: pointer; font-size: .875rem; min-height: 32px; }
.wifi-pass span { font-weight: 600; }
.legend { margin-top: 2rem; display: grid; gap: .75rem; font-size: .8125rem; color: var(--muted); }
.legend p:first-child { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; }

/* 10. Pill, sheets, toast ------------------------------------------ */
.list-pill {
  position: fixed; z-index: 30; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: .55rem; min-height: 52px; padding: .5rem 1.2rem .5rem 1.3rem;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; cursor: pointer; box-shadow: var(--shadow);
  max-width: calc(100% - 2rem); white-space: nowrap;
}
.list-pill[hidden] { display: none; }
.list-count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .8125rem; }
.list-pill.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: translateX(-50%) scale(1.07); } }

.sheet {
  width: min(100%, 34rem); max-height: 92vh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 22px 22px 0 0; background: var(--surface); color: var(--ink); overflow: auto;
}
.sheet::backdrop { background: rgba(8, 20, 16, .55); }
.sheet[open] { animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 40rem) { .sheet { margin: auto; border-radius: 22px; } }
.sheet-close-form { position: sticky; top: 0; height: 0; z-index: 2; display: flex; justify-content: flex-end; }
.sheet-close { margin: .6rem .6rem 0 0; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.sheet-art { background: var(--bg); }
.sheet-art img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.sheet-body { padding: 1.25rem 1.25rem 1.5rem; display: grid; gap: .8rem; }
.sheet-body h2 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; padding-right: 2.5rem; }
.sheet-desc { color: var(--muted); }
.sheet-allergens { font-size: .875rem; padding: .6rem .8rem; border-radius: var(--radius-s); background: var(--bg); }
.variants { border: 0; padding: 0; margin: 0; }
.variants legend { font-weight: 600; margin-bottom: .4rem; }
.variants [data-variant-options] { display: flex; flex-wrap: wrap; gap: .5rem; }
.variant { position: relative; }
.variant input { position: absolute; opacity: 0; inset: 0; }
.variant span { display: inline-flex; gap: .4rem; min-height: 42px; align-items: center; padding: .4rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); cursor: pointer; }
.variant input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.variant input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .4rem; }
.sheet-price { font-family: var(--font-display); font-size: 1.5rem; }
.sheet-hint { font-size: .8125rem; color: var(--muted); }
.list-items { list-style: none; margin: 0; padding: 0; }
.list-items li { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.list-items .li-name { font-weight: 600; }
.list-items .li-meta { color: var(--muted); font-size: .875rem; }
.qty { display: inline-flex; align-items: center; gap: .4rem; grid-row: span 2; }
.qty button { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.qty output { min-width: 1.4rem; text-align: center; font-weight: 600; }
.list-empty { padding: 1rem 0; color: var(--muted); }

.toast {
  position: fixed; z-index: 60; left: 50%; top: 1rem; transform: translate(-50%, -150%);
  max-width: calc(100% - 2rem); padding: .75rem 1.1rem; border-radius: 12px; background: var(--ink); color: var(--bg);
  font-weight: 500; box-shadow: var(--shadow); transition: transform .3s ease; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

/* 11. Motion -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (max-width: 22rem) {
  .ticket { grid-template-columns: 5.25rem 1fr; }
  .ticket::before, .ticket::after { left: calc(5.25rem - var(--notch)); }
  .ticket-no { font-size: 2.8rem; }
  .dish-img { width: 60px; height: 60px; }
}
