/* Calenzy Digital Menu — design system
   Ported from the "Maison" draft (docs/design/DESIGN-SYSTEM.md).
   Adapted from a 390x820 phone-frame showcase into a real full-bleed
   responsive mobile page: full-screen on a phone, centered phone-style
   card over the canvas on desktop. */

:root {
  /* light theme (default) */
  --bg: #fbfbfa;
  --bg-2: #f4f4f3;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --overlay: rgba(10, 10, 10, 0.55);

  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  --ink: #0a0a0a;
  --ink-2: #292524;
  --ink-soft: #57534e;
  --ink-faint: #a8a29e;
  --ink-onaccent: #ffffff;

  /* accent is overridden per-venue (set --accent inline on <html>); derived shades follow it */
  --accent: #ff9300;
  --accent-2: color-mix(in oklab, var(--accent) 80%, black);
  --accent-soft: color-mix(in oklab, var(--accent) 18%, white);
  --accent-faint: color-mix(in oklab, var(--accent) 8%, white);

  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;

  --shadow-sm: 0 1px 2px rgba(10,10,10,0.04), 0 1px 1px rgba(10,10,10,0.03);
  --shadow-md: 0 4px 12px rgba(10,10,10,0.05), 0 1px 3px rgba(10,10,10,0.04);
  --shadow-lg: 0 12px 32px rgba(10,10,10,0.08), 0 4px 12px rgba(10,10,10,0.04);
  --shadow-xl: 0 24px 60px rgba(10,10,10,0.12), 0 8px 24px rgba(10,10,10,0.06);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --canvas: #ece9e3;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #0c0c0b;
  --bg-2: #15140f;
  --surface: #1a1916;
  --surface-2: #201f1a;
  --overlay: rgba(0, 0, 0, 0.75);

  --border: #2a2925;
  --border-strong: #3a3833;

  --ink: #f5f5f4;
  --ink-2: #d6d3d1;
  --ink-soft: #a8a29e;
  --ink-faint: #57534e;
  --ink-onaccent: #ffffff;

  --accent-soft: color-mix(in oklab, var(--accent) 22%, #0a0a0a);
  --accent-faint: color-mix(in oklab, var(--accent) 12%, #0a0a0a);

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.6), 0 8px 24px rgba(0,0,0,0.4);

  --canvas: #0a0a09;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* the hidden attribute must always win, even over display:flex elements (search/filter) */
[hidden] { display: none !important; }

html, body { height: 100%; background: var(--bg); }
body {
  background: var(--bg);
  font-family: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.005em;
}

/* ── a clean, mobile-friendly column on a plain white page (no device frame) ──
   The PAGE (document) scrolls — not an inner element — so iOS Safari collapses
   and tints its top/bottom chrome to match the page. Header is sticky, footer
   is fixed. ── */
.viewport {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
}
@media (min-width: 540px) {
  /* on wider screens, a faint pair of edges delineates the column — not a device */
  .viewport { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* sticky header group: app bar + search + tabs travel together at the top */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); }

.screen { display: flex; flex-direction: column; }
.screen::-webkit-scrollbar { display: none; }
.screen { scrollbar-width: none; }

/* ── type ── */
.t-display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; line-height: 1.05; }
.t-h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
.t-h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.t-h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.t-body { font-size: 14px; line-height: 1.5; }
.t-sm { font-size: 13px; line-height: 1.45; }
.t-xs { font-size: 12px; line-height: 1.4; }
.t-eyebrow { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.t-num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.t-mono { font-family: 'Geist Mono', ui-monospace, monospace; }

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.accent { color: var(--accent); }

/* ── layout helpers ── */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.between { justify-content: space-between; }
.center { justify-content: center; align-items: center; }
.flex1 { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 10px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink);
  cursor: pointer; transition: all 0.15s ease;
  letter-spacing: -0.005em; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-accent { background: var(--accent); color: var(--ink-onaccent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 14px 20px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }
.btn-round { width: 40px; height: 40px; padding: 0; border-radius: 999px; flex-shrink: 0; }

/* ── chips / tags ── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--border); white-space: nowrap;
  transition: all 0.15s ease; cursor: pointer;
  font-family: inherit;
}
.chip:not(.chip-active):hover { background: var(--bg-2); }
/* active beats sticky :hover on iOS (otherwise a tapped tab keeps the light hover bg) */
.chip-active, .chip-active:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip-quiet { background: transparent; border-color: var(--border); color: var(--ink-soft); }

/* ── cards / surfaces ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-pad { padding: 16px; }
.divider { height: 1px; background: var(--border); }

/* ── inputs ── */
.input {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: 14px; color: var(--ink-soft);
}
.input-search { background: var(--surface-2); border-color: transparent; }

/* ── stepper ── */
.stepper { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); overflow: hidden; }
.stepper button { width: 32px; height: 32px; background: transparent; border: 0; color: inherit; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.stepper button:hover { background: var(--surface-2); }
.stepper .val { padding: 0 6px; font-weight: 600; min-width: 18px; text-align: center; font-size: 14px; }

/* ── radio / check ── */
.radio-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.radio-dot.on { border-color: var(--accent); }
.radio-dot.on::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.check-box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--ink-onaccent); }
.check-box.on { background: var(--ink); border-color: var(--ink); }

/* ── bars ── */
.appbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--bg);
}
.appbar.bordered { border-bottom: 1px solid var(--border); }

