/* Menu page: filter buttons, search and a grid of rounded dish cards. */

/* The menu and allergen pages read a little larger (+8%); both use these sizes so they match */
main { --step--1: clamp(0.945rem, 0.918rem + 0.108vw, 1.0125rem); --step-0: clamp(1.0125rem, 0.983rem + 0.162vw, 1.08rem); --step-1: clamp(1.215rem, 1.134rem + 0.432vw, 1.485rem); --step-2: clamp(1.62rem, 1.404rem + 1.08vw, 2.43rem); }

/* The compact block that stays on screen: title, one-line intro, search, layout switch, then the category buttons */
:root { --top-gap: 1.3rem; --sticky-top: calc(var(--header-h) + var(--top-gap)); } /* the block starts exactly where it sticks, so it never jumps */
.menu-top { margin-top: var(--top-gap); position: sticky; top: var(--sticky-top); z-index: 90; padding: 0.7rem 0 2.5rem; background: var(--cream); border-bottom: 1px solid var(--line); }
.menu-top::before { content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--top-gap)); height: var(--top-gap); background: var(--cream); } /* hides dishes passing in the gap above the stuck block */
.menu-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem var(--space-3); margin-bottom: 3rem; }
.menu-title { min-width: 0; }
.menu-title h1 { margin: 0; font-size: var(--step-2); line-height: 1.1; }
@media (min-width: 48rem) {
  .menu-head { flex-wrap: nowrap; }
  .menu-controls { flex: none; }
}
.menu-controls { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; } /* room for the search focus ring, so it never touches the switch */
.menu-controls[hidden], .menu-filters[hidden] { display: none; }
.menu-search { width: 14rem; max-width: 100%; padding: 0.45rem 0.9rem; font: inherit; font-size: var(--step--1); color: var(--graphite); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; }
.menu-search:focus { border-color: var(--graphite); }
.menu-filters { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.chip-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
.chip { padding: 0.32rem 0.8rem; font: inherit; font-size: calc(0.875rem + 2px); font-weight: 700; cursor: pointer; color: var(--graphite); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.chip:hover { border-color: var(--graphite); }
.chip[aria-pressed="true"] { color: #fff; background: var(--graphite); border-color: var(--graphite); }
.view-switch { display: inline-flex; padding: 0.15rem; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; }
.view-btn { padding: 0.25rem 0.85rem; font: inherit; font-size: 0.8125rem; font-weight: 700; cursor: pointer; color: var(--graphite); background: transparent; border: 0; border-radius: 999px; }
.view-btn[aria-pressed="true"] { color: #fff; background: var(--graphite); }
/* Narrower than a laptop window (under 64rem): the category buttons sit in one row that slides sideways */
@media (max-width: 63.99rem) {
  .chip { flex: none; }
  .menu-filters { flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: nowrap; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.3rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .menu-filters::-webkit-scrollbar { display: none; }
  .chip-row { display: contents; }
}
/* Phones: slightly smaller buttons; the search and the List/Cards switch share the width */
@media (max-width: 40rem) {
  .chip { font-size: 0.875rem; padding: 0.3rem 0.7rem; }
  .menu-controls { width: 100%; gap: 0.6rem; }
  .menu-search { flex: 1 1 auto; min-width: 0; width: auto; }
}
/* Narrow windows: the block still stays on screen, a little more compact; the category buttons wrap into several lines, like the allergen buttons */
@media (max-width: 63.99rem) {
  :root { --top-gap: 0.5rem; }
  .menu-top { padding: 0.4rem 0 0.7rem; }
  .menu-head { margin-bottom: 0.6rem; }
  .menu-title h1 { font-size: var(--step-1); }
  .menu-filters { align-items: flex-start; }
  .chip-row { justify-content: flex-start; }
}

.menu-empty { margin: var(--space-4) 0; color: var(--muted); font-size: var(--step-1); text-align: center; }

/* Sections */
.menu-cat { padding-bottom: var(--space-4); scroll-margin-top: calc(var(--sticky-top) + var(--menu-top-h, 7rem)); }
/* Filtered-out dishes and sections must really disappear (this rule is stronger than the list and card layouts below) */
.menu-body .menu-cat[hidden], .menu-body .item[hidden] { display: none; }
.cat-head { position: sticky; top: calc(var(--sticky-top) + var(--menu-top-h, 7rem)); z-index: 80; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-3); padding: 0.6rem 0; background: var(--cream); border-bottom: 2px solid var(--graphite); }
.cat-head h2 { margin: 0; font-size: var(--step-1); }
.cat-note, .cat-footnote { margin: 0; font-size: var(--step--1); color: var(--muted); }
.cat-footnote { margin-top: var(--space-2); }

/* Dish text (the same in both layouts) */
.menu-items { list-style: none; margin: 0; padding: 0; }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-1); } /* the price stays on the first line of the name */
.item-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 0.5rem; margin: 0; font-size: var(--fs-name); letter-spacing: 0; line-height: 1.3; }
.item-price { flex: none; text-align: right; font-size: var(--fs-price); font-weight: 800; white-space: nowrap; color: var(--red-text); }
.price-line { display: block; }
.price--ask { font-size: var(--step--1); font-weight: 700; color: var(--muted); white-space: normal; }
.item-variants { list-style: none; margin: 0; padding: 0; }
.item-variants li { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--step--1); }
.item-desc { margin: 0.35rem 0 0; color: var(--muted); font-size: var(--fs-body); }
/* Choices (fillings, flavours): one under another; long lists run in two columns */
.item-options { margin: 0.45rem 0 0; padding: 0; list-style: none; font-size: var(--fs-body); font-weight: 700; }
.item-options li { position: relative; padding-left: 0.9rem; break-inside: avoid; }
.item-options li::before { content: ""; position: absolute; left: 0.1rem; top: 0.62em; width: 0.28rem; height: 0.28rem; border-radius: 50%; background: var(--red-text); }
.item-options--cols { column-count: 2; column-gap: var(--space-2); }
.item-allergens { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.item-allergens img { display: block; width: 1.5rem; height: 1.5rem; }
.item-fine { margin: 0.5rem 0 0; font-size: 0.75rem; color: var(--muted); }
.item-fine + .item-fine { margin-top: 0.15rem; }
.card-photo { display: block; padding: 0; overflow: hidden; cursor: zoom-in; background: var(--paper); border: 1px solid var(--line); }
.card-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; }

