/* ==========================================================================
   Seven Bites — Menu page
   Based on showcase screen "2. Menu Page": rotating special-offer banner,
   sticky category sidebar, search + sort, products.
   "All Items": a sideways row per category. One category: a grid with the
   column count set per category (menuLayout in data/menu.js); 2-per-row
   grids use side-by-side cards on desktop. Phones: sticky chips and
   2 cards per row (Jumia style).
   ========================================================================== */

.menu-page {
  padding-block: var(--sp-6) var(--sp-10);
}

/* ---------- Special offer banner (slides cross-fade) ---------- */

.menu-offer {
  position: relative;
  display: grid;
  min-height: 268px;
  border-radius: var(--r-lg);
  background: var(--c-navy);
  color: var(--c-on-dark);
  box-shadow: var(--sh-card);
  overflow: hidden;
  isolation: isolate;
}

.menu-offer:empty {
  display: none;
}

.menu-offer__slide {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s var(--ease-out), visibility 0s linear 0.7s;
}

.menu-offer__slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s var(--ease-out), visibility 0s;
}

.menu-offer__body {
  position: relative;
  z-index: 1;
  max-width: 52%;
  padding: var(--sp-8) var(--sp-10) var(--sp-10);
}

.menu-offer__body > * {
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.6s var(--ease-out), opacity 0.6s var(--ease-out);
}

.menu-offer__slide.is-active .menu-offer__body > * {
  transform: none;
  opacity: 1;
}

.menu-offer__slide.is-active .menu-offer__body > :nth-child(2) { transition-delay: 0.08s; }
.menu-offer__slide.is-active .menu-offer__body > :nth-child(3) { transition-delay: 0.16s; }
.menu-offer__slide.is-active .menu-offer__body > :nth-child(4) { transition-delay: 0.24s; }
.menu-offer__slide.is-active .menu-offer__body > :nth-child(5) { transition-delay: 0.32s; }

.menu-offer__tag {
  color: var(--c-yellow);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}

.menu-offer__title {
  margin-top: 4px;
  color: var(--c-yellow);
  font-size: clamp(1.75rem, 1.2rem + 1.4vw, 2.25rem);
  font-weight: var(--fw-black);
  line-height: 1.08;
}

.menu-offer__text {
  max-width: 470px;
  margin-top: var(--sp-2);
  color: #dfe3e8;
  font-size: var(--fs-md);
  line-height: 1.55;
}

/* "New on the menu" label */
.menu-offer__pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  background: var(--c-yellow);
  color: var(--c-navy);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* price + items left */
.menu-offer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}

.menu-offer__meta strong {
  color: var(--c-on-dark);
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
}

.menu-offer__stock {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.12);
  color: var(--c-on-dark);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.menu-offer__stock--low {
  background: var(--c-red);
}

.menu-offer__stock--out {
  background: var(--c-text-2);
}

.menu-offer__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-4);
}

.menu-offer__code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  border: 1.5px dashed var(--c-yellow);
  background: rgba(252, 210, 6, 0.08);
  color: var(--c-on-dark);
  font-size: var(--fs-sm);
  transition: background-color var(--t-base) var(--ease-out);
}

.menu-offer__code:hover {
  background: rgba(252, 210, 6, 0.18);
}

.menu-offer__code strong {
  color: var(--c-yellow);
  letter-spacing: 0.06em;
}

.menu-offer__code .icon {
  width: 16px;
  height: 16px;
}

/* photo on the right, fading into the navy, slowly settling while shown */
.menu-offer__img {
  position: absolute;
  inset: 0 0 0 auto;
  width: 56%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
  transform: scale(1.08);
  transition: transform 6s linear;
}

.menu-offer__slide.is-active .menu-offer__img {
  transform: scale(1);
}

.menu-offer__dots {
  position: absolute;
  left: var(--sp-10);
  bottom: var(--sp-4);
  z-index: 2;
  display: flex;
  gap: 6px;
}

