/* ============================================================
   MENU PAGE — Terra Mossa
   Light cream scope (overrides dark theme for the whole page)
   ============================================================ */

body.menu-page {
  /* Flip palette to warm cream */
  --bg:        #F5E9D2;
  --bg-soft:   #EFE3CE;
  --bg-elev:   #FAF1DC;
  --line:      #D9C5A4;
  --line-soft: #E6D6B8;
  --text:      #1F1810;
  --text-dim:  #5A4830;
  --text-mut:  #8E7651;
  --sand:      #8B6A3A;
  --terra:     #B85A3C;

  background: var(--bg);
  color: var(--text);
}
body.menu-page::before { display: none; } /* drop the dark-mode grain */

body.menu-page ::selection { background: var(--terra); color: #fff; }

/* ============================================================
   TOPBAR — small header
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(245, 233, 210, 0.88);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px var(--pad-x);
  gap: 20px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mut);
  transition: color .25s, transform .25s;
  justify-self: start;
}
.topbar__back:hover { color: var(--terra); }
.topbar__back:hover svg { transform: translateX(-3px); }
.topbar__back svg { transition: transform .25s; }

.topbar__logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-display);
  font-size: 18px;
  color: var(--sand);
  letter-spacing: 0.04em;
  justify-self: center;
}
.topbar__right {
  justify-self: end;
}
.topbar .lang button {
  color: var(--text-mut);
}
.topbar .lang button.is-active { color: var(--terra); }
.topbar .lang button:hover { color: var(--text); }

/* ============================================================
   HERO — compact
   ============================================================ */
.menu-hero {
  padding: clamp(48px, 8vh, 96px) 0 clamp(32px, 5vh, 64px);
  text-align: left;
  position: relative;
  border-bottom: 1px solid var(--line-soft);
}
.menu-hero .eyebrow { color: var(--sand); }
.menu-hero .eyebrow::before { background: var(--sand); }
.menu-hero .eyebrow::after {
  background: var(--terra);
  box-shadow: 0 0 8px rgba(184, 90, 60, 0.4);
}

.menu-hero h1 {
  font-family: var(--f-display);
  font-size: clamp(48px, 7vw, 100px);
  line-height: 0.95;
  margin-top: 20px;
  color: var(--text);
}
.menu-hero h1 em {
  font-family: var(--f-head);
  font-style: italic;
  font-weight: 400;
  color: var(--sand);
}
.menu-hero__sub {
  margin-top: 18px;
  max-width: 62ch;
  font-family: var(--f-head);
  font-size: clamp(17px, 1.5vw, 21px);
  color: var(--text-dim);
  line-height: 1.55;
}

/* ============================================================
   NAV — override for cream/light context
   ============================================================ */
.menu-page .nav.is-scrolled {
  background: rgba(245, 233, 210, 0.86);
  border-bottom-color: var(--line);
}
.menu-page .nav__logo { color: var(--sand); }
.menu-page .nav__links a { color: var(--text-dim); }
.menu-page .nav__links a:hover { color: var(--text); }
.menu-page .nav__links a::after { background: var(--terra); }
.menu-page .nav__links a.is-active { color: var(--terra); }
.menu-page .nav__links a.is-active::after { right: 0 !important; }

.menu-page .lang button { color: var(--text-mut); }
.menu-page .lang button.is-active { color: var(--terra); }
.menu-page .lang button:hover { color: var(--text); }

.menu-page .btn--primary {
  background: var(--terra);
  color: #fff;
}
.menu-page .btn--primary:hover {
  background: var(--sand);
  color: #1F1810;
}

.menu-page .mobile-toggle span { background: var(--text); }
.menu-page .mobile-toggle { border-color: var(--line); }
.menu-page .mobile-toggle:hover { border-color: var(--terra); }

/* Mobile drawer adjusted for light theme */
@media (max-width: 960px) {
  .menu-page .nav__links {
    background: var(--bg);
    border-top-color: var(--line);
    border-bottom-color: var(--line);
  }
  .menu-page .nav__links a {
    color: var(--text);
    border-bottom-color: var(--line-soft);
  }
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║  ★ NUOVO — SISTEMA DI NAVIGAZIONE DEL MENÙ (barra categorie)      ║
   ║  Tutto ciò che riguarda la barra sticky scorrevole delle          ║
   ║  categorie sta QUI sotto (più alcuni override in fondo, nel        ║
   ║  blocco @media MOBILE, cerca "★ NUOVO — arrow mobile").            ║
   ║                                                                    ║
   ║  CLASSI DA USARE NELL'HTML                                         ║
   ║  ──────────────────────────────────────────────────────────────  ║
   ║   .catnav              → contenitore sticky della barra            ║
   ║   .catnav__inner       → wrapper interno (riferimento frecce)      ║
   ║   .catnav__scroll      → riga scorrevole che contiene i link       ║
   ║   .catnav__link        → singola voce/categoria (<a href="#id">)   ║
   ║   .catnav__arrow       → pulsante freccia (--prev / --next)        ║
   ║   .catnav__arrow--prev → freccia sinistra                          ║
   ║   .catnav__arrow--next → freccia destra                           ║
   ║   .catnav__arrow-ico   → cerchio interno della freccia (chip)      ║
   ║                                                                    ║
   ║  CLASSI/VARIABILI DI STATO (gestite dal JS — non scriverle a mano) ║
   ║  ──────────────────────────────────────────────────────────────  ║
   ║   .catnav.can-prev     → c'è altro a sinistra → mostra freccia ←   ║
   ║   .catnav.can-next     → c'è altro a destra  → mostra freccia →    ║
   ║   .catnav__scroll.is-fit         → entrano tutte → barra centrata  ║
   ║   .catnav__link.is-active        → categoria attiva (scroll-spy)   ║
   ║   --fade-l / --fade-r  → ampiezza sfumature ai bordi (px)          ║
   ╚══════════════════════════════════════════════════════════════════╝ */

/* --- catnav: variabili di animazione delle sfumature (registrate per il transition) --- */
@property --fade-l { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --fade-r { syntax: "<length>"; inherits: false; initial-value: 0px; }

/* --- catnav: contenitore sticky --- */
.catnav {
  --catnav-bg: rgb(245, 233, 210);
  position: sticky;
  top: 69px; /* JS syncs this exactly to the main nav height */
  z-index: 80;
  background: rgba(245, 233, 210, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.catnav__inner {
  position: relative;
  padding: 0 var(--pad-x);
}
.catnav__scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* old Edge/IE */
  -webkit-overflow-scrolling: touch;
  /* Soft fade edges dissolve categories at the boundary instead of a scrollbar.
     --fade-l / --fade-r are driven by JS: 0 when that side is fully revealed. */
  --fade-l: 0px;
  --fade-r: 0px;
  -webkit-mask-image: linear-gradient(to right,
    transparent 0, #000 var(--fade-l),
    #000 calc(100% - var(--fade-r)), transparent 100%);
          mask-image: linear-gradient(to right,
    transparent 0, #000 var(--fade-l),
    #000 calc(100% - var(--fade-r)), transparent 100%);
  transition: --fade-l .2s linear, --fade-r .2s linear;
}
.catnav__scroll::-webkit-scrollbar { width: 0; height: 0; display: none; } /* Chrome/Safari */
/* When every category fits, center the row — no scroll, no arrows. */
.catnav__scroll.is-fit { justify-content: center; }

/* ---- Paged navigation controls: appear on the side with hidden categories ---- */
.catnav__arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(var(--pad-x) + 64px);
  display: flex;
  align-items: center;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.catnav__arrow-ico {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: 0 3px 12px rgba(31, 24, 16, 0.14);
  color: var(--terra);
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.catnav__arrow-ico svg { width: 18px; height: 18px; }
.catnav__arrow:hover .catnav__arrow-ico {
  background: var(--terra);
  border-color: var(--terra);
  color: #fff;
}
.catnav__arrow:active .catnav__arrow-ico { transform: scale(0.92); }
.catnav__arrow--prev {
  left: 0;
  justify-content: flex-start;
  padding-left: var(--pad-x);
  /* Solid cream backing so scrolling text fully clears the button. */
  background: linear-gradient(to right,
    var(--bg) 0, var(--bg) 62%, rgba(245, 233, 210, 0) 100%);
}
.catnav__arrow--next {
  right: 0;
  justify-content: flex-end;
  padding-right: var(--pad-x);
  background: linear-gradient(to left,
    var(--bg) 0, var(--bg) 62%, rgba(245, 233, 210, 0) 100%);
}
.catnav.can-prev .catnav__arrow--prev,
.catnav.can-next .catnav__arrow--next {
  opacity: 1;
  pointer-events: auto;
}
.catnav__link {
  display: inline-flex;
  align-items: center;
  padding: 18px 16px;
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mut);
  white-space: nowrap;
  position: relative;
  transition: color .25s;
}
.catnav__link:hover { color: var(--text); }
.catnav__link.is-active {
  color: var(--terra);
}
.catnav__link.is-active::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px;
  bottom: 0;
  height: 2px;
  background: var(--terra);
}
/* ───────── fine ★ NUOVO — sistema di navigazione del menù ───────── */

/* ============================================================
   MAIN
   ============================================================ */
.menu-page__main {
  padding: clamp(40px, 7vh, 80px) 0 clamp(60px, 10vh, 100px);
}

/* ============================================================
   CATEGORY
   ============================================================ */
.m-cat {
  padding: clamp(40px, 6vh, 72px) 0;
  border-bottom: 1px solid var(--line-soft);
  scroll-margin-top: 128px; /* nav (~65) + catnav (~58) + buffer */
}
.m-cat:last-of-type { border-bottom: 0; }
.m-cat__head {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: stretch;
  gap: 32px clamp(32px, 5vw, 64px);
  margin-bottom: 40px;
}

/* Se l'header contiene SOLO il testo e l'immagine è stata rimossa, allarga la griglia */
.m-cat__head:not(:has(.m-cat__head-image)) {
  grid-template-columns: 1fr;
}
.m-cat__head:not(:has(.m-cat__head-image)) .m-cat__head-text {
  grid-column: 1 / -1;
  display: block;
}

.m-cat__head-text {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 16px 28px;
  align-content: start;
}
.m-cat__head-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
}
.m-cat__head-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.m-cat__head-image image-slot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.m-cat__head-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 70%, rgba(31, 24, 16, 0.18));
  pointer-events: none;
  border-radius: 6px;
}

/* Arched echo on alternate categories (trulli reference) 
.m-cat:nth-of-type(odd) .m-cat__head-image {
  border-radius: 50% 50% 6px 6px / 30% 30% 6px 6px;
}
.m-cat:nth-of-type(odd) .m-cat__head-image::after {
  border-radius: 50% 50% 6px 6px / 30% 30% 6px 6px;
}
.m-cat:nth-of-type(odd) .m-cat__head-image image-slot {
  border-radius: inherit;
}*/
.m-cat__num {
  font-family: var(--f-display);
  font-size: 16px;
  color: var(--terra);
  letter-spacing: 0.3em;
  align-self: start;
  padding-top: 14px;
  border-top: 1px solid var(--terra);
  min-width: 56px;
}
.m-cat__title {
  font-family: var(--f-display);
  font-size: clamp(40px, 6vw, 80px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--text);
  grid-column: 2;
}

/* ---- MODIFICA SPECIFICA PER LE BIRRE (SENZA IMMAGINE) ---- */
/* Forza la larghezza del titolo al 100% e impedisce di andare a capo SOLO se manca la foto */
.m-cat__head:not(:has(.m-cat__head-image)) .m-cat__title {
  grid-column: 1 / -1;
  width: 100%;
  white-space: nowrap;      /* Impedisce al testo di andare a capo */
  overflow: hidden;         /* Taglia il testo se supera lo spazio dello schermo */
  text-overflow: ellipsis;  /* Mette i tre puntini se è troppo lungo */
}

.m-cat__intro {
  grid-column: 2;
  font-family: var(--f-head);
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.5;
  color: var(--text-dim);
  max-width: 62ch;
  margin: 0;
}

/* Se manca la foto, la descrizione riparte dalla prima colonna a tutta larghezza */
.m-cat__head:not(:has(.m-cat__head-image)) .m-cat__intro {
  grid-column: 2;
}

/* Dish grid */
.m-cat__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--line-soft);
}
.m-dish {
  padding: 28px clamp(0px, 3vw, 32px) 28px 0;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.m-dish:nth-child(2n) {
  padding-left: clamp(0px, 3vw, 32px);
  padding-right: 0;
  border-left: 1px solid var(--line-soft);
}
.m-dish__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 8px;
  position: relative;
}
.m-dish__name {
  font-family: var(--f-head);
  font-size: clamp(18px, 1.8vw, 22px);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
  margin: 0;
}
.m-dish__price {
  font-family: var(--f-display);
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--sand);
  white-space: nowrap;
  font-weight: 500;
}
.m-dish__desc {
  font-size: 14px;
  color: var(--text-mut);
  line-height: 1.55;
  margin: 0;
  max-width: 50ch;
}
.m-dish__tags {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.m-dish__tag {
  font-family: var(--f-body);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-mut);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
}
.m-dish__tag.is-signature {
  background: var(--terra);
  color: #fff;
  border-color: var(--terra);
}