/* Dishes without a photo show the Ruta logo on a grey tile (both layouts) */
.card-photo--logo { display: grid; place-items: center; aspect-ratio: 4 / 3; cursor: default; }
.card-photo--logo img { width: 30%; height: auto; aspect-ratio: auto; opacity: .92; }
[data-view="list"] .card-photo--logo img { width: 42%; }

/* LIST layout (the default): rows with a small photo on the right. The photo keeps its real shape, nothing is cropped. */
[data-view="list"] .item { display: grid; grid-template-columns: 1fr 5.5rem; gap: 0 var(--space-2); align-items: start; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
[data-view="list"] .card-body { grid-column: 1; grid-row: 1; }
[data-view="list"] .card-photo { grid-column: 2; grid-row: 1; width: 5.5rem; border-radius: var(--radius); }
@media (min-width: 40rem) {
  [data-view="list"] .item { grid-template-columns: 1fr 7.5rem; }
  [data-view="list"] .card-photo { width: 7.5rem; }
}

/* CARDS layout: a grid of rounded cards with the whole photo on top */
/* One value for the space between card rows and between the section line and the first row */
[data-view="cards"] { --menu-gap: var(--space-3); }
[data-view="cards"] .cat-head { margin-bottom: var(--menu-gap); }
[data-view="cards"] .menu-items { display: grid; gap: var(--menu-gap); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; } /* 2 cards in a row on phones, 3 on tablets, 4 on wide screens */
@media (min-width: 40rem) { [data-view="cards"] .menu-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 64rem) { [data-view="cards"] .menu-items { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Phones: two narrow cards side by side, so the price goes under the name and the cards are a little tighter */
@media (max-width: 39.99rem) {
  [data-view="cards"] { --menu-gap: 0.7rem; }
  [data-view="cards"] .card-body { padding: 0.7rem; }
  [data-view="cards"] .card-top { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  [data-view="cards"] .item-price { margin-left: 0; text-align: left; white-space: normal; }
  [data-view="cards"] .item-title { font-size: 0.9375rem; }
  [data-view="cards"] .item-options--cols { column-count: 1; }
  [data-view="cards"] .item-price { min-width: 0; max-width: 100%; }
  [data-view="cards"] .item-variants li { flex-wrap: wrap; justify-content: flex-start; gap: 0 0.5rem; overflow-wrap: anywhere; }
}
[data-view="cards"] .item { display: flex; flex-direction: column; overflow: hidden; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-lg); transition: border-color .3s ease, box-shadow .3s ease; }
[data-view="cards"] .item:hover { border-color: var(--graphite); box-shadow: 0 10px 30px rgba(21, 21, 21, .08); }
[data-view="cards"] .card-photo { width: 100%; border: 0; border-bottom: 1px solid var(--line); }
[data-view="cards"] .card-photo img { transition: transform .6s ease; }
[data-view="cards"] .item:hover .card-photo img { transform: scale(1.04); }
[data-view="cards"] .card-body { flex: 1; padding: var(--space-2); }
/* A wide price (two variants, "Ask us for the price") moves under the name instead of crushing it */
@media (min-width: 40rem) {
  [data-view="cards"] .card-top { flex-wrap: wrap; }
  [data-view="cards"] .item-title { flex: 1 1 8rem; min-width: 8rem; }
  [data-view="cards"] .item-price { flex: 0 1 auto; margin-left: auto; }
}
[data-view="cards"] 
/* The allergy reminder at the very bottom of the page */
.allergy-note { margin: var(--space-4) 0 0; padding: var(--space-3); background: var(--paper); border-left: 4px solid var(--red); border-radius: var(--radius); }
.allergy-note p { margin: 0; }

/* Photo lightbox (a native <dialog>) */
.lightbox { padding: var(--space-1); max-width: min(92vw, 56rem); border: 0; border-radius: var(--radius-lg); background: var(--paper); }
.lightbox::backdrop { background: rgba(21, 21, 21, 0.78); }
.lightbox img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; border-radius: var(--radius); }
.lightbox form { display: flex; justify-content: flex-end; margin-bottom: 0.35rem; }
.lightbox-close { padding: 0.25rem 0.75rem; font: inherit; font-size: var(--step--1); font-weight: 700; cursor: pointer; color: var(--graphite); background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.lightbox-close:hover { border-color: var(--graphite); }
.page-footnote { margin: var(--space-3) 0 0; }
