/* Template "gallery": photo grid on dark green. Loaded ONLY when a shop uses Gallery:
   src/components/menu/templates/gallery/Gallery.tsx renders the <link> to this file
   (a plain file in public/, so Next.js does not add it to every menu page).
   Classes start with "menu-ga-". Colours only from the palette variables (--p-*).
   ".menu-page.menu-t-gallery" (2 classes) beats the defaults in shared.css whatever the
   load order of the two files. */

.menu-page.menu-t-gallery {
  --menu-page-bg: var(--p-gallery);
  --menu-page-text: var(--p-on-dark);
  --menu-footer-text: var(--p-on-dark-muted);
  --menu-footer-link: var(--p-on-dark);
  --menu-focus: var(--p-accent);
  --lang-bg: var(--p-dark3);
  --lang-text: var(--p-on-dark);
  --lang-active-bg: var(--p-cream);
  --lang-active-text: var(--p-text);
  --pill-bg: var(--p-dark3);
  --pill-text: var(--p-on-dark);
  --pill-dot: var(--p-accent);
  --call-bg: var(--p-gallery);
  --call-border: var(--p-dark3);
  --call-btn-bg: var(--p-accent);
  --call-btn-text: var(--p-on-accent);
  --call-msg-bg: var(--p-dark3);
  --call-msg-text: var(--p-on-dark);
  --call-msg-border: var(--p-dark3);
  --call-good-bg: var(--p-dark3);
  --call-good-border: var(--p-accent);
  /* Search + filters on the dark page (M4). Filter chips are outlined, so they never look
     like the filled category chips. */
  --find-label: var(--p-on-dark);
  --find-small: var(--p-on-dark-muted);
  --find-box-bg: var(--p-cream);
  --find-box-text: var(--p-text);
  --find-box-line: var(--p-cream);
  --find-placeholder: var(--p-muted);
  --find-chip-bg: transparent;
  --find-chip-text: var(--p-on-dark);
  --find-chip-line: var(--p-on-dark-muted);
  --find-chip-on-bg: var(--p-cream);
  --find-chip-on-text: var(--p-text);
  --find-status: var(--p-on-dark-muted);
  --find-clear-bg: var(--p-dark3);
  --find-clear-text: var(--p-on-dark);
  --find-clear-line: var(--p-dark3);
  --find-empty-bg: var(--p-dark3);
  --find-empty-text: var(--p-on-dark);
  --find-empty-muted: var(--p-on-dark-muted);
}

/* ---------- Header ---------- */

.menu-ga-head {
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
  padding: 0.75rem 1rem 0.5rem;
}

.menu-ga-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.menu-ga-name {
  min-width: 0;
  margin: 0;
  color: var(--p-on-dark);
  font-family: var(--font-shop);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.menu-ga-logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.menu-ga-pill {
  margin-top: 0.625rem;
}

/* Cover photo = rounded banner under the header. T3: 96px on phones (search and chips on the
   first screen). T12: a wide banner from 640px (see the end of this file). */
.menu-ga-cover {
  position: relative;
  height: 96px;
  margin-top: 0.75rem;
  overflow: hidden;
  border-radius: 18px;
  background: var(--p-dark3);
}
.menu-ga-cover img {
  object-fit: cover;
}

/* ---------- Category chips (sticky) ---------- */

.menu-ga-chips {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--p-gallery);
}

.menu-ga-chip-row {
  display: flex;
  max-width: 48rem;
  margin: 0 auto;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 1rem 0.75rem;
  scrollbar-width: none;
}
.menu-ga-chip-row::-webkit-scrollbar {
  display: none;
}

.menu-ga-chip {
  display: block;
  flex: none;
  max-width: 80vw; /* a very long category name ends with "..." instead of a huge chip */
  min-height: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 44px;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--p-dark3);
  color: var(--p-on-dark);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.menu-ga-chip[aria-current="true"] {
  background: var(--p-cream);
  color: var(--p-text);
}

/* ---------- Grid of cards ---------- */

.menu-ga-main {
  flex: 1;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1rem 1.5rem;
}

.menu-ga-category {
  padding-top: 1.25rem;
  scroll-margin-top: 4.5rem; /* room for the sticky chips */
}

