/* =========================================================
   BANZAI — galleria, lightbox, contatti, footer
   Sezioni opache (z-index:3): coprono il canvas 3D.
   ========================================================= */

/* ======================= GALLERIA ======================= */
.galleria {
  position: relative;
  z-index: 3;
  padding-block: clamp(5rem, 12vh, 9rem) clamp(5rem, 12vh, 8rem);
  background:
    radial-gradient(60% 40% at 10% 0%, rgba(255, 106, 77, .1), transparent 70%),
    var(--ink);
  color: var(--rice);
}
.galleria__head { margin-bottom: clamp(2.5rem, 6vh, 4rem); }
.galleria__noscript { padding: 1.2rem; border: 1px dashed var(--line); border-radius: 1rem; color: var(--rice-70); }

/* filtri per categoria (il comportamento e in js/galleria.js) */
.gallery-filters { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: clamp(1.4rem, 3.5vh, 2.4rem); }
.gallery-filter {
  min-height: 44px;
  padding: .7em 1.4em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 9, 8, .4);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--rice-70);
  transition: background-color .3s, color .3s, border-color .3s;
}
.gallery-filter:hover { border-color: var(--salmon); color: var(--rice); }
.gallery-filter:focus-visible { border-radius: 999px; }
.gallery-filter.is-active, .gallery-filter[aria-pressed="true"] { background: var(--rice); border-color: var(--rice); color: var(--ink); }
html:not(.js) .gallery-filters { display: none; }

/* masonry a colonne CSS con le proporzioni native delle foto (niente ritagli) */
.gallery { columns: 3; column-gap: clamp(.7rem, 1.5vw, 1.2rem); }
.gallery__item {
  position: relative;
  display: block;
  margin: 0 0 clamp(.7rem, 1.5vw, 1.2rem);
  overflow: hidden;
  break-inside: avoid;
  border-radius: 1rem;
  background: var(--ink-2);
  cursor: pointer;
}
/* i segnaposto non hanno immagine: proporzioni a rotazione */
.gallery__item--placeholder:nth-child(6n+1) { aspect-ratio: 4 / 5; }
.gallery__item--placeholder:nth-child(6n+2) { aspect-ratio: 1 / 1; }
.gallery__item--placeholder:nth-child(6n+3) { aspect-ratio: 4 / 3; }
.gallery__item--placeholder:nth-child(6n+4) { aspect-ratio: 3 / 4; }
.gallery__item--placeholder:nth-child(6n+5) { aspect-ratio: 5 / 4; }
.gallery__item--placeholder:nth-child(6n+6) { aspect-ratio: 3 / 2; }
/* il JS mette sulla figura la proporzione nativa (aspect-ratio inline): l'immagine la riempie senza ritagli;
   se la figura non ha una proporzione propria, l'altezza segue quella dell'immagine */
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale .9s var(--ease-out), filter .5s;
}
/* senza width/height sull'immagine si riserva comunque uno spazio (poi vince la proporzione reale) */
.gallery__item img:not([height]) { aspect-ratio: auto 9 / 16; }
html.js .gallery__item[data-reveal] > img { transition: scale .9s var(--ease-out), filter .5s; }
.gallery__item:not(.gallery__item--placeholder)::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to top, rgba(10, 9, 8, .55), transparent 55%);
  transition: opacity .4s;
}
.gallery__item:not(.gallery__item--placeholder)::before {
  content: "";
  position: absolute;
  right: .9rem; bottom: .9rem;
  z-index: 1;
  width: 46px; height: 46px;
  border-radius: 50%;
  pointer-events: none;
  color: var(--ink);
  background:
    linear-gradient(currentColor, currentColor) center / 16px 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 16px no-repeat,
    var(--rice);
  scale: .6;
  opacity: 0;
  transition: scale .5s var(--ease-spring), opacity .3s;
}
.gallery__item:hover img, .gallery__item:focus-visible img { scale: 1.06; }
.gallery__item:hover::after, .gallery__item:focus-visible::after { opacity: 1; }
.gallery__item:hover::before, .gallery__item:focus-visible::before { scale: 1; opacity: 1; }

/* segnaposto eleganti (nessuna foto): seigaiha + bagliore colorato */
.gallery__item--placeholder {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  --pf: var(--ink-2);
  --pl: rgb(86, 84, 83);
  background-color: var(--ink-2);
  background-image: var(--pat-seigaiha);
  background-size: 80px 40px;
  cursor: default;
}
.gallery__item--placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(75% 75% at 28% 18%, rgba(var(--ph, 255, 106, 77), .3), transparent 70%);
}
.gallery__item--placeholder:nth-child(3n+2) { --ph: 155, 217, 74; }
.gallery__item--placeholder:nth-child(3n) { --ph: 231, 17, 41; }
.gallery__item--placeholder > *, .gallery__label {
  position: relative;
  z-index: 1;
  max-width: 82%;
  padding: .85rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 9, 8, .72);
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .2em;
  text-align: center;
  text-transform: uppercase;
  color: var(--rice-70);
}
/* il reveal clip taglia tutto cio che sta fuori dal box: l'anello di focus si disegna dentro */
.gallery__item:focus-visible {
  outline: 3px solid var(--salmon);
  outline-offset: -6px;
  border-radius: 1rem;
}

