/* ============================================================
   QR Menu — shared template styles
   Per-cafe theming: only these variables change (set from JSON
   via --accent, or fork this file's :root for deeper brand work).
   ============================================================ */

:root {
  --accent:        #c0392b;                     /* overridden by menu-data.json */
  --accent-ink:    #ffffff;
  --accent-soft:   color-mix(in srgb, var(--accent) 10%, #ffffff);
  --bg:            #f6f2ec;
  --card:          #ffffff;
  --ink:           #231b16;
  --muted:         #87796d;
  --line:          rgba(35, 27, 22, .08);
  --font-heading:  "Great Vibes", "Snell Roundhand", cursive;
  --font-body:     "Jost", system-ui, -apple-system, sans-serif;
  --radius:        20px;
  --shell-w:       560px;
  --tabs-h:        64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Center column on desktop, full-bleed on phones */
.shell {
  max-width: var(--shell-w);
  margin-inline: auto;
  min-height: 100dvh;
  background: var(--bg);
}
@media (min-width: 640px) {
  .shell { box-shadow: 0 0 80px rgba(35, 27, 22, .14); }
}

[hidden] { display: none !important; }

/* ---------- 1 · Cover ---------- */

.cover {
  position: relative;
  height: clamp(220px, 58vw, 300px);
  overflow: hidden;
  border-radius: 0 0 calc(var(--radius) + 8px) calc(var(--radius) + 8px);
  isolation: isolate;
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: coverIn 1.4s cubic-bezier(.22, 1, .36, 1) both;
}
.cover::after {                                   /* legibility gradient */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 12, 8, .18) 0%, transparent 35%, rgba(20, 12, 8, .34) 100%);
}
@keyframes coverIn {
  from { transform: scale(1.08); filter: saturate(.6) brightness(1.06); }
  to   { transform: scale(1);    filter: none; }
}

/* ---------- 2 · Identity ---------- */

.identity {
  text-align: center;
  padding: 22px 24px 14px;
}
.cafe-name {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(44px, 12vw, 60px);
  line-height: 1.05;
  color: var(--ink);
  animation: riseIn .7s .1s cubic-bezier(.22, 1, .36, 1) both;
}
.cafe-subtitle {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .38em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  animation: riseIn .7s .2s cubic-bezier(.22, 1, .36, 1) both;
}
.cafe-subtitle::before,
.cafe-subtitle::after {
  content: "";
  height: 1px;
  width: 34px;
  background: var(--line);
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 3 · Tabs bar (sticky, native scroll-snap) ---------- */

.tabsbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tabs-h);
  padding: 10px 14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.search-btn,
.search-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .15s;
}
.search-btn svg,
.search-close svg { width: 18px; height: 18px; }
.search-btn:hover, .search-close:hover { border-color: var(--accent); color: var(--accent); }
.search-btn:active { transform: scale(.92); }

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;                          /* Firefox */
  scroll-snap-type: x proximity;                  /* native snapping — no carousel lib */
  -webkit-overflow-scrolling: touch;
  padding: 2px;
}
.tabs::-webkit-scrollbar { display: none; }       /* WebKit */

.tab {
  scroll-snap-align: start;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 18px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color .25s, background .25s, box-shadow .25s, transform .15s;
  white-space: nowrap;
}
.tab:active { transform: scale(.95); }
.tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.tab:focus-visible,
.search-btn:focus-visible,
.search-close:focus-visible,
.searchbox input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Search input slides over the tab row */
.searchbox {
  position: absolute;
  inset: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 6px 0 18px;
  box-shadow: 0 10px 30px rgba(35, 27, 22, .12);
  animation: searchIn .25s cubic-bezier(.22, 1, .36, 1);
}
@keyframes searchIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  outline: none;
}
.searchbox input::placeholder { color: var(--muted); }
.searchbox input::-webkit-search-cancel-button { display: none; }
.search-close { width: 34px; height: 34px; border: 0; background: var(--accent-soft); }

/* ---------- 4 · Category banner + description ---------- */

.menu { padding-bottom: 28px; scroll-margin-top: calc(var(--tabs-h) + 2px); }

.cat-banner {
  position: relative;
  margin: 18px 16px 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(35, 27, 22, .16);
}
.cat-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-banner::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(20, 12, 8, .62) 100%);
}
.cat-banner figcaption {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 10px;
  z-index: 1;
  font-family: var(--font-heading);
  font-size: clamp(34px, 9vw, 44px);
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .45);
}

.cat-desc {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: .04em;
  margin: 12px 24px 2px;
}
.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 20px 2px;
}
.results-head h2 {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 34px;
}
.results-head span { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- 5 · Items ---------- */

.items {
  list-style: none;
  padding: 6px 20px 12px;
}
.item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s cubic-bezier(.22, 1, .36, 1), transform .55s cubic-bezier(.22, 1, .36, 1);
}
.item.in { opacity: 1; transform: none; }
.item:last-child { border-bottom: 0; }

.thumb {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--card), 0 4px 12px rgba(35, 27, 22, .14);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb--ph {                                     /* no image → initial letter */
  display: grid;
  place-items: center;
  font-family: var(--font-heading);
  font-size: 26px;
  color: var(--accent);
  user-select: none;
}

.ibody { flex: 1; min-width: 0; }
.ibody h3 {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .01em;
  overflow-wrap: break-word;
}
.ibody .cat-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.ibody .desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 3px;
}
.ibody .allerg {
  font-size: 11px;
  font-style: italic;
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  margin-top: 4px;
}

.prices {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
  min-width: 66px;
}
.price .amount {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.price .plabel {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1px;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 44px 20px 60px;
}

/* ---------- Skeleton / error / footer ---------- */

.cat-skel { padding: 18px 16px 0; }
.skel {
  border-radius: 12px;
  background: linear-gradient(100deg, rgba(35,27,22,.06) 40%, rgba(35,27,22,.10) 50%, rgba(35,27,22,.06) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
.skel-banner { height: 180px; border-radius: var(--radius); margin-bottom: 18px; }
.skel-row { height: 58px; border-radius: 999px; margin: 14px 6px; max-width: 78%; }
.skel-row:nth-child(odd) { max-width: 62%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.error {
  text-align: center;
  padding: 90px 28px;
  color: var(--muted);
}
.error-icon { width: 44px; height: 44px; color: var(--accent); margin-bottom: 14px; }
.error h2 { color: var(--ink); font-size: 19px; margin-bottom: 8px; }
.error p { font-size: 13.5px; line-height: 1.6; max-width: 380px; margin-inline: auto; }
.error-hint { margin-top: 14px; opacity: .8; }
.error code { background: rgba(35,27,22,.07); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

.foot {
  text-align: center;
  padding: 10px 24px 34px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.foot-rule {
  display: block;
  width: 46px;
  height: 1px;
  background: var(--line);
  margin: 0 auto 14px;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    transition-duration: .001s !important;
  }
  html { scroll-behavior: auto; }
}