.menu-offer__dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.35);
  transition: width var(--t-base) var(--ease-out), background-color var(--t-base) var(--ease-out);
}

.menu-offer__dots button[aria-selected="true"] {
  width: 22px;
  background: var(--c-yellow);
}

/* ---------- Layout: sidebar + main ---------- */

.menu-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--sp-6);
  margin-top: var(--sp-6);
}

/* stays in place while the products scroll */
.menu-side {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-5));
  align-self: start;
  max-height: calc(100vh - var(--header-h) - var(--sp-10));
  overflow-y: auto;
  scrollbar-width: thin;
}

.menu-cats {
  display: grid;
  gap: 4px;
  list-style: none;
}

.menu-cat {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: background-color var(--t-base) var(--ease-out);
}

.menu-cat:hover {
  background: var(--c-tile);
}

.menu-cat.is-active {
  background: var(--c-yellow-soft);
  font-weight: var(--fw-semibold);
  box-shadow: inset 3px 0 0 var(--c-yellow);
}

.menu-cat__thumb {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.menu-cat__thumb--all {
  display: grid;
  place-items: center;
  background: var(--c-yellow);
  color: var(--c-navy);
}

.menu-cat__thumb--all .icon {
  width: 17px;
  height: 17px;
}

.menu-cat__name {
  flex: 1;
}

.menu-cat__count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  font-size: 0.6875rem;
  text-align: center;
}

.menu-cat.is-active .menu-cat__count {
  background: var(--c-navy);
  border-color: var(--c-navy);
  color: var(--c-yellow);
}

/* ---------- Search + sort (stay at the top while scrolling on desktop) ---------- */

.menu-main {
  min-width: 0;
  scroll-margin-top: calc(var(--header-h) + var(--sp-4));
}

.menu-tools {
  position: sticky;
  top: calc(var(--header-h) + 3px);
  z-index: 6;
  display: flex;
  gap: var(--sp-3);
  margin-inline: calc(var(--sp-2) * -1);
  padding: var(--sp-2);
  background: var(--c-page);
}

.menu-search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  min-width: 0;
  padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}

.menu-search:focus-within {
  border-color: var(--c-yellow);
  box-shadow: 0 0 0 3px rgba(252, 210, 6, 0.2);
}

.menu-search .icon {
  width: 18px;
  height: 18px;
  color: var(--c-muted);
}

.menu-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--c-text);
  outline: none;
}

.menu-sort {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.menu-sort select {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  cursor: pointer;
  outline: none;
}

.menu-count {
  margin: var(--sp-2) 0;
  color: var(--c-muted);
  font-size: var(--fs-xs);
}

/* ---------- Product groups ---------- */

.menu-group + .menu-group {
  margin-top: var(--sp-8);
}

.menu-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.menu-group__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--c-text);
}

.menu-group__title span {
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--c-yellow-soft);
  color: var(--c-navy);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.menu-group__all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: color var(--t-base) var(--ease-out), gap var(--t-base) var(--ease-out);
}

.menu-group__all:hover {
  color: var(--c-text);
  gap: 8px;
}

.menu-group__all .icon {
  width: 16px;
  height: 16px;
}

