/* ============================================================
   AVLI — MENU PAGE
   Loaded only on speisekarte.html.

   The menu is set as a menu, not as cards: numbered rows, a
   dotted leader carrying the eye to the price, descriptions
   stepped back in a lighter weight. Built to stay readable at
   ~160 dishes.
   ============================================================ */

/* Anchor jumps must clear both the header and the sticky bar. */
html.menu-page { scroll-padding-top: calc(var(--header-h) + 86px); }

.menu-intro {
  padding-top: calc(var(--header-h) + clamp(3rem, 7vw, 5.5rem));
  padding-bottom: clamp(2rem, 4vw, 3rem);
  background: var(--cream-deep);
}
.menu-intro h1 { margin-bottom: 0.35em; }
.menu-intro .lead { max-width: 52ch; }


/* ── Sticky controls: search + categories ──────────────────── */

.menu-bar {
  position: sticky;
  top: calc(var(--header-h) - 18px);
  z-index: 500;
  /* The chip strip scrolls inside itself; this stops it leaking
     horizontal scroll onto the page. */
  overflow-x: hidden;
  background: rgba(var(--cream-rgb), 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 860px) {
  .menu-bar { top: calc(var(--header-h) - 18px); }
}

.menu-bar__inner {
  max-width: 1240px;
  margin-inline: auto;
  padding: 0.85rem var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Search */
.menu-search { position: relative; display: flex; align-items: center; }
.menu-search__icon {
  position: absolute;
  left: 0.95rem;
  width: 18px; height: 18px;
  color: var(--stone);
  pointer-events: none;
}
.menu-search input {
  width: 100%;
  padding: 0.8rem 2.9rem 0.8rem 2.85rem;
  min-height: 48px;
  background: var(--cream);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: var(--fs-body);
  color: var(--ink);
  transition: border-color 0.2s var(--ease);
}
.menu-search input::placeholder { color: var(--stone); }
.menu-search input:focus { border-color: var(--orange); outline-offset: 1px; }

.menu-search__clear {
  position: absolute;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--stone);
  cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.menu-search__clear:hover { background: var(--cream-deep); color: var(--ink); }
.menu-search__clear svg { width: 16px; height: 16px; }
.menu-search__clear[hidden] { display: none; }

/* Category chips — swipeable on touch, arrow-scrolled with a mouse.
   There are ~21 categories, so the strip always overflows and needs a
   visible affordance rather than a hidden scrollbar. */
.cat-nav-wrap { position: relative; }

/* Edge fades say "there is more this way". */
.cat-nav-wrap::before,
.cat-nav-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.cat-nav-wrap::before {
  left: calc(var(--gutter) * -1);
  background: linear-gradient(to right, var(--cream) 30%, rgba(var(--cream-rgb), 0));
}
.cat-nav-wrap::after {
  right: calc(var(--gutter) * -1);
  background: linear-gradient(to left, var(--cream) 30%, rgba(var(--cream-rgb), 0));
}
.cat-nav-wrap.can-prev::before,
.cat-nav-wrap.can-next::after { opacity: 1; }

.cat-nav__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 34px;
  height: 34px;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(26, 23, 20, 0.10);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.cat-nav__arrow:hover { border-color: var(--ink); background: var(--cream-deep); }
.cat-nav__arrow svg { width: 15px; height: 15px; }
.cat-nav__arrow--prev { left: calc(var(--gutter) * -1); }
.cat-nav__arrow--next { right: calc(var(--gutter) * -1); }

/* Arrows are for pointer devices; on touch the strip is swiped. */
@media (pointer: fine) {
  .cat-nav-wrap.can-prev .cat-nav__arrow--prev,
  .cat-nav-wrap.can-next .cat-nav__arrow--next { display: flex; }
}

.cat-nav {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  padding-bottom: 0.15rem;
  /* Let chips bleed to the screen edge on mobile so the last one
     doesn't look cut off mid-swipe. */
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
}
.cat-nav::-webkit-scrollbar { display: none; }

.cat-nav__item {
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 0.55rem 1rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease),
              border-color 0.2s var(--ease),
              color 0.2s var(--ease);
}
.cat-nav__item:hover { border-color: var(--ink); color: var(--ink); }
.cat-nav__item.is-active {
  background: var(--olive-deep);
  border-color: var(--olive-deep);
  color: var(--cream);
}

.menu-results {
  font-size: var(--fs-xs);
  color: var(--stone);
  padding-bottom: 0.25rem;
}
.menu-results[hidden] { display: none; }


/* ── Menu body ─────────────────────────────────────────────── */

.menu-body { padding-block: clamp(2.5rem, 5vw, 4rem) clamp(4rem, 8vw, 6rem); }

.menu-cat { margin-bottom: clamp(3rem, 6vw, 4.75rem); }
.menu-cat:last-child { margin-bottom: 0; }
.menu-cat[hidden] { display: none; }

.menu-cat__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid var(--orange);
}
.menu-cat__title { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); }
.menu-cat__count {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--stone);
  font-variant-numeric: tabular-nums;
}

