/* ==========================================================================
   Megapizza — stile del menu digitale
   (i prezzi e i prodotti NON sono qui: stanno in menu.js)
   ========================================================================== */

:root {
  --paper: #faf7f2;
  --paper-2: #f1ebe1;
  --white: #fffdf9;
  --ink: #1c1a17;
  --ink-2: #5f5850;
  --ink-3: #8c847a;
  --rule: #e7e0d5;
  --rule-2: #d5ccbe;

  --red: #dc1c24;          /* titoli, come sul volantino */
  --red-logo: #ed1c24;     /* rosso del logo, su fondo scuro */
  --red-dark: #b8141b;
  --red-tint: #fcebe6;
  --green-light: #00a443;  /* "da asporto" su fondo scuro */
  --wa: #007a33;           /* pulsanti WhatsApp (verde scuro: testo bianco leggibile) */
  --wa-hover: #00692c;
  --char: #1e1e1e;         /* lavagna del volantino */
  --cream: #f6f1e8;
  --cream-2: #bfb8ac;
  --gold: #f6b400;
  --focus: #2f6fde;

  --display: "Oswald", "Arial Narrow", "Roboto Condensed", sans-serif;
  --text: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;

  --wrap: 680px;
  --gutter: 16px;
  --bar-space: 72px;

  --torn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 18' preserveAspectRatio='none'%3E%3Cpath fill='%231e1e1e' d='M0 18L0 9.6L3.8 11.7L7.2 11.4L12.2 9.1L18 9L23.4 9.1L26.9 10.8L34.5 8.9L38.7 11.4L46.9 10.9L52.1 13L55.3 12.5L59.9 9L63.6 10L71.1 9.9L77.3 12.7L82.3 12.5L85.7 10.1L89.8 13.5L95.1 11.5L101.4 11.9L106 13.2L112.9 9.3L119 9.7L126.8 9.3L131.4 9.8L135.1 6.3L142.2 3.9L147.9 2.9L154.6 6.4L160.7 7.1L165.5 6.4L171.7 6.2L177.2 8.1L185.4 6.9L192.1 5.2L199 8.5L207.4 9.4L212 7.1L218.7 5L224.2 5.6L227.8 4.9L235.1 5.3L239.4 6.9L247.2 5.9L252.7 8.9L260.6 11.5L268.3 10L273.6 11.3L281.5 15L285.3 11.7L289.6 12.3L295.2 14.2L299.7 11L305 12.6L311.1 14.9L317.9 11.8L324.3 11.7L327.6 12.4L334.9 11.4L342.3 8.3L347.5 6.6L353.9 6.2L357.3 7L361.2 7.8L364.5 6.1L368.3 6.7L373.3 6.3L381.1 9.3L385 7.3L389.9 7.6L393.5 9.9L402 7L407.7 4.3L411.2 5.2L415.7 7.2L419.6 2.6L427.8 4.6L431.6 4.6L434.8 4.6L443.1 6.8L450 4.5L455 4.8L462.2 8L469.5 8.2L473.7 11.3L480 9.6L480 18Z'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 66px;
}
html.is-locked { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bar-space) + env(safe-area-inset-bottom));
}

h1, h2, h3, p, ul, ol { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
.ic { display: block; width: 1em; height: 1em; flex: none; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 8px; top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--char);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 8px; }

/* ---------- testata ---------- */
.hero { text-align: center; }

.hero-logo { padding: 22px var(--gutter) 28px; }
.hero-logo img { width: min(60vw, 280px); height: auto; margin: 0 auto; }

.band,
.footer {
  position: relative;
  background-color: var(--char);
  background-image: var(--grain);
  color: var(--cream);
}

/* bordi a carta strappata */
.band::before,
.band::after,
.footer::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 16px;
  background-image: var(--torn);
  background-size: 480px 16px;
  background-repeat: repeat-x;
  pointer-events: none;
}
.band::before { bottom: calc(100% - 1px); }
.band::after { top: calc(100% - 1px); transform: scaleY(-1); background-position: 173px 0; }
.footer::before { bottom: calc(100% - 1px); background-position: 311px 0; }

