:root {
  --desk: #222926;
  --paper: #F7F6F1;
  --paper-inset: #EFECE4;
  --ink: #18221F;
  --ink-muted: #525E5A;
  --wine: #6E1E2A;
  --wine-soft: rgba(110, 30, 42, 0.16);
  --rule: #D6D1C4;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: rgba(110, 30, 42, 0.08);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100dvh;
  overflow-x: hidden;
}

@media (min-width: 680px) {
  body {
    background-color: var(--desk);
    padding: 36px 20px 60px;
  }
}

.hidden {
  display: none !important;
}

/* ============================================================================
   SCHERMATA DI ACCESSO RISERVATO (SOLO QR AL TAVOLO)
   ============================================================================ */
.gate-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background-color: var(--desk);
}

.gate-sheet {
  max-width: 440px;
  width: 100%;
  background-color: var(--paper);
  color: var(--ink);
  padding: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.gate-sheet-inner {
  border: 1.5px solid var(--wine);
  padding: 36px 22px;
  text-align: center;
  position: relative;
}

.gate-sheet-inner::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 0.5px solid var(--wine-soft);
  pointer-events: none;
}

.gate-SmallNote {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--wine);
  margin-bottom: 8px;
}

.gate-sheet h1 {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(2rem, 7vw, 2.35rem);
  font-weight: 500;
  line-height: 1.12;
  color: var(--ink);
  margin-bottom: 18px;
  text-wrap: balance;
}

.gate-rule {
  width: 48px;
  height: 1px;
  background-color: var(--wine);
  margin: 0 auto 20px;
}

.gate-sheet p {
  font-size: 0.94rem;
  color: var(--ink-muted);
  max-width: 34ch;
  margin: 0 auto 16px;
  text-wrap: pretty;
}

.gate-footnote {
  font-size: 0.8rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  margin-top: 24px;
}

.local-preview-btn {
  margin-top: 20px;
  background-color: var(--wine);
  color: var(--paper);
  border: none;
  padding: 12px 18px;
  min-height: 44px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
}

/* ============================================================================
   FOGLIO DEL MENÙ ("CARTA DELLE VIVANDE") - OTTIMIZZATO PER TELEFONO
   ============================================================================ */
.menu-sheet {
  max-width: 660px;
  margin: 0 auto;
  background-color: var(--paper);
  padding: max(8px, env(safe-area-inset-top)) 8px max(16px, env(safe-area-inset-bottom));
}

@media (min-width: 680px) {
  .menu-sheet {
    padding: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }
}

.menu-frame {
  border: 1.5px solid var(--wine);
  padding: 3px;
}

.menu-frame-inner {
  border: 0.5px solid var(--wine-soft);
  padding: 24px 16px 32px;
}

@media (min-width: 480px) {
  .menu-frame-inner {
    padding: 36px 28px 42px;
  }
}

@media (min-width: 600px) {
  .menu-frame-inner {
    padding: 48px 44px 52px;
  }
}

/* INTESTAZIONE DELLA CARTA */
.menu-header {
  text-align: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--wine);
}

.menu-edition-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.96rem;
  color: var(--wine);
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.menu-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(2.05rem, 7.5vw, 3.1rem);
  font-weight: 500;
  line-height: 1.08;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  text-wrap: balance;
}

.menu-subtitle {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(1.04rem, 3.8vw, 1.18rem);
  line-height: 1.38;
  color: var(--ink-muted);
  max-width: 42ch;
  margin: 0 auto 16px;
  text-wrap: balance;
}

.menu-currency-banner {
  display: inline-block;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--wine);
  background-color: var(--paper-inset);
  padding: 7px 12px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-wrap: balance;
}

/* INDICE DELLE PORTATE (STICKY, TOUCH-FRIENDLY SU TELEFONO) */
.course-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: rgba(247, 246, 241, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
  margin: 0 -16px 26px;
  padding: 4px 16px;
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 480px) {
  .course-nav {
    margin: 0 0 32px;
    padding: 4px 0;
  }
}

