/* MenuQR PRO — public menu styles.
   Colours are CSS variables; /css/tema.css (generated per restaurant) overrides the accent. */

:root {
  color-scheme: light dark;
  --bg: #faf7f2;
  --surface: #fffdf9;
  --text: #1f1b16;
  --muted: #645b51;
  --line: #e6ded2;
  --accent: #8c3b1e;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --notice-bg: #fbf0d9;
  --notice-text: #4f3a06;
  --warn-bg: #fff4e5;
  --warn-text: #5a2c00;
  --warn-border: #b45309;
  --shadow: 0 1px 2px rgb(31 27 22 / 0.06), 0 6px 20px rgb(31 27 22 / 0.07);
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 680px;
  --gutter: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --surface: #1d1a16;
    --text: #f3ede4;
    --muted: #b6ab9c;
    --line: #342f28;
    --accent: #e7a37b;
    --accent-ink: #1a1410;
    --notice-bg: #302612;
    --notice-text: #f4dca8;
    --warn-bg: #3a2408;
    --warn-text: #ffe2bd;
    --warn-border: #f59e0b;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-offset, 77px); /* real bar height, set by app.js */
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 12px; top: -100px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
.masthead {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) 26px;
  text-align: center;
}
.masthead-top { display: flex; justify-content: flex-end; min-height: 50px; }
.lang {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.lang-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.logo {
  display: block;
  width: 92px;
  height: 92px;
  margin: 2px auto 14px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.title {
  margin: 0;
  font: 600 clamp(2.05rem, 8.6vw, 2.8rem) / 1.08 var(--font-display);
  letter-spacing: 0.005em;
  text-wrap: balance;
}
.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.ornament {
  position: relative;
  width: 72px;
  height: 1px;
  margin: 20px auto 0;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
}
.ornament::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 6px; height: 6px;
  background: var(--accent);
  transform: translate(-50%, -50%) rotate(45deg);
}
.facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 18px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.875rem;
}
.facts li { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.facts li span { white-space: pre-line; text-align: left; }
.facts a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 3px;
}

/* ---------- Banners ---------- */
.banners { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.925rem;
  line-height: 1.45;
  white-space: pre-line;
}
.banner .icon { margin-top: 2px; }
.banner--notice { background: var(--notice-bg); color: var(--notice-text); }
/* Backup or phone copy: must be clearly visible (warning colours, bold title). */
.banner--status {
  flex-wrap: wrap;
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 2px solid var(--warn-border);
  box-shadow: var(--shadow);
}
.banner-text { flex: 1 1 200px; }
.banner-title { display: block; margin-bottom: 2px; font-weight: 750; }
.banner-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Category navigation ---------- */
.catnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg); /* solid: semi-transparent backgrounds render inconsistently in WebKit */
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 16px -14px rgb(0 0 0 / 0.5);
}
.catnav-list {
  display: flex;
  gap: 6px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px var(--gutter);
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  scroll-padding-inline: var(--gutter);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.catnav-list::-webkit-scrollbar { display: none; }
.catnav-list li { flex: none; }
.catnav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.catnav-link:hover { color: var(--text); border-color: var(--line); }
.catnav-link[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- Menu ---------- */
.menu { max-width: var(--maxw); margin: 0 auto; padding: 4px var(--gutter) 40px; outline: none; }
.category { padding-top: 34px; }
.category-title { scroll-margin-top: var(--nav-offset, 77px); }
/* the title receives focus after a tap on the category bar (for screen readers): no visible ring */
.category-title:focus,
.category-title:focus-visible { outline: none; }
.category-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font: 600 1.75rem/1.2 var(--font-display);
}
.category-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.category-desc { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; font-style: italic; white-space: pre-line; }

.dishes { margin: 10px 0 0; padding: 0; list-style: none; }
.dish { display: flex; gap: 14px; padding: 16px 0; }
.dish + .dish { border-top: 1px solid var(--line); }
.dish-img {
  flex: none;
  width: 78px;
  height: 78px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--line);
}
.dish-body { flex: 1; min-width: 0; }
.dish-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dish-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.dish-price {
  flex: none;
  margin: 0;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.dish-size { margin-right: 6px; color: var(--muted); font-size: 0.8125rem; }
.price { color: var(--accent); font-weight: 700; }
.dish-desc { margin: 4px 0 0; color: var(--muted); font-size: 0.925rem; white-space: pre-line; overflow-wrap: anywhere; }
.dish-meta {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}
.dish-meta .icon { margin-top: 2px; }
.dish-meta strong { color: var(--text); font-weight: 600; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0; padding: 0; list-style: none; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge--off { background: var(--text); color: var(--bg); padding-left: 9px; }
/* previous version shown while the sheet is being updated */
.badge--pending { background: transparent; border: 1px dashed var(--muted); color: var(--text); padding: 2px 8px; }

.dish.is-unavailable .dish-name,
.dish.is-unavailable .price { color: var(--muted); }
.dish.is-unavailable .price { text-decoration: line-through; text-decoration-thickness: 1px; }
.dish.is-unavailable .dish-img { filter: grayscale(1); opacity: 0.6; }

/* ---------- Loading, error ---------- */
.skeleton { padding-top: 30px; }
.sk {
  height: 14px;
  margin: 14px 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--line), color-mix(in srgb, var(--line) 50%, var(--bg)), var(--line));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-title { width: 45%; height: 26px; margin-top: 34px; }
.sk-short { width: 70%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.error-state { padding: 40px 4px 48px; text-align: center; }
.error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 30px;
}
.error-state h2 { margin: 0; font: 600 1.6rem/1.2 var(--font-display); }
.error-state p { margin: 10px auto 22px; max-width: 34ch; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px var(--gutter) calc(40px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.footer p { margin: 0 0 8px; white-space: pre-line; }
.footer .badges { justify-content: center; margin: 14px 0; }
.footer .updated { margin-top: 14px; font-size: 0.78rem; }

.noscript { max-width: 34ch; margin: 40px auto; padding: 0 20px; text-align: center; }

@media (min-width: 720px) {
  .dish-img { width: 92px; height: 92px; }
  .category-title { font-size: 1.9rem; }
}

@media print {
  .catnav, .lang, .banner--status, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .dish { break-inside: avoid; }
}