.menu-ga-cat-title {
  margin: 0 0 0.75rem;
  color: var(--p-on-dark);
  font-family: var(--font-shop);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* T10: the cards in a row stretch to the same height (no fixed heights); an odd last card keeps
   its column width. */
.menu-ga-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* 3 columns when the list is 600px+ wide (phones turned sideways, small tablets). The
   wide-screen column (768px+) is 560px, so it keeps 2 bigger cards. */
.menu-ga-main {
  container-type: inline-size;
}
@container (min-width: 600px) {
  .menu-ga-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* The <li>; the visible card is its button (so the focus ring is never cut off). */
.menu-ga-card {
  display: flex;
  min-width: 0;
}

/* M4: one card = one button (opens the item sheet). */
.menu-ga-btn {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: var(--p-card);
  color: var(--p-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

/* Photo first: a big photo on top (bigger than Classic's 72px square). T10: on every card; the
   shared placeholder (.menu-photo-ph) fills it under the photo. */
.menu-ga-photo {
  position: relative;
  display: block;
  flex: none;
  height: 120px;
  overflow: hidden;
  background: var(--p-divider);
}
@container (min-width: 520px) {
  .menu-ga-photo {
    height: 148px;
  }
}
.menu-ga-photo img {
  object-fit: cover;
}

.menu-ga-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.625rem 0.75rem 0.75rem;
}

/* T10: at most 2 lines (the sheet shows all of it). */
.menu-ga-item-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: var(--p-text);
  font-size: 16px; /* M1: at least 16px */
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.menu-ga-marks {
  display: inline-flex;
  gap: 0.25rem;
  margin-left: 0.3125rem;
  font-size: 14px;
  vertical-align: -1px;
  white-space: nowrap;
}

/* At most 2 lines on the card (the sheet shows all of it). */
.menu-ga-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--p-muted);
  font-size: 13px; /* M1: at least 13px */
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* T10: pinned to the bottom of the card, so the prices of a row line up. */
.menu-ga-price {
  display: block;
  margin-top: auto;
  padding-top: 0.125rem;
  color: var(--p-price);
  font-size: 14px;
  font-weight: 600;
}

/* "Popular" / "New": over the photo's top left corner (T10: every card has the photo box). */
.menu-ga-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.menu-ga-photo .menu-ga-badges {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
  z-index: 1;
}
.menu-ga-badge {
  border-radius: 999px;
  padding: 0.0625rem 0.5rem;
  background: var(--p-cream);
  color: var(--p-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.menu-ga-badge-popular {
  background: var(--p-accent);
  color: var(--p-on-accent);
}

/* Sold out: dark overlay on the photo with a pill, name muted, price crossed out. Last in
   the category (MenuPage). */
.menu-ga-sold .menu-ga-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--p-dark) 58%, transparent);
}
.menu-ga-sold-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  background: var(--p-cream);
  color: var(--p-text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.menu-ga-sold .menu-ga-item-name {
  color: var(--p-muted);
}
.menu-ga-sold .menu-ga-price {
  color: var(--p-muted);
  text-decoration: line-through;
}

.menu-ga-empty {
  padding: 2rem 0;
  color: var(--p-on-dark-muted);
  text-align: center;
}

/* T11: every card has the photo box: the "+" on its bottom-right corner (box 120px, 148px in a
   wide list), nothing extra on the right of the text. */
.menu-page.menu-t-gallery .menu-quick-photo > .menu-quick,
.menu-page.menu-t-gallery .menu-quick-text > .menu-quick {
  top: calc(120px - 44px);
  right: 0;
  transform: none;
}
@container (min-width: 520px) {
  .menu-page.menu-t-gallery .menu-quick-photo > .menu-quick,
  .menu-page.menu-t-gallery .menu-quick-text > .menu-quick {
    top: calc(148px - 44px);
  }
}
.menu-page.menu-t-gallery .menu-quick-text > button:first-child {
  padding-right: 0;
}

/* ---------- T12: tablets and wide screens (phones < 640px are unchanged) ---------- */
/* The dark page fills the screen; header, chips and grid sit in the centred container (24px
   sides, at most 1200px from 1024px). Grid: 3 columns from a 600px list, 4 from 900px. */
/* T13: the header follows its own width (.menu-headbox container, layout.ts numbers). */
@container menu-head (min-width: 640px) {
  .menu-page.menu-t-gallery .menu-ga-head {
    max-width: var(--menu-wide);
    padding-right: var(--menu-gutter-wide);
    padding-left: var(--menu-gutter-wide);
  }
  .menu-page.menu-t-gallery .menu-ga-cover {
    height: var(--menu-banner-tablet); /* about 220px at 768px */
  }
}
@container menu-head (min-width: 1024px) {
  .menu-page.menu-t-gallery .menu-ga-cover {
    height: var(--menu-banner-laptop);
  }
}
@media (min-width: 640px) {
  .menu-page.menu-t-gallery .menu-ga-chip-row,
  .menu-page.menu-t-gallery .menu-ga-main {
    max-width: var(--menu-wide);
    padding-right: var(--menu-gutter);
    padding-left: var(--menu-gutter);
  }
}
/* Tablets from 640px: 3 columns already from a 560px list (at 640px the list is 592px wide). */
@media (min-width: 640px) {
  @container (min-width: 560px) {
    .menu-ga-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }
}
@container (min-width: 900px) {
  .menu-ga-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* Mouse only: a thin accent ring on the card under the pointer (no lift, so the "+" and the
   badges stay exactly on the photo). */
@media (hover: hover) and (pointer: fine) {
  .menu-page.menu-t-gallery .menu-ga-btn:hover {
    box-shadow:
      0 0 0 2px var(--p-accent),
      0 8px 22px rgb(0 0 0 / 0.28);
  }
}
/* Landscape phones and other short screens: a short cover, so the header + sticky chips stay
   under about 45% of the height. */
@media (max-height: 500px) and (min-width: 640px) {
  .menu-page.menu-t-gallery .menu-ga-cover {
    height: 40px;
    margin-top: 0.5rem;
  }
}