.menu-subtitle {
  margin: var(--sp-8) 0 var(--sp-3);
  color: var(--c-text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.menu-group__head + .menu-subtitle {
  margin-top: 0;
}

/* ---------- "All Items": one sideways row per category ---------- */

.menu-row {
  position: relative;
}

.menu-row__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 232px;
  gap: var(--sp-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 6px; /* room for card shadows */
}

.menu-row__track::-webkit-scrollbar {
  display: none;
}

.menu-row__track > * {
  scroll-snap-align: start;
}

/* rows always reach the right edge: cards sized so exactly 4 (desktop) or
   3 (tablet) fit; categories with that many items or fewer stretch to fill */
@media (min-width: 1024px) {
  .menu-row__track {
    grid-auto-columns: calc((100% - 3 * var(--sp-4)) / 4);
  }
  .menu-row__track--fit-4 {
    grid-auto-columns: calc((100% - (var(--n) - 1) * var(--sp-4)) / var(--n));
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .menu-row__track {
    grid-auto-columns: calc((100% - 2 * var(--sp-4)) / 3);
  }
  .menu-row__track--fit-3 {
    grid-auto-columns: calc((100% - (var(--n) - 1) * var(--sp-4)) / var(--n));
  }
}

.menu-row__arrow {
  position: absolute;
  top: 34%;
  right: -12px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-navy);
  box-shadow: var(--sh-card-hover);
  transition: background-color var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}

.menu-row__arrow[hidden] {
  display: none;
}

.menu-row__arrow:hover {
  background: var(--c-yellow);
  transform: scale(1.06);
}

.menu-row__arrow--prev {
  right: auto;
  left: -12px;
}

.menu-row__arrow--prev .icon {
  transform: rotate(180deg);
}

.menu-row__arrow .icon {
  width: 20px;
  height: 20px;
}

/* ---------- One category: grids ---------- */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

/* 2 per row (and 2-item rows) on desktop: side-by-side cards, photo left */
@media (min-width: 768px) {
  .menu-grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
  :is(.menu-grid--2, .menu-row__track--wide) .product-card {
    display: grid;
    grid-template-columns: 46% 1fr;
  }
  :is(.menu-grid--2, .menu-row__track--wide) .product-card__media {
    aspect-ratio: auto;
    height: 100%;
    min-height: 210px;
  }
  :is(.menu-grid--2, .menu-row__track--wide) .product-card__body {
    justify-content: center;
    gap: 6px;
    padding: var(--sp-5);
  }
  :is(.menu-grid--2, .menu-row__track--wide) .product-card__name {
    font-size: var(--fs-md);
  }
  :is(.menu-grid--2, .menu-row__track--wide) .product-card__price {
    font-size: var(--fs-lg);
  }
  :is(.menu-grid--2, .menu-row__track--wide) .product-card__price--ask {
    font-size: var(--fs-sm);
  }
  :is(.menu-grid--2, .menu-row__track--wide) .product-card__cta {
    margin-top: var(--sp-2);
  }
}

/* ---------- Empty state ---------- */

.menu-empty {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding: var(--sp-12) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  text-align: center;
}

.menu-empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-yellow-soft);
  color: var(--c-navy);
}

.menu-empty__icon .icon {
  width: 26px;
  height: 26px;
}

.menu-empty h2 {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}