.band { padding: 18px var(--gutter) 18px; }

.tagline {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(25px, 7.6vw, 36px);
  line-height: 1.12;
  letter-spacing: .07em;
}
.t-red { color: var(--red-logo); text-transform: uppercase; }
.t-green { color: var(--green-light); }
.t-white { color: #fff; }
.tagline .t-white { display: block; }

.band-address { margin-top: 10px; font-size: 16px; color: var(--cream-2); }
.band-address a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  text-decoration: none;
}
.band-address a > span {
  text-decoration: underline;
  text-decoration-color: rgba(246, 241, 232, .35);
  text-underline-offset: 3px;
}
.band-address a:hover > span { text-decoration-color: currentColor; }
.band-address .ic { width: 16px; height: 16px; color: var(--red-logo); }

/* ---------- navigazione categorie ---------- */
.cats {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-top: 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.cats-list {
  position: relative;
  display: flex;
  gap: 4px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px var(--gutter);
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent);
}
.cats-list::-webkit-scrollbar { display: none; }
.cats-list li { flex: none; }
.cats-list li:first-child { margin-left: auto; }
.cats-list li:last-child { margin-right: auto; }
.cats-list a {
  display: block;
  padding: 9px 14px 8px;
  border-radius: 999px;
  font: 500 15px/1 var(--display);
  letter-spacing: .07em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink-2);
  transition: background-color .2s, color .2s;
}
.cats-list a:hover { color: var(--ink); background: var(--paper-2); }
.cats-list a[aria-current="true"] { background: var(--char); color: #fff; }

/* ---------- menu ---------- */
main {
  display: block;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 4px var(--gutter) 8px;
  outline: none;
}

.hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.3;
}
.hint strong { color: var(--red); }
.hint-ic {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px; height: 28px;
  border: 1.5px solid var(--rule-2);
  border-radius: 50%;
  background: #fff;
  color: var(--red);
}
.hint-ic .ic { width: 14px; height: 14px; }

.cat { padding-top: 34px; }
.cat-title {
  margin-bottom: 8px;
  font: 700 30px/1.05 var(--display);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--red);
}

.items { list-style: none; padding: 0; }
.items > li + li { margin-top: 2px; }

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name price" "desc desc";
  column-gap: 14px;
  align-items: start;
  margin: 0 -12px;
  padding: 11px 12px;
  border-radius: 12px;
  transition: background-color .25s ease;
}
.item.has-qty {
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "name price qty" "desc desc qty";
}
.item.is-in { background: var(--red-tint); }

.item-name { grid-area: name; font: 600 19.5px/1.2 var(--text); letter-spacing: .005em; }
.item-desc { grid-area: desc; margin-top: 3px; font-size: 16px; line-height: 1.35; color: var(--ink-2); }
.item-price {
  grid-area: price;
  padding-top: 1px;
  font: 600 19px/1.2 var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.item .qty { grid-area: qty; }
.frozen { margin-left: 2px; color: var(--red); font-weight: 600; }
.cat-note { margin-top: 8px; font-size: 15px; color: var(--ink-2); }
.cat-note .frozen { margin: 0 3px 0 0; }

/* pulsanti + / − */
.qty {
  display: flex;
  align-items: center;
  margin: -7px -4px -7px 0;
  border-radius: 999px;
  transition: background-color .2s;
}
.qty-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 1.5px solid var(--rule-2);
  border-radius: 50%;
  background: #fff;
  color: var(--red);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, background-color .2s, border-color .2s, color .2s;
}
.qty-btn::after { content: ""; position: absolute; inset: -5px; }
.qty-btn .ic { width: 18px; height: 18px; }
.qty-btn:hover { border-color: var(--red); }
.qty-btn:active { transform: scale(.88); }
.qty-minus, .qty-n { display: none; }