/* ======================= LIGHTBOX ======================= */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
  background: rgba(6, 5, 4, .94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
/* il JS toglie hidden e, un frame dopo, aggiunge .is-open: la transizione fa entrare/uscire il lightbox */
#lightbox { opacity: 0; transition: opacity .45s var(--ease-out); }
#lightbox.is-open { opacity: 1; }
/* blocco dello scroll a lightbox aperto: su <html> (l'overflow del body non arriva al viewport) */
html:has(#lightbox:not([hidden])) { overflow: hidden; }
.lightbox__stage { grid-column: 2; display: grid; place-items: center; height: 100%; min-height: 0; margin: 0; }
.lightbox__img {
  width: auto; height: auto;
  max-width: 100%;
  max-height: calc(100vh - 5rem);
  max-height: calc(100svh - 5rem);
  object-fit: contain;
  border-radius: .6rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  scale: .94;
  transition: opacity .4s ease, scale .7s var(--ease-out), filter .4s ease;
}
#lightbox.is-open .lightbox__img { scale: 1; }
.lightbox__img.is-loading { opacity: .25; filter: blur(8px); }
.lightbox__img:not([src]), .lightbox__img[src^="data:image/svg+xml"] { visibility: hidden; }
.lightbox__close, .lightbox__prev, .lightbox__next {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(10, 9, 8, .6);
  color: var(--rice);
  transition: background-color .3s, color .3s, border-color .3s;
}
.lightbox__close:hover, .lightbox__prev:hover, .lightbox__next:hover,
.lightbox__close:focus-visible, .lightbox__prev:focus-visible, .lightbox__next:focus-visible {
  background: var(--rice);
  color: var(--ink);
  border-color: var(--rice);
}
.lightbox__close svg, .lightbox__prev svg, .lightbox__next svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lightbox__close { position: absolute; top: clamp(1rem, 3vw, 1.6rem); right: clamp(1rem, 3vw, 1.6rem); z-index: 2; }
.lightbox__prev { grid-column: 1; }
.lightbox__next { grid-column: 3; }
.lightbox__count {
  position: absolute;
  left: 0; right: 0; bottom: 1rem;
  text-align: center;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .22em;
  color: var(--rice-70);
}

/* ======================= CONTATTI ======================= */
.contact {
  position: relative;
  z-index: 3;
  padding-block: clamp(5rem, 12vh, 9rem);
  overflow-x: clip;
  background:
    radial-gradient(60% 50% at 88% 18%, rgba(231, 17, 41, .17), transparent 70%),
    var(--ink-2);
  color: var(--rice);
}
.contact__bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.contact__w1 {
  top: 6%; right: 1%;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: clamp(6rem, 18vw, 18rem);
  line-height: 1;
}
.contact__grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  align-items: start;
  gap: clamp(2rem, 6vw, 6rem);
}
.contact__empty {
  max-width: 32rem;
  margin-top: 1.6rem;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--salmon);
  font-size: 1.05rem;
  color: var(--rice-70);
}
.contact__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem 2rem; margin-top: 2.4rem; }
.contact__item { padding-top: 1rem; border-top: 1px solid var(--line); }
.contact__label {
  margin-bottom: .5rem;
  font-family: var(--f-body);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .22em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--salmon);
}
.contact__val { font-size: 1.15rem; line-height: 1.5; }
.contact__link {
  display: inline-block;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .5s var(--ease-out);
}
.contact__link:hover, .contact__link:focus-visible { background-size: 100% 1px; }
.hours { display: grid; gap: .1rem; }
.hours li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); font-size: 1rem; }
.hours__d { font-weight: 700; }
.hours__t { color: var(--rice-70); font-variant-numeric: tabular-nums; text-align: right; }
.social { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }

.mapblock {
  position: relative;
  display: grid;
  align-items: end;
  min-height: clamp(470px, 62vh, 620px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: linear-gradient(160deg, #141110, #0e1a14);
  color: var(--rice);
}
.mapblock__lines { position: absolute; inset: 0; width: 100%; height: 100%; color: rgba(245, 239, 227, .17); }
.mapblock__streets { stroke-dasharray: 3 7; }
/* il logo completo fa da "segnaposto" della mappa: l'emblema e il centro degli impulsi
   (emblema = 70% della larghezza, centro al 31% dell'altezza dell'immagine) */
.mapblock__mark {
  position: absolute;
  left: 50%;
  top: calc(50% - 4.4rem);
  width: min(56%, 250px);
  aspect-ratio: 480 / 544;
  translate: -50% -50%;
  animation: fluttua-logo 7s ease-in-out infinite;
}
.mapblock__logo { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.mapblock__pulse {
  position: absolute;
  left: 15%; top: .1%;
  width: 70%;
  aspect-ratio: 1;
  border: 1.5px solid var(--salmon);
  border-radius: 50%;
  opacity: 0;
  animation: pulsa 3s ease-out infinite;
}
.mapblock__pulse--2 { animation-delay: 1.5s; }
@keyframes pulsa { 0% { scale: 1; opacity: .85; } 100% { scale: 2.4; opacity: 0; } }
@keyframes fluttua-logo { 0%, 100% { translate: -50% -50%; } 50% { translate: -50% calc(-50% - 8px); } }
.mapblock__body {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: start;
  gap: .5rem;
  padding: clamp(1.4rem, 3vw, 2.2rem);
  background: linear-gradient(to top, rgba(10, 9, 8, .88), transparent);
}
.mapblock__sub { margin-bottom: .7rem; color: var(--rice-70); }

/* ======================= FOOTER ======================= */
.site-footer {
  position: relative;
  z-index: 3;
  padding-top: 0;
  overflow-x: clip;
  background: var(--ink);
  border-top: 1px solid var(--line);
  color: var(--rice);
}
.footer__grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: start; gap: 2.4rem 3rem; padding-top: clamp(2rem, 6vh, 4rem); }
/* logo completo in evidenza; il padding e l'area di rispetto attorno al marchio */
.footer__brandmark { width: min(100%, 320px); padding: clamp(.8rem, 2vw, 1.4rem); margin-left: calc(-1 * clamp(.8rem, 2vw, 1.4rem)); }
.footer__brandmark img { width: 100%; height: auto; }
.footer__blurb { max-width: 24em; margin-top: .6rem; color: var(--rice-70); }
.footer__h { margin-bottom: 1rem; font-family: var(--f-body); font-size: .72rem; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--salmon); }
.footer__col ul { display: grid; gap: .55rem; }
.footer__col li a, .footer__credit a, .footer__bottom a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .4s var(--ease-out), color .3s;
}
.footer__col li a:hover, .footer__credit a:hover, .footer__bottom a:hover,
.footer__col li a:focus-visible, .footer__credit a:focus-visible, .footer__bottom a:focus-visible { background-size: 100% 1px; color: var(--salmon); }

.footer__word {
  margin-top: clamp(2rem, 6vh, 4rem);
  overflow: hidden;
  text-align: center;
  font-family: var(--f-display);
  font-size: min(22vw, 30rem);
  font-weight: 800;
  line-height: .8;
  letter-spacing: -.04em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 2px rgba(245, 239, 227, .38);
  user-select: none;
}
/* ogni lettera si riempie di salmone dopo essere salita */
.footer__word .split-inner {
  background: linear-gradient(0deg, var(--salmon), var(--salmon)) no-repeat 0 100% / 100% 0%;
  -webkit-background-clip: text;
  background-clip: text;
}
.footer__word.is-in .split-inner { background-size: 100% 100%; }
html.js .footer__word .split-inner {
  transition:
    transform 1.05s var(--ease-out) calc(var(--i, 0) * 40ms),
    background-size 1.6s var(--ease-out) calc(.7s + var(--i, 0) * 60ms);
}
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .8rem 2rem;
  padding-block: 1.6rem 2rem;
  margin-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: .8125rem;
  color: var(--rice-55);
}
.footer__credit { max-width: 38em; }
/* dati dell'esercente (ragione sociale, sede legale, REA, PEC): riempiti da js/content.js, nascosti se vuoti */
.footer__legale { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; margin: 0; }
.footer__legale[hidden], .footer__legale [hidden] { display: none; }
[data-year]:empty { display: none; }

/* ---------- responsive: galleria, contatti, footer ---------- */
@media (max-width: 1100px) {
  .gallery { columns: 2; }
}
@media (max-width: 900px) {
  .contact__grid { grid-template-columns: minmax(0, 1fr); }
  .contact__w1 { opacity: .6; }
  .mapblock { min-height: 470px; }
  .footer__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer__col--brand { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  #lightbox { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
  .lightbox__stage { grid-column: 1; }
  .lightbox__prev, .lightbox__next { position: absolute; bottom: 1rem; z-index: 2; }
  .lightbox__prev { left: 1rem; }
  .lightbox__next { right: 1rem; }
  .lightbox__img { max-height: calc(100vh - 9rem); max-height: calc(100svh - 9rem); }
}
@media (max-width: 480px) {
  .contact__list { grid-template-columns: minmax(0, 1fr); }
  .footer__grid { grid-template-columns: minmax(0, 1fr); }
  .footer__brandmark { width: min(100%, 250px); }
  .footer__bottom { flex-direction: column; }
}
