/* =====================================================================
   MENU DIGITALE SFOGLIABILE — grafica comune (DiemmeLab)
   Colori e font del singolo ristorante: tema.css
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; --scala: 1; }
body {
  background: var(--tavolo);
  color: var(--inchiostro);
  font-family: var(--font-testo);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
img { -webkit-user-drag: none; user-select: none; }
.nascosto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Struttura schermo ---------- */
#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 70% at 50% 35%, var(--tavolo-2) 0%, var(--tavolo) 70%);
}
.scena {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
}

/* ---------- Libro ---------- */
.libro-cornice {
  position: relative;
  width: var(--W, 340px); height: var(--H, 560px);
  animation: apri .5s ease-out both;
}
@keyframes apri { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.libro {
  position: relative; width: 100%; height: 100%;
  touch-action: pinch-zoom;
  user-select: none; -webkit-user-select: none;
  cursor: grab;
  border-radius: 2px 4px 4px 2px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
}
.sotto {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: inherit;
  background: var(--carta);
}
.taglio {  /* taglia tutto ciò che supera la costola (lato sinistro) */
  position: absolute; left: 0; top: calc(var(--H) * -1);
  width: calc(var(--W) * 3); height: calc(var(--H) * 3);
  overflow: hidden; pointer-events: none;
}
.clip { position: absolute; left: 0; top: 0; overflow: hidden; transform-origin: 0 0; pointer-events: none; }
.interno { position: absolute; left: 0; top: 0; width: var(--W); height: var(--H); transform-origin: 0 0; pointer-events: auto; }
.lembo {
  position: absolute; left: 0; top: 0; width: var(--W); height: var(--H);
  transform-origin: 0 0; overflow: hidden;
  background: linear-gradient(to right, var(--carta-retro), #F4ECDB 60%, var(--carta-retro));
  box-shadow: 0 0 24px rgba(25, 16, 6, .30);
}
.lembo-luce, .ombra-sotto { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.lembo-luce {
  width: 90px;
  background: linear-gradient(to right, rgba(70, 45, 20, .30) 0, rgba(255, 252, 244, .55) 18%, rgba(255, 252, 244, 0) 100%);
}
.ombra-sotto {
  width: 110px;
  background: linear-gradient(to right, rgba(22, 14, 6, .45) 0, rgba(22, 14, 6, .14) 30%, rgba(22, 14, 6, 0) 100%);
}
.clip-lembo, .ombra-sotto { visibility: hidden; }
.in-volo .clip-lembo, .in-volo .ombra-sotto { visibility: visible; }
.in-volo .clip, .in-volo .interno, .in-volo .lembo, .in-volo .ombra-sotto { will-change: transform; }

/* ---------- Pagina ---------- */
.pagina {
  position: absolute; left: 0; top: 0;
  width: var(--W); height: var(--H);
  display: flex; flex-direction: column;
  padding: 14px 20px 8px 24px;
  font-size: calc(16px * var(--scala));
  background:
    radial-gradient(140% 90% at 60% 40%, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 60%),
    var(--carta);
  color: var(--inchiostro);
  overflow: hidden;
}
.pagina::before {  /* ombra della rilegatura */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 22px; pointer-events: none;
  background: linear-gradient(to right, rgba(90, 60, 25, .16), rgba(90, 60, 25, 0));
}
.testata {
  font-weight: 700; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--bronzo); text-align: center; line-height: 1;
  padding: 12px 44px 0;
}
.titolo-sez {
  font-family: var(--font-titoli); font-weight: 400;
  font-size: 2.05em; line-height: 1.05;
  color: var(--bronzo); text-align: center;
  margin: .32em 0 0;
}
.titolo-sez::after {
  content: ""; display: block; width: 64px; height: 1px; margin: .3em auto 0;
  background: var(--bronzo); opacity: .7;
}
.titolo-sez.cont { font-size: 1.45em; }
.compatto .titolo-sez { font-size: 1.7em; margin-top: .2em; }
.compatto .titolo-sez.cont { font-size: 1.25em; }
.contenuto { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: .35em; overflow: hidden; }
.piede {
  flex: none; text-align: center; padding: .45em 44px 2px;
  font-weight: 700; font-size: 11px; letter-spacing: .06em; color: var(--bronzo); line-height: 1.5;
}
.piede .num { margin-right: .5em; }

.gruppo {
  font-weight: 700; font-size: 1.06em; line-height: 1.2; letter-spacing: .02em;
  color: var(--bronzo); margin: .75em 0 .55em;
  padding-bottom: .25em; border-bottom: 1px solid rgba(142, 96, 58, .45);
}
.contenuto > .gruppo:first-child { margin-top: .35em; }
.gruppo .sub { display: block; font-weight: 400; font-size: .8em; letter-spacing: 0; margin-top: .2em; }
.gruppo.ripetuto { opacity: .85; }

.voce { margin: 0 0 .78em; }
.voce .riga { display: flex; align-items: baseline; gap: .7em; }
.voce .nome { flex: 1; font-weight: 700; font-size: 1em; line-height: 1.22; }
.voce .prezzo { font-weight: 700; white-space: nowrap; font-size: 1em; }
.voce .desc { margin: .18em 0 0; font-size: .9em; line-height: 1.32; color: var(--inchiostro-2); }
.voce .extra { margin: .2em 0 0; font-size: .78em; color: var(--bronzo); }
.consigliato { color: var(--bronzo); font-size: .8em; vertical-align: .1em; }
/* spaziatura più stretta, usata solo se fa risparmiare una pagina */
.stretto .voce { margin-bottom: .5em; }
.stretto .voce .nome { line-height: 1.16; }
.stretto .voce .desc { line-height: 1.24; margin-top: .1em; }
.stretto .gruppo { margin: .55em 0 .4em; }
.stretto .contenuto > .gruppo:first-child { margin-top: .2em; }

.nota-allergeni {
  margin-top: auto; padding-top: .55em; border-top: 1px solid rgba(142, 96, 58, .45);
  font-size: .8em; line-height: 1.35; color: var(--inchiostro-2);
}
.nota-allergeni b { display: block; color: var(--bronzo); font-size: .95em; margin-bottom: .15em; }

/* Copertina e retro */
.pagina-copertina, .pagina-retro { padding: 12px; }
.cop-cornice {
  position: relative; flex: 1; min-height: 0;
  border: 1px solid rgba(142, 96, 58, .75);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  text-align: center; padding: 6% 6% 5%;
}
.cop-sotto { margin: 0; font-weight: 700; font-size: 13px; letter-spacing: .14em; color: var(--bronzo); text-transform: uppercase; }
.cop-logo { display: block; width: min(74%, calc(var(--H) * .36)); height: auto; margin: 0 auto; }
.cop-titolo {
  margin: 0; font-family: var(--font-titoli); font-weight: 700; color: var(--bronzo);
  font-size: min(15vw, 56px, calc(var(--H) * .085)); line-height: 1.05;
}
.cop-titolo.saluto { font-size: min(11vw, 44px, calc(var(--H) * .07)); }
.cop-indirizzo { margin: 0; font-weight: 700; font-size: 14px; }
.cop-contatti { display: flex; justify-content: space-around; width: 100%; gap: 8px; }
.cop-contatti a { text-decoration: none; display: flex; flex-direction: column; align-items: center; padding: 6px 4px; border-radius: 6px; min-width: 44px; }
.cop-contatti a:active { background: rgba(142, 96, 58, .12); }
.cop-contatti small { font-size: 13px; }
.cop-contatti b { font-size: 12px; margin-top: 2px; }
.btn-sfoglia {
  display: inline-flex; align-items: center; gap: .5em;
  font-weight: 700; font-size: 14px; letter-spacing: .06em;
  color: var(--carta); background: var(--inchiostro);
  padding: 12px 22px; border-radius: 999px; min-height: 44px;
}
.btn-sfoglia svg { width: 18px; height: 18px; }
.cop-nota { margin: 0; font-size: 11px; line-height: 1.35; color: var(--inchiostro-2); max-width: 30em; }
.pagina-retro .cop-logo { width: min(64%, calc(var(--H) * .28)); }

/* Firma DiemmeLab */
.colofone {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 0 1px; text-decoration: none;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--inchiostro-2);
}
.colofone img { display: block; width: 116px; height: auto; }
.colofone:active { opacity: .7; }
.firma-cop {
  flex: none; align-self: center; display: block; text-align: center; text-decoration: none;
  padding: 7px 14px 1px; min-height: 26px;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--inchiostro-2);
}
.firma-cop b { color: var(--bronzo); }
.firma-cop:active { opacity: .7; }
.compatto .cop-contatti small { font-size: 11px; }
.compatto .cop-sotto { font-size: 11px; }