.course-nav::-webkit-scrollbar {
  display: none;
}

.course-link {
  flex: 0 0 auto;
  background: none;
  border: none;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.1rem;
  color: var(--ink-muted);
  cursor: pointer;
  min-height: 44px;
  padding: 8px 2px;
  border-bottom: 2px solid transparent;
  touch-action: manipulation;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.course-link:hover,
.course-link.active {
  color: var(--wine);
  border-bottom-color: var(--wine);
  font-weight: 500;
}

.course-link:focus-visible {
  outline: 1.5px solid var(--wine);
  outline-offset: 2px;
}

/* SEZIONI DELLE PORTATE */
.course-section {
  margin-bottom: 36px;
  scroll-margin-top: 64px;
}

.course-heading {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(1.48rem, 5vw, 1.68rem);
  font-weight: 500;
  font-style: italic;
  color: var(--wine);
  margin-bottom: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  text-wrap: balance;
}

.course-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* SINGOLA VOCE DEL MENÙ (OTTIMIZZATA PER SCHERMI STRETTI E TOUCH) */
.dish-row {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: 4px;
  touch-action: manipulation;
  transition: background-color 0.15s ease;
}

.dish-row:active,
.dish-row[aria-expanded="true"] {
  background-color: rgba(239, 236, 228, 0.65);
}

.dish-row:focus-visible {
  outline: 1.5px solid var(--wine);
  outline-offset: 2px;
}

.dish-header-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: baseline;
  margin-bottom: 4px;
}

@media (min-width: 540px) {
  .dish-header-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }
}

.dish-name-wrap {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(1.18rem, 4.4vw, 1.28rem);
  font-weight: 500;
  line-height: 1.24;
  color: var(--ink);
  min-width: 0;
  text-wrap: pretty;
}

.dish-sup {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.66rem;
  color: var(--wine);
  vertical-align: super;
  margin-left: 3px;
  font-weight: 600;
}

.dish-tag {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.94rem;
  color: var(--wine);
  margin-left: 6px;
  white-space: nowrap;
}

.dish-leader {
  display: none;
}

@media (min-width: 540px) {
  .dish-leader {
    display: block;
    flex: 1 1 20px;
    border-bottom: 1px dotted var(--rule);
    margin: 0 6px;
    position: relative;
    top: -4px;
  }
}

.dish-price {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(1.1rem, 4vw, 1.18rem);
  font-weight: 600;
  color: var(--wine);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.dish-description {
  font-size: 0.89rem;
  color: var(--ink-muted);
  max-width: 60ch;
  line-height: 1.48;
  text-wrap: pretty;
}

/* NOTA ESPANDIBILE DELLA CUCINA (AL TOCCO DEL PIATTO) */
.dish-note-drawer {
  margin-top: 8px;
  padding: 10px 12px;
  background-color: var(--paper-inset);
  border-left: 2px solid var(--wine);
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--ink);
  text-wrap: pretty;
}

.dish-note-drawer p + p {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

/* NOTA COPERTO E LEGENDA RICHIAMI A PIÈ DI PAGINA */
.menu-colophon {
  margin-top: 38px;
  padding-top: 22px;
  border-top: 1px solid var(--wine);
}

.cover-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.12rem;
  color: var(--ink);
  margin-bottom: 8px;
}

.tap-hint {
  font-style: italic;
  font-size: 0.96rem;
  color: var(--wine);
}

.service-warning {
  font-size: 0.84rem;
  color: var(--ink-muted);
  margin-bottom: 22px;
  text-wrap: pretty;
}

.allergen-section-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--wine);
  margin-bottom: 10px;
}

.allergen-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

@media (min-width: 520px) {
  .allergen-list {
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
  }
}

.allergen-code {
  color: var(--wine);
  font-weight: 600;
  margin-right: 4px;
}

.menu-footer-sign {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.94rem;
  color: var(--ink-muted);
  text-wrap: balance;
}