.menu-empty p {
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.menu-empty .btn {
  margin-top: var(--sp-2);
}

/* ---------- Tablet ---------- */

@media (min-width: 768px) and (max-width: 1023.98px) {
  .menu-layout {
    grid-template-columns: 180px 1fr;
    gap: var(--sp-4);
  }
  .menu-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .menu-grid--2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Phones ---------- */

@media (max-width: 767.98px) {
  .menu-page {
    padding-top: var(--sp-4);
  }

  .menu-offer {
    min-height: 212px;
    border-radius: var(--r-md);
  }
  .menu-offer__body {
    max-width: 74%;
    padding: var(--sp-4) var(--sp-4) var(--sp-8);
  }
  .menu-offer__tag {
    font-size: var(--fs-xs);
  }
  .menu-offer__pill {
    padding: 2px 9px;
    font-size: 0.5625rem;
  }
  .menu-offer__title {
    font-size: 1.25rem;
  }
  .menu-offer__text {
    display: -webkit-box;
    margin-top: 4px;
    font-size: var(--fs-xs);
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .menu-offer__meta {
    gap: var(--sp-2);
    margin-top: var(--sp-2);
  }
  .menu-offer__meta strong {
    font-size: var(--fs-md);
  }
  .menu-offer__stock {
    padding: 2px 8px;
    font-size: 0.625rem;
  }
  .menu-offer__actions {
    margin-top: var(--sp-2);
    gap: 6px;
  }
  .menu-offer__actions .btn,
  .menu-offer__code {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.6875rem;
  }
  .menu-offer__code > span,
  .menu-offer__code .icon {
    display: none;
  }
  .menu-offer__img {
    width: 66%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.55) 45%, #000 80%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.55) 45%, #000 80%);
  }
  .menu-offer__dots {
    left: var(--sp-4);
    bottom: var(--sp-2);
  }

  .menu-layout {
    display: block;
    margin-top: var(--sp-3);
  }

  /* category chips stick under the header while scrolling */
  .menu-side {
    position: sticky;
    top: 67px;
    z-index: 7;
    max-height: none;
    overflow: visible;
    margin-inline: calc(var(--gutter) * -1);
    padding: var(--sp-2) var(--gutter);
    background: var(--c-page);
  }
  .menu-cats {
    display: flex;
    gap: var(--sp-2);
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .menu-cats::-webkit-scrollbar {
    display: none;
  }
  .menu-cats li {
    flex-shrink: 0;
    scroll-snap-align: start;
  }
  .menu-cat {
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--r-pill);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    white-space: nowrap;
  }
  .menu-cat.is-active {
    background: var(--c-yellow);
    border-color: var(--c-yellow);
    box-shadow: none;
  }
  .menu-cat__thumb,
  .menu-cat__count {
    display: none;
  }

  .menu-main {
    scroll-margin-top: 120px;
  }
  /* search sits under the chips (not sticky on phones — keeps room for food) */
  .menu-tools {
    position: static;
    margin: var(--sp-1) 0 0;
    padding: 0;
  }
  .menu-sort {
    padding: 0 var(--sp-2);
  }
  .menu-sort > span {
    display: none;
  }
  .menu-sort select {
    max-width: 112px;
  }

  .menu-group__title {
    font-size: var(--fs-md);
  }
  .menu-group__head {
    margin-bottom: var(--sp-3);
  }

  /* rows: about two cards in view, the next one peeking */
  .menu-row__track {
    grid-auto-columns: 44%;
    gap: var(--sp-3);
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
  }
  .menu-row__arrow {
    display: none;
  }

  /* one category: 2 per row, like Jumia */
  .menu-grid,
  .menu-grid--2,
  .menu-grid--3 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
  }
  .menu-grid--phone-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-2);
  }

  /* compact cards on phones */
  .menu-results .product-card__body {
    padding: var(--sp-2) var(--sp-3) var(--sp-3);
    gap: 2px;
  }
  .menu-results .product-card__name {
    font-size: var(--fs-sm);
  }
  .menu-results .product-card__price {
    font-size: var(--fs-base);
  }
  .menu-results .product-card__price--ask {
    font-size: var(--fs-xs);
  }
  .menu-results .stock-badge {
    top: 8px;
    left: 8px;
    padding: 2px 7px;
    font-size: 0.625rem;
  }
  .menu-results .product-card__fav {
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
  }
  .menu-results .product-card__fav .icon {
    width: 14px;
    height: 14px;
  }

  /* 3 across: smallest cards — short button, no stars */
  .menu-grid--phone-3 .product-card__body {
    padding: var(--sp-2);
  }
  .menu-grid--phone-3 .product-card__name {
    font-size: var(--fs-xs);
  }
  .menu-grid--phone-3 .product-card__price {
    font-size: var(--fs-sm);
  }
  .menu-grid--phone-3 .product-card__meta {
    display: none;
  }
  .menu-grid--phone-3 .product-card__cta {
    min-height: 30px;
    padding: 0;
    font-size: var(--fs-xs);
  }
  .menu-grid--phone-3 .product-card__cta-more {
    display: none;
  }
  .menu-grid--phone-3 .stock-badge {
    font-size: 0.5625rem;
  }
}
