/*
 * menu.css — styles for the MenuSystem component (see menu.js header for
 * drop-in instructions and the full token list).
 *
 * This file intentionally does NOT declare a :root block. Every color/font
 * reference below goes through a --menu-* custom property with a hardcoded
 * fallback, so the component renders correctly standalone; host sites brand
 * it by overriding the --menu-* tokens in their own stylesheet.
 *
 * ── TOKEN ROLES ─────────────────────────────────────────────────────────
 *   --menu-text     item names, descriptions, inactive tabs, filter labels,
 *                   the section-heading rule, and the highlight badge fill
 *   --menu-accent   category headings, section headings, prices, the active
 *                   tab, and the highlighted-item fill
 *   --menu-surface  anything sitting ON --menu-text or --menu-accent
 *   --menu-font-display  optional display face for the big category heading;
 *                   falls back to --menu-font-heading when unset
 *   --menu-font-heading  section headings and item names
 *   --menu-font-body     tabs, filters, descriptions, prices
 *   --menu-category-size        category heading size, default 2em. Raise it
 *                   when --menu-font-display is a script face with a small
 *                   x-height (Avenida sets 6em for Angelface).
 *   --menu-category-size-sm     same, below 700px. Defaults to the desktop value.
 *
 * Sizes below are em-based off the host page's font-size, so the component
 * scales with the site rather than fighting it.
 */

/* ---------- loading skeleton ---------- */

.menu-skeleton {
  padding-top: 0.5em;
}

.skeleton-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: 1em;
}

.skeleton-tab {
  height: 2.2em;
}

.skeleton-diet-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2em;
  margin-bottom: 1.5em;
}

.skeleton-diet-pill {
  height: 1.4em;
}

/* Mirrors the real category heading: tall display line, then the section
   rule, then two columns of rows (MIGRATION.md §5.1 — no jump on load). */
.skeleton-heading {
  display: block;
  width: 180px;
  height: 3.6em;
  margin: 2em 0 0.5em;
}

.skeleton-section-title {
  display: block;
  height: 1.6em;
  margin: 0 0 1.1em;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2em 0;
  margin-bottom: 2.5em;
}

.skeleton-item {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 0.6em;
}

.skeleton-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 4px;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.skeleton-line {
  height: 0.9em;
}

.skeleton-price {
  width: 48px;
  height: 1em;
  flex-shrink: 0;
}

.skeleton {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--menu-skeleton-base, #5f1d1526);
  border-radius: 3px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--menu-skeleton-shimmer, #d6524326), transparent);
  animation: skeletonShimmer 1.6s infinite;
}

@keyframes skeletonShimmer {
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
}

/* ---------- category tabs ---------- */

.tabs-scroll {
  position: relative;
}

.tabs-swipe-hint {
  display: none;
  margin: 0 0 0.6em;
  font-family: var(--menu-font-body, inherit);
  font-size: 0.8em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--menu-text, #5F1D15);
  opacity: 0.65;
}

.tabs-swipe-hint span {
  display: inline-block;
  animation: tabsSwipeArrow 1.6s ease-in-out infinite;
}

@keyframes tabsSwipeArrow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .tabs-swipe-hint span { animation: none; }
}

#category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: 1em;
}

#category-tabs button {
  padding: 2px 10px;
  border: 0;
  border-radius: 5px;
  background-color: transparent;
  color: var(--menu-text, #5F1D15);
  font-family: var(--menu-font-body, inherit);
  font-size: 1.3em;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
  transition: background-color .25s ease, color .25s ease;
}

#category-tabs button:hover,
#category-tabs button.active {
  background-color: var(--menu-accent, #C59B3B);
  color: var(--menu-surface, #F6F1EB);
  text-decoration: none;
}

/* ---------- diet filters ---------- */

#diet-filters {
  margin-bottom: 1.5em;
}

.diet-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2em;
}

#diet-filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-size: 0.95em;
  font-family: var(--menu-font-body, inherit);
  line-height: 1;
  color: var(--menu-text, #5F1D15);
  cursor: pointer;
}

#diet-filters input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  appearance: none;
  border: 2px solid var(--menu-text, #5F1D15);
  border-radius: 3px;
  background: transparent;
  position: relative;
  flex-shrink: 0;
}