/* ============================================================
   FOOT NOTE + CTA
   ============================================================ */
.m-foot {
  padding: clamp(40px, 7vh, 72px) 0 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
  text-align: center;
}
.m-foot__note {
  max-width: 64ch;
  font-size: 13px;
  font-style: italic;
  color: var(--text-mut);
  line-height: 1.6;
}
.m-foot__ctas {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.m-foot__ctas .btn--ghost {
  color: var(--text);
  border-color: var(--line);
}
.m-foot__ctas .btn--ghost:hover {
  color: var(--terra);
  border-color: var(--terra);
}

/* ============================================================
   FOOTER MINIMAL
   ============================================================ */
.m-page-foot {
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  padding: 32px 0;
}
.m-page-foot__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.m-page-foot__brand {
  font-family: var(--f-display);
  font-size: 22px;
  color: var(--sand);
}
.m-page-foot__tag {
  font-size: 12px;
  color: var(--text-mut);
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.m-page-foot__copy {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mut);
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 760px) {
  .topbar__inner { grid-template-columns: auto 1fr auto; gap: 12px; }
  .topbar__back span { display: none; } /* icon-only on mobile */
  .topbar__back { padding: 8px; border: 1px solid var(--line); border-radius: 999px; width: 36px; height: 36px; justify-content: center; }
  .topbar__logo { font-size: 16px; }
  .topbar__logo svg { width: 20px; height: 20px; }

  .menu-hero { padding-top: 32px; }
  .menu-hero h1 { font-size: clamp(40px, 11vw, 64px); }

  .catnav { top: 60px; }
  .catnav__link { padding: 14px 12px; font-size: 11px; letter-spacing: 0.16em; }
  
  /* ★ NUOVO — arrow mobile: chip più grandi e backing opaco più ampio,
     così le voci che scorrono sotto non si sovrappongono ai pulsanti. */
  .catnav__arrow { width: 70px; }
  .catnav__arrow-ico {
    width: 40px;
    height: 40px;
    box-shadow: 0 4px 16px rgba(31, 24, 16, 0.20);
  }
  .catnav__arrow--prev {
    background: linear-gradient(to right,
      var(--bg) 0, var(--bg) 70%, rgba(245, 233, 210, 0) 100%);
  }
  .catnav__arrow--next {
    background: linear-gradient(to left,
      var(--bg) 0, var(--bg) 70%, rgba(245, 233, 210, 0) 100%);
  }

  .m-cat { scroll-margin-top: 124px; }

  .m-cat__head {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .m-cat__head-text { grid-template-columns: 1fr; }
  .m-cat__num { grid-column: 1; }
  .m-cat__title { grid-column: 1; }
  .m-cat__intro { grid-column: 1; }
  .m-cat__head-image {
    aspect-ratio: 16 / 9;
    order: -1; /* image above text on mobile */
  }
  
  /* Mantieni l'azzeramento dell'arco anche nel blocco mobile per coerenza */
  .m-cat:nth-of-type(odd) .m-cat__head-image,
  .m-cat:nth-of-type(odd) .m-cat__head-image::after {
    border-radius: 6px;
  }

  /* Anche su mobile, se non c'è l'immagine, applichiamo il nowrap specifico */
  .m-cat__head:not(:has(.m-cat__head-image)) .m-cat__title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-cat__grid { grid-template-columns: 1fr; }
  .m-dish, .m-dish:nth-child(2n) {
    padding: 22px 0;
    border-left: 0;
  }
  .m-dish__top { gap: 12px; }

  .m-page-foot__inner { flex-direction: column; align-items: flex-start; text-align: left; }
}