.dish-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem 3.5rem;
}
/* Two columns once there is genuinely room — halves the scroll
   depth of a 160-dish menu without cramping the text. */
@media (min-width: 1060px) {
  .dish-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.dish {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0 0.5rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
  /* Grid and flex children default to min-width:auto, which stops them
     shrinking below their content and overflows narrow phones. */
  min-width: 0;
}
.dish[hidden] { display: none; }

/* Drinks carry no order number, so they lose the number column. */
.dish--nonum { grid-template-columns: minmax(0, 1fr); }
.dish--nonum .dish__desc { grid-column: 1; }

.dish__no {
  font-size: var(--fs-xs);
  color: var(--stone);
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

.dish__line {
  display: flex;
  align-items: baseline;
  gap: 0 0.5rem;
  min-width: 0;
  /* The price may drop to its own line on a narrow phone. */
  flex-wrap: wrap;
}

.dish__name {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  letter-spacing: 0;
  /* Never squeezed narrower than a few characters — below that a name
     breaks one letter per line, which is what a phone used to show. */
  flex: 1 1 auto;
  min-width: 11ch;
  overflow-wrap: break-word;
}

/* Dotted leader plus the price. As one flex item it either shares the
   name's line or takes the next one whole — never a sliver. */
.dish__tail {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 7rem;
}

/* The name as printed on the German card, shown after a translated
   name so guests can point at it when ordering. */
.dish__orig {
  display: inline;
  font-weight: 400;
  font-size: var(--fs-sm);
  color: var(--stone);
  overflow-wrap: break-word;
}
.dish__orig::before { content: "· "; }

/* The leader is the classic menu device: it ties a dish to its
   price across whatever gap is left. */
.dish__leader {
  flex: 1 1 auto;
  min-width: 1.25rem;
  border-bottom: 1px dotted var(--line-strong);
  transform: translateY(-0.28em);
}

.dish__price {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.dish__desc {
  grid-column: 2;
  margin: 0.2rem 0 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--stone);
  max-width: 48ch;
}

/* Dietary marks */
.dish__tags {
  display: inline-flex;
  gap: 0.3rem;
  margin-left: 0.15rem;
  vertical-align: baseline;
}
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem; height: 1.15rem;
  border-radius: 50%;
  font-size: 0.66rem;
  line-height: 1;
  font-weight: 700;
  cursor: help;
}
.tag--veg   { background: rgba(59, 102, 51, 0.14);  color: var(--olive); }
.tag--vegan { background: rgba(59, 102, 51, 0.24);  color: var(--olive-deep); }
.tag--spicy { background: var(--orange); color: var(--ink); }

/* Search term highlight */
mark {
  background: var(--orange-soft);
  color: var(--ink);
  padding: 0 0.1em;
  border-radius: 2px;
}

/* Empty state — an invitation to try again, not an apology. */
.menu-empty {
  text-align: center;
  padding: clamp(3rem, 8vw, 5rem) 1rem;
  max-width: 44ch;
  margin-inline: auto;
}
.menu-empty[hidden] { display: none; }
.menu-empty svg { width: 42px; height: 42px; color: var(--olive); opacity: 0.45; margin: 0 auto 1.25rem; }
.menu-empty h2 { font-size: var(--fs-h3); margin-bottom: 0.5em; }
.menu-empty p { color: var(--stone); font-size: var(--fs-sm); margin-inline: auto; }


/* ── Category note ─────────────────────────────────────────── */

.menu-cat__note {
  margin: -0.75rem 0 1.5rem;
  font-size: var(--fs-sm);
  color: var(--stone);
  max-width: 60ch;
}


/* ── Allergen / additive codes ─────────────────────────────── */

.dish__codes {
  font-size: 0.62em;
  font-weight: 500;
  color: var(--stone);
  letter-spacing: 0.02em;
  margin-left: 0.25em;
  vertical-align: super;
  line-height: 0;
  cursor: help;
  white-space: nowrap;
}


/* ── Size variants (drinks) ────────────────────────────────── */

.dish__size {
  color: var(--stone);
  font-weight: 400;
  margin-right: 0.6rem;
  white-space: nowrap;
}

.dish__variants {
  grid-column: 2;
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.dish--nonum .dish__variants { grid-column: 1; }
.dish__variants li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: var(--fs-sm);
}
.dish__variants .dish__size { margin-right: 0; }

/* Price not yet supplied — a marker, never a guessed number. */
.dish__price--missing { color: var(--ink-soft); font-weight: 600; border-bottom: 1px dashed var(--orange); cursor: help; }


/* ── Subheading inside a category (Rot / Weiss) ────────────── */

.dish-subhead {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--olive);
  padding: 1.35rem 0 0.45rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.25rem;
}
.dish-subhead:first-child { padding-top: 0; }
.dish-subhead[hidden] { display: none; }