/* ---------- Pulsanti sopra il libro ---------- */
.btn-tondo, .freccia {
  position: absolute; z-index: 5;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--bronzo);
  transition: opacity .25s, visibility .25s;
}
.btn-tondo svg, .freccia svg { width: 22px; height: 22px; }
.btn-testo { top: 0; right: 0; font-weight: 700; font-size: 15px; letter-spacing: -.02em; }
.btn-testo small { font-size: 11px; }
.freccia { bottom: -4px; }
.freccia.prec { left: 0; }
.freccia.succ { right: 0; }
.btn-tondo:active, .freccia:active { background: rgba(142, 96, 58, .14); }
.spento { opacity: 0; visibility: hidden; pointer-events: none; }
.btn-tondo:focus-visible, .freccia:focus-visible, .tasto:focus-visible, .btn-sfoglia:focus-visible, .cop-contatti a:focus-visible {
  outline: 2px solid var(--bronzo-chiaro); outline-offset: 2px;
}

/* ---------- Barra dei tasti veloci ---------- */
.barra {
  flex: none; position: relative; z-index: 10;
  display: flex; justify-content: center;
  background: var(--tavolo);
  border-top: 1px solid rgba(217, 173, 127, .25);
  padding-bottom: env(safe-area-inset-bottom);
}
.tasto {
  position: relative; flex: 1 1 0; max-width: 110px; min-width: 0;
  height: 60px; padding: 7px 2px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: rgba(248, 241, 226, .78);
  font-weight: 700; font-size: clamp(9.5px, 2.85vw, 12.5px); letter-spacing: 0; line-height: 1;
  transition: color .2s;
}
.tasto svg { width: 24px; height: 24px; flex: none; }
.tasto span { white-space: nowrap; }
.tasto::before {
  content: ""; position: absolute; top: -1px; left: 50%; width: 28px; height: 2px; margin-left: -14px;
  background: var(--bronzo-chiaro); border-radius: 2px; transform: scaleX(0); transition: transform .25s;
}
.tasto.attivo { color: var(--bronzo-chiaro); }
.tasto.attivo::before { transform: scaleX(1); }
.tasto:active { background: rgba(255, 255, 255, .05); }

.avviso {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--inchiostro); color: var(--carta);
  font-weight: 700; font-size: 13px; padding: 9px 16px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  transition: opacity .2s, transform .2s;
}
.avviso.vis { opacity: 1; transform: translate(-50%, 0); }

/* Contenitore invisibile per misurare le pagine */
.misura { position: absolute; left: -10000px; top: 0; width: var(--W); height: var(--H); visibility: hidden; pointer-events: none; }

/* Dissolvenza per chi preferisce meno animazioni */
.dissolvi .interno { transition: opacity .2s ease; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .libro-cornice { animation: none; }
  .tasto::before, .avviso { transition: none; }
}