.is-in .qty { background: var(--red); }
.is-in .qty-btn { background: transparent; border-color: transparent; color: #fff; }
.is-in .qty-minus { display: grid; }
.is-in .qty-n {
  display: block;
  min-width: 20px;
  color: #fff;
  font: 600 18px/1 var(--text);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.menu-error {
  margin-top: 28px;
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--white);
}
.menu-error p + p { margin-top: 6px; }
.nowrap { white-space: nowrap; }

/* ---------- allergeni ---------- */
.allergeni-intro { color: var(--ink-2); font-size: 16px; }
.allergeni-box {
  margin-top: 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--white);
}
.allergeni-box summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font: 600 18px/1.2 var(--text);
  list-style: none;
  cursor: pointer;
  border-radius: 12px;
}
.allergeni-box summary::-webkit-details-marker { display: none; }
.allergeni-box summary .ic { width: 20px; height: 20px; color: var(--ink-3); transition: transform .2s; }
.allergeni-box[open] summary .ic { transform: rotate(180deg); }
.allergeni-list { counter-reset: allergene; list-style: none; padding: 0 16px 6px; }
.allergeni-list li {
  counter-increment: allergene;
  position: relative;
  padding: 10px 0 10px 40px;
  border-top: 1px solid var(--rule);
  font-size: 15.5px;
  line-height: 1.35;
  color: var(--ink-2);
  break-inside: avoid;
}
.allergeni-list li::before {
  content: counter(allergene);
  position: absolute;
  left: 0; top: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink);
  font: 600 14px/28px var(--display);
  text-align: center;
}
.allergeni-list strong { display: block; color: var(--ink); font-size: 17px; font-weight: 600; }

/* ---------- piè di pagina ---------- */
.footer { margin-top: 56px; padding: 40px var(--gutter) 36px; }
.footer-inner { max-width: var(--wrap); margin: 0 auto; }
.footer-logo { width: 150px; height: auto; margin: 0 auto; }
.tagline-sm { margin-top: 14px; font-size: 19px; letter-spacing: .08em; text-align: center; }
.tagline-sm .t-white { display: inline; }