/* ── Footnote & key ────────────────────────────────────────── */

.menu-footnote {
  margin: clamp(2.5rem, 5vw, 3.5rem) 0 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  font-style: italic;
}
.menu-footnote:empty { display: none; }

.menu-legend {
  margin-top: 2.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 2rem clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}

.legend-block__title {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.9rem;
  hyphens: none;
}

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.legend-list li {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.6rem;
  align-items: start;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  line-height: 1.45;
}
.legend-code {
  font-weight: 700;
  color: var(--olive);
  font-variant-numeric: tabular-nums;
}
.legend-list--diet li { grid-template-columns: 1.6rem 1fr; align-items: center; }

.menu-legend__note {
  margin: 2rem 0 0;
  font-size: var(--fs-sm);
  color: var(--stone);
  max-width: 62ch;
}


/* ── Back to top ───────────────────────────────────────────── */

.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.1rem;
  min-height: 44px;
  background: var(--olive-deep);
  color: var(--cream);
  border: 0;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(26, 23, 20, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.28s var(--ease),
              transform 0.28s var(--ease),
              visibility 0.28s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top svg { width: 14px; height: 14px; }


/* ── Mobile refinements ────────────────────────────────────── */

@media (max-width: 620px) {
  .dish { grid-template-columns: 2rem minmax(0, 1fr); }
  /* Drinks have no number: they must keep the single full-width column
     this rule would otherwise take back. */
  .dish--nonum { grid-template-columns: minmax(0, 1fr); }
  .dish__desc { font-size: 0.9rem; }
  .menu-bar__inner { padding-block: 0.7rem; }
  /* Keep the floating button clear of the last menu rows and of the
     allergen note, which is the very last thing on the page. */
  .menu-body { padding-bottom: 6rem; }
  .menu-legend__note { padding-bottom: 3.5rem; }
}