.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border); z-index: 30;
}

/* "Menu by Calenzy" — a plain footer at the end of the menu (not fixed, so it
   never fights iOS Safari's collapsing toolbar) */
.brandbar {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 24px 20px calc(30px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--ink-faint); font-size: 12px;
  text-decoration: none;
}
.brandbar .t-display { font-size: 15px; color: var(--ink-soft); transition: color .15s ease; }
.brandbar:hover .t-display { color: var(--accent); }

/* fixed sub-header (search + tabs) — never scrolls, so nothing can overlap it */
.subhead { flex: 0 0 auto; background: var(--bg); border-bottom: 1px solid var(--border); }

/* ── tabs (horizontal pill scroller) ── */
.tabs { display: flex; gap: 8px; padding: 4px 20px 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > .chip { flex: 0 0 auto; padding: 8px 16px; font-size: 13px; }
.tabs::after { content: ''; flex: 0 0 8px; }

/* ── steps (progress) ── */
.steps { display: flex; align-items: center; gap: 6px; width: 100%; }
.step { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.step.done { background: var(--ink); }
.step.active { background: var(--accent); }

/* ── icon-pill ── */
.icon-pill { width: 36px; height: 36px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--ink); flex-shrink: 0; }

/* ── food "photos" — CSS-gradient placeholders (no-image fallback) ── */
.photo { position: relative; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-2); flex-shrink: 0; }
.photo::before { content: ''; position: absolute; inset: 0; background: var(--grad, linear-gradient(135deg, #f4f4f3 0%, #e7e5e4 100%)); }
.photo::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.35), transparent 45%), radial-gradient(circle at 75% 75%, rgba(0,0,0,0.12), transparent 50%); mix-blend-mode: overlay; }
.photo > .glyph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); color: rgba(255,255,255,0.45); z-index: 1; }
/* when a real photo is set — gradient stays behind as a load fallback */
.photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }

.photo[data-dish="salmon"]   { --grad: linear-gradient(135deg, #f4a574 0%, #e07c45 50%, #c44d2c 100%); }
.photo[data-dish="risotto"]  { --grad: linear-gradient(135deg, #f1d488 0%, #d4a85e 60%, #9e7c3f 100%); }
.photo[data-dish="ribeye"]   { --grad: linear-gradient(135deg, #8a3a28 0%, #5c2317 60%, #2d100b 100%); }
.photo[data-dish="chicken"]  { --grad: linear-gradient(135deg, #e8b664 0%, #b88234 60%, #7a4e1d 100%); }
.photo[data-dish="lentil"]   { --grad: linear-gradient(135deg, #b8a169 0%, #7d8a3a 60%, #4d5e22 100%); }
.photo[data-dish="seabass"]  { --grad: linear-gradient(135deg, #d8e0d3 0%, #9aa890 60%, #5c6b58 100%); }
.photo[data-dish="burrata"]  { --grad: linear-gradient(135deg, #f5ede0 0%, #d4b88f 50%, #a07a4a 100%); }
.photo[data-dish="tuna"]     { --grad: linear-gradient(135deg, #d96a5a 0%, #9c3e35 60%, #5c1f1d 100%); }
.photo[data-dish="calamari"] { --grad: linear-gradient(135deg, #f4d49a 0%, #c8924a 60%, #8a5a26 100%); }
.photo[data-dish="burger"]   { --grad: linear-gradient(135deg, #d09858 0%, #8a4f24 60%, #4d2810 100%); }
.photo[data-dish="water"]    { --grad: linear-gradient(135deg, #d4e8e8 0%, #8fb5b8 50%, #4d7a82 100%); }
.photo[data-dish="wine"]     { --grad: linear-gradient(135deg, #8a2a3a 0%, #5a151f 60%, #2a0810 100%); }
.photo[data-dish="dessert"]  { --grad: linear-gradient(135deg, #efd6c4 0%, #c98a6a 50%, #7a3d28 100%); }

/* ── menu item row ── (inset hairline so hidden/filtered rows leave no stray divider) */
.item-row { display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px; text-decoration: none; color: inherit; cursor: pointer; box-shadow: inset 0 -1px 0 var(--border); }
.item-row:hover { background: var(--surface-2); }
.item-row .photo { width: 76px; height: 76px; border-radius: 12px; }
.item-row.sold-out { opacity: 0.5; }
.diet-v { font-size: 9px; color: var(--success); border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; font-weight: 600; }

/* sheet / overlay (language picker) — lives INSIDE .viewport so it's clipped by
   overflow:hidden and anchored to the screen (never revealed by page scroll). */
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0;
  width: 100%; max-width: 480px;
  transform: translateX(-50%) translateY(101%);
  background: var(--bg); border-radius: 20px 20px 0 0;
  z-index: 90; transition: transform .25s ease; max-height: 85%; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 10px auto 4px; }

svg { display: block; }