#diet-filters input[type="checkbox"]:checked {
  background: var(--menu-text, #5F1D15);
  border-color: var(--menu-text, #5F1D15);
}

#diet-filters input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 6px; height: 10px;
  border: solid var(--menu-surface, #F6F1EB);
  border-width: 0 2.5px 2.5px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

.diet-icon-img {
  height: 18px;
  width: auto;
  vertical-align: middle;
  object-fit: contain;
}

.diet-icon-svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
  color: var(--menu-text, #5F1D15);
}

/* ---------- menu content ---------- */

/* Big display heading per category. Uses --menu-font-display when the host
   page sets one (e.g. a script face), otherwise the heading font. */
#menu-container > h2 {
  font-family: var(--menu-font-display, var(--menu-font-heading, inherit));
  font-size: var(--menu-category-size, 2em);
  font-weight: 500;
  line-height: 1.3;
  margin: 0.34em 0 0.05em;
  color: var(--menu-accent, #C59B3B);
}

.menu-category-description {
  color: var(--menu-text, #5F1D15);
  font-family: var(--menu-font-body, inherit);
  margin-bottom: 1rem;
}

.menu-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 2.5em;
  color: var(--menu-text, #5F1D15);
}

/* Section heading spans both columns, with a rule in the text colour to
   separate it from the rows beneath. */
.menu-section h3 {
  grid-column: span 2;
  font-family: var(--menu-font-heading, inherit);
  font-size: 1.6em;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.7em;
  padding-bottom: 0.1em;
  color: var(--menu-accent, #C59B3B);
  border-bottom: 3px solid var(--menu-text, #5F1D15);
}

.product-icon-container {
  display: flex;
  align-items: center;
}

.product-icon-container svg {
  width: 70px;
  height: 70px;
}

.product-icon-svg {
  color: var(--menu-accent, #C59B3B);
}

.product-icon {
  height: 70px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
}

.menu-item {
  display: flex;
  gap: 1.5em;
  align-items: flex-start;
  padding: 0.6em;
  font-family: var(--menu-font-body, inherit);
}

/* Highlighted items are a solid accent panel with everything reversed out. */
.menu-item.highlighted {
  background: var(--menu-accent, #C59B3B);
  border: 5px solid var(--menu-accent, #C59B3B);
  border-radius: 8px;
}

.menu-item.highlighted h4,
.menu-item.highlighted p,
.menu-item.highlighted .price,
.menu-item.highlighted .diet-icon-svg {
  color: var(--menu-surface, #F6F1EB);
}

.text-col {
  flex: 1;
}

.title-with-icons {
  display: flex;
  align-items: center;
  gap: 0.4em;
  flex-wrap: wrap;
}

.title-with-icons h4 {
  margin: 0;
  font-size: 1.1em;
}

.menu-item h4 {
  font-family: var(--menu-font-heading, inherit);
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  color: var(--menu-text, #5F1D15);
}

.menu-item p {
  font-size: 0.95em;
  line-height: 1.8;
  margin: 0;
  color: var(--menu-text, #5F1D15);
}

.menu-item .icons {
  display: flex;
  gap: 0.4em;
  flex-wrap: wrap;
  justify-content: center;
}

.price-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  align-self: stretch;
  text-align: right;
}

.menu-item .price {
  font-family: var(--menu-font-body, inherit);
  font-weight: 700;
  color: var(--menu-accent, #C59B3B);
  white-space: nowrap;
  margin-bottom: 0.2em;
}

.top-pick {
  font-family: var(--menu-font-body, inherit);
  font-size: 0.85em;
  font-weight: 700;
  background: var(--menu-text, #5F1D15);
  color: var(--menu-surface, #F6F1EB);
  padding: 2px 6px;
  border-radius: 5px;
  text-align: center;
  max-width: 100%;
  align-self: flex-end;
}

/* ---------- error state ---------- */

.menu-error {
  color: var(--menu-text, #5F1D15);
  font-family: var(--menu-font-body, inherit);
  text-align: center;
  padding: 3em 1em;
}

.menu-error p {
  margin: 0 0 1em;
}

.menu-error-retry {
  border: 2px solid var(--menu-text, #5F1D15);
  background: transparent;
  color: var(--menu-text, #5F1D15);
  font-family: var(--menu-font-body, inherit);
  font-size: 1em;
  padding: .5em 1.4em;
  cursor: pointer;
  border-radius: 5px;
  transition: all .3s ease;
}

.menu-error-retry:hover {
  background: var(--menu-text, #5F1D15);
  color: var(--menu-surface, #F6F1EB);
}

/* ---------- mobile ---------- */

@media (max-width: 700px) {
  .skeleton-grid {
    grid-template-columns: 1fr;
  }

  #menu-container > h2 {
    font-size: var(--menu-category-size-sm, var(--menu-category-size, 2em));
  }

  .menu-section {
    grid-template-columns: 1fr;
  }

  .menu-section h3 {
    grid-column: span 1;
  }

  /* Keep the price beside the item name rather than stacking it underneath —
     three columns (optional icon, text, price) so the row reads the same as
     it does on desktop. */
  .menu-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon text price";
    align-items: start;
    gap: .3em .6em;
    padding: .6em 0;
  }

  .menu-item.highlighted {
    padding: .6em;
  }

  .product-icon-container {
    grid-area: icon;
    align-self: center;
  }

  .text-col {
    grid-area: text;
    min-width: 0;
  }

  .price-col {
    grid-area: price;
    align-items: flex-end;
    min-width: auto;
  }

  .top-pick {
    align-self: flex-end;
  }

  #category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #category-tabs::-webkit-scrollbar {
    display: none;
  }

  #category-tabs button {
    flex: 0 0 auto;
  }

  .tabs-swipe-hint {
    display: block;
  }

  /* 44px hit area for the filter checkboxes on touch (MIGRATION.md §2).
     Desktop keeps the tighter row height. */
  #diet-filters label {
    min-height: 44px;
  }
}