.info-grid { display: grid; gap: 24px; margin-top: 30px; }
.info-block { font-size: 17px; line-height: 1.45; }
.info-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font: 500 14px/1 var(--display);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cream-2);
}
.info-title .ic { width: 16px; height: 16px; color: var(--red-logo); }
.info-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-bottom: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.info-link:hover { border-bottom-color: #fff; }
.info-link .ic { width: 16px; height: 16px; }
.phone {
  font: 600 24px/1.25 var(--display);
  letter-spacing: .04em;
  color: #fff;
  text-decoration: none;
}
.orari-list { list-style: none; padding: 0; }
.footer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.review {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  color: var(--cream);
  text-decoration: none;
  transition: background-color .2s;
}
.review:hover { background: rgba(255, 255, 255, .1); }
.stars { display: flex; flex: none; gap: 2px; color: var(--gold); }
.stars .ic { width: 16px; height: 16px; }
.review-text { flex: 1; line-height: 1.3; }
.review-text strong { display: block; color: #fff; }
.review-arrow { width: 20px; height: 20px; color: var(--cream-2); }

/* ---------- pulsanti ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font: 600 17.5px/1.1 var(--text);
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s, transform .12s;
}
.btn:active { transform: scale(.98); }
.btn .ic { width: 20px; height: 20px; }
.btn-sm { min-height: 42px; padding: 0 14px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-hover); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule-2); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-ghost-dark { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .28); }
.btn-ghost-dark:hover { background: rgba(255, 255, 255, .08); }

/* ---------- barra in basso ---------- */
.bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  background: rgba(250, 247, 242, .97);
  box-shadow: 0 -8px 24px rgba(28, 26, 23, .07);
}
.bar-inner { max-width: 560px; margin: 0 auto; }
.bar-contact { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

.btn-cart { width: 100%; gap: 12px; padding: 0 18px 0 14px; }
.cart-ic { position: relative; display: grid; place-items: center; width: 30px; height: 30px; }
.cart-ic .ic { width: 22px; height: 22px; }
.cart-badge {
  position: absolute;
  top: -5px; right: -8px;
  min-width: 19px; height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fff;
  color: var(--wa);
  font: 700 12px/19px var(--text);
  text-align: center;
}
.cart-label { flex: 1; text-align: left; }
.cart-total { font-variant-numeric: tabular-nums; }

.bar.bump .btn-cart { animation: bump .32s cubic-bezier(.3, .7, .4, 1.4); }
@keyframes bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

/* ---------- riepilogo ordine ---------- */
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .3s cubic-bezier(.2, .8, .2, 1); }
.sheet::backdrop { background: rgba(20, 18, 16, .5); }
@keyframes sheet-up {
  from { transform: translateY(48px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
/* browser vecchi senza <dialog> */
.sheet.no-dialog[open] { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(20, 18, 16, .5); }

.sheet-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 12px 20px;
  border-bottom: 1px solid var(--rule);
}
.sheet-title {
  font: 700 24px/1 var(--display);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--red);
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn .ic { width: 22px; height: 22px; }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 20px 18px;
}

.cart-list { list-style: none; padding: 0; }
.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.cart-row-name { font-size: 18px; font-weight: 600; line-height: 1.2; }
.cart-row-meta { margin-top: 2px; font-size: 15px; color: var(--ink-2); }
.cart-row .qty { margin: 0; }
.cart-empty { padding: 28px 0 8px; color: var(--ink-2); text-align: center; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.field { display: grid; gap: 6px; align-content: start; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: 15px; font-weight: 600; line-height: 1.2; }
.opt { font-weight: 400; color: var(--ink-3); }
.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--rule-2);
  border-radius: 10px;
  background: #fff;
  font-size: 17px;
  line-height: 1.3;
}
.field textarea { min-height: 66px; resize: vertical; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(47, 111, 222, .25); }
.field ::placeholder { color: var(--ink-3); opacity: 1; }

.sheet-foot {
  padding: 14px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  background: var(--white);
}
.sheet-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; font-size: 18px; }
.sheet-total strong { font: 700 26px/1 var(--display); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.fine { margin-top: 10px; font-size: 14px; line-height: 1.35; color: var(--ink-2); text-align: center; }
.text-btn {
  display: block;
  margin: 4px auto 0;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: var(--red-dark);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.noscript { padding: 24px var(--gutter); text-align: center; font-weight: 600; }

/* ---------- schermi stretti ---------- */
@media (max-width: 359px) {
  .fields { grid-template-columns: 1fr; }
  .bar-contact .btn { padding: 0 12px; font-size: 16px; }
}

/* ---------- tablet e computer ---------- */
@media (min-width: 640px) {
  .info-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 28px; }
}
@media (min-width: 700px) {
  :root { --gutter: 24px; }
  .sheet { margin: auto; border-radius: 18px; max-height: 86vh; }
  .sheet-foot { padding-bottom: 16px; }
}
@media (min-width: 960px) {
  main { max-width: 1040px; }
  .hero-logo img { width: 320px; }
  .hint { max-width: 520px; }
  .items, .allergeni-list { columns: 2; column-gap: 56px; }
  .item { break-inside: avoid; }
  .allergeni-intro { max-width: 640px; }
}

/* ---------- meno movimento, se richiesto dal telefono ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- stampa (listino semplice) ---------- */
@media print {
  body { padding: 0; background: #fff; color: #000; }
  .bar, .cats, .hint, .qty, .sheet, .skip, .review, .footer-actions, .footer-logo, .info-link { display: none !important; }
  .band, .footer { background: none; color: #000; }
  .band::before, .band::after, .footer::before { display: none; }
  .t-white, .phone, .info-title { color: #000; }
  .item, .item.is-in { background: none; }
  .items { columns: 2; column-gap: 12mm; }
  .item { break-inside: avoid; padding: 4px 0; margin: 0; }
}
