/* ══════════════════════════════════════════════════════════════════
   Dolci Storie — gelateria artigianale, Bovisa (Milano)
   Concept: «DOLCE, O SALATO». Nello stesso banco convivono il pistacchio
   e il pistacchio salato: il sito fa fare al visitatore la stessa scelta
   che farebbe in vetrina. Il gesto-firma è un INTERRUTTORE che non cambia
   solo la lista dei gusti — ribalta la palette dell'intera pagina, dal
   crema/pistacchio del dolce al salino/blu del salato.
   Colori campionati dalle loro foto reali: la fascia di piastrelle blu,
   la carta da parati, il crema dei cartelli, il verde del pistacchio.
   ══════════════════════════════════════════════════════════════════ */

/* ---------- PLUMBING (reset tecnico canonico) ---------- */
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; }
}

/* ---------- STATO INIZIALE DEI .reveal ----------
   Con `immediateRender:false` lo stato "from" non esiste finché lo
   ScrollTrigger non scatta: senza queste righe gli elementi restano
   visibili, vengono azzerati di colpo e ri-dissolti — cioè FLASHANO.
   È il difetto trovato il 19/7 sul sito precedente (43 reveal su 43);
   ora `lint-sito` lo verifica col check `reveal-initial-state`. */
.js .reveal { opacity: 0; }
.js .reveal.in-view { opacity: 1; }
html:not(.js) .reveal, html.reduced-motion .reveal { opacity: 1; }

/* ---------- design system ---------- */
:root {
  --crema: #F7F1E3;
  --pistacchio: #8CA04A;
  --blu: #2F6EA8;
  --bruno: #33291E;
  --salino: #E7EAEC;
  --grafite: #1C2733;
  --acciaio: #64788C;

  /* variabili DI STATO: le ribalta l'interruttore */
  --sfondo: var(--crema);
  --sfondo-alt: #EFE7D4;
  --testo: var(--bruno);
  --accento: var(--pistacchio);
  --tenue: #8A7C68;
  --bordo: #DCD0B7;

  --display: 'Unbounded', Georgia, serif;
  --testo-font: 'Schibsted Grotesk', system-ui, -apple-system, sans-serif;
  --gut: clamp(1.25rem, 4vw, 3.5rem);
  --max: 1240px;
}

/* lo stato SALATO: stessa struttura, altro mondo */
body.salato {
  --sfondo: var(--salino);
  --sfondo-alt: #DDE2E6;
  --testo: var(--grafite);
  --accento: var(--blu);
  --tenue: var(--acciaio);
  --bordo: #C6CFD6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--sfondo);
  color: var(--testo);
  font-family: var(--testo-font);
  font-size: clamp(1rem, .5vw + .9rem, 1.09rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .6s ease, color .6s ease;
}
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.02em;
  margin: 0;
}
h2 { font-size: clamp(2rem, 5vw, 3.6rem); }
p { margin: 0 0 1.05em; }
a { color: inherit; }
strong { font-weight: 600; }

.eyebrow {
  font-family: var(--display);
  font-size: .72rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--accento); margin-bottom: 1rem;
  transition: color .6s ease;
}
.sec-head { max-width: var(--max); margin: 0 auto clamp(2rem, 5vw, 3.2rem); }
section { padding: clamp(4rem, 9vw, 7.5rem) var(--gut); }

.skip { position: absolute; left: -9999px; top: 0; background: var(--testo); color: var(--sfondo); padding: .8rem 1.2rem; z-index: 999; }
.skip:focus { left: .5rem; top: .5rem; }

/* ══════════ intro ══════════ */
#intro {
  position: fixed; inset: 0; z-index: 300;
  background: var(--crema); color: var(--bruno);
  display: grid; place-items: center;
  transition: opacity .6s ease;
}
#intro.hide { opacity: 0; pointer-events: none; }
/* l'intro la rimuove il JS: senza JS resterebbe a coprire il sito per sempre */
html:not(.js) #intro { display: none; }
#introMark {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.6rem, 6vw, 3.2rem);
  letter-spacing: -.02em;
}
.reduced-motion #intro { display: none; }

/* ══════════ header ══════════ */
#header {
  position: fixed; inset: 0 0 auto 0; z-index: 200;
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem var(--gut);
  background: var(--sfondo);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .6s ease;
}
#header.scrolled { border-bottom-color: var(--bordo); }
.brand {
  font-family: var(--display); font-weight: 800;
  font-size: 1.15rem; letter-spacing: -.02em;
  text-decoration: none; margin-right: auto;
}
#mainNav { display: flex; align-items: center; gap: clamp(.5rem, 1.2vw, 1.3rem); }
#mainNav a:not(.cta) {
  text-decoration: none; font-size: .9rem; font-weight: 500;
  padding: .3rem 0; border-bottom: 1.5px solid transparent;
  white-space: nowrap;
}
#mainNav a:not(.cta):hover { border-bottom-color: var(--accento); }
#langToggle {
  font-family: var(--display); font-size: .7rem; font-weight: 600;
  letter-spacing: .1em; background: none;
  border: 1.5px solid var(--bordo); border-radius: 2rem;
  padding: .3rem .7rem; color: inherit; cursor: pointer;
}
#langToggle:hover { border-color: var(--accento); color: var(--accento); }
/* `inline-flex` + `:not(.cta)` sopra: senza, `#mainNav a` batte `.cta`
   per specificità e le azzera il padding (pillula da 52px, testo fuori). */
.cta {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; white-space: nowrap;
  background: var(--accento); color: var(--sfondo) !important;
  padding: .55rem 1.2rem; border-radius: 2rem;
  font-weight: 600; text-decoration: none;
  transition: background-color .6s ease, color .6s ease;
}
.cta:hover { background: var(--testo); }
.cta-big { margin-top: 1.6rem; padding: .8rem 1.7rem; font-size: 1.02rem; }

#burger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: .4rem; }
#burger span { display: block; width: 26px; height: 2px; background: var(--testo); }

/* ══════════ HERO ══════════ */
#hero {
  min-height: 100vh; min-height: 100svh;
  padding-top: 7rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}
.hero-kicker {
  font-family: var(--display); font-size: .74rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--tenue); margin-bottom: 1.8rem;
}
.hero-title {
  font-size: clamp(3rem, 12vw, 9rem);
  line-height: .92; margin-bottom: 1.6rem;
}
.hero-title span { display: block; }
.ht-2 { color: var(--accento); transition: color .6s ease; }
.hero-sub { max-width: 46ch; color: var(--tenue); margin-bottom: 2.6rem; }

/* --- l'interruttore: il gesto-firma --- */
.switch-wrap { display: flex; align-items: center; gap: 1rem; }
.switch-label {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(.95rem, 1.6vw, 1.2rem);
  opacity: .38; transition: opacity .4s ease;
}
body:not(.salato) .sw-dolce, body.salato .sw-salato { opacity: 1; }
.switch {
  position: relative; width: 84px; height: 42px;
  border: 2px solid var(--testo); border-radius: 3rem;
  background: transparent; cursor: pointer; padding: 0;
  transition: border-color .6s ease;
}
.knob {
  position: absolute; top: 4px; left: 4px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accento);
  transition: transform .45s cubic-bezier(.68,-.35,.27,1.35), background-color .6s ease;
}
body.salato .knob { transform: translateX(42px); }
.switch:focus-visible { outline: 3px solid var(--accento); outline-offset: 3px; }
.switch-hint { margin-top: 1rem; font-size: .86rem; color: var(--tenue); }
.hero-rating { margin-top: 2.4rem; font-size: .9rem; color: var(--tenue); }
.hero-rating strong {
  font-family: var(--display); font-size: 1.5rem;
  font-weight: 800; color: var(--accento); vertical-align: -.1em;
  transition: color .6s ease;
}

/* ══════════ IL BANCO ══════════ */
#banco { background: var(--sfondo-alt); transition: background-color .6s ease; }
.gusti-grid {
  max-width: var(--max); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center;
}
.gusto-chip {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1rem, 2.1vw, 1.55rem);
  padding: .55rem 1.3rem;
  border: 2px solid var(--testo); border-radius: 3rem;
  transition: background-color .3s ease, color .3s ease, border-color .6s ease;
}
.gusto-chip:hover { background: var(--accento); border-color: var(--accento); color: var(--sfondo); }
.banco-nota {
  max-width: 62ch; margin: 2.4rem auto 0;
  text-align: center; font-size: .95rem; color: var(--tenue);
}
.banco-fig { max-width: var(--max); margin: clamp(2.5rem, 6vw, 4rem) auto 0; }
.banco-fig img { width: 100%; border-radius: 8px; display: block; }
.banco-fig figcaption { margin-top: .7rem; font-size: .84rem; color: var(--tenue); }

/* ══════════ LABORATORIO ══════════ */
.lab-grid {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 1.1fr .9fr;
  gap: clamp(2rem, 5vw, 4rem); align-items: center;
}
.lab-text p { max-width: 46ch; }
.lab-text h2 { margin-bottom: 1.4rem; }
.lab-tip {
  border-left: 3px solid var(--accento);
  padding-left: 1rem; font-weight: 500;
  transition: border-color .6s ease;
}
.lab-fig { margin: 0; }
.lab-fig img { width: 100%; border-radius: 8px; display: block; }

/* ══════════ GRANITA ══════════ */
#granita { background: var(--testo); color: var(--sfondo); text-align: center; transition: background-color .6s ease, color .6s ease; }
.granita-inner { max-width: 760px; margin: 0 auto; }
#granita .eyebrow { color: var(--accento); }
#granita h2 { margin-bottom: 1.4rem; }
#granita p { color: var(--sfondo); opacity: .82; }
.gr-quote {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  color: var(--accento) !important; opacity: 1 !important;
  margin: 2rem 0 .4rem; transform: rotate(-1.6deg);
}
.gr-src { font-size: .82rem; opacity: .6 !important; }

/* ══════════ LISTINO ══════════ */
.listino-grid {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(1.5rem, 4vw, 3.5rem);
}
.listino-col { list-style: none; margin: 0; padding: 0; }
.listino-col li {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; padding: .85rem 0;
  border-bottom: 1px solid var(--bordo);
  transition: border-color .6s ease;
}
.listino-col b {
  font-family: var(--display); font-weight: 600;
  font-size: 1.1rem; color: var(--accento);
  transition: color .6s ease;
}
.listino-star {
  max-width: var(--max); margin: 2.4rem auto 0;
  padding: 1.2rem 1.4rem; border: 2px solid var(--accento);
  border-radius: 8px; font-size: .98rem;
  transition: border-color .6s ease;
}
.listino-nota { max-width: var(--max); margin: 1.2rem auto 0; font-size: .86rem; color: var(--tenue); }

/* ══════════ RECENSIONI ══════════ */
.voci-grid { max-width: var(--max); margin: 0 auto; columns: 3 290px; column-gap: 1.4rem; }
.voci-grid blockquote {
  break-inside: avoid; margin: 0 0 1.4rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--bordo); border-radius: 8px;
  background: var(--sfondo-alt);
  transition: background-color .6s ease, border-color .6s ease;
}
.voci-grid p { font-size: .97rem; margin-bottom: .8rem; }
.voci-grid cite { font-style: normal; font-size: .8rem; color: var(--tenue); }

/* ══════════ GALLERY ══════════ */
.sala-grid {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.shot {
  padding: 0; border: 1px solid var(--bordo); border-radius: 8px;
  background: none; cursor: pointer; overflow: hidden; display: block;
}
.shot img { width: 100%; height: 280px; object-fit: cover; display: block; transition: transform .5s ease; }
.shot:hover img { transform: scale(1.04); }
.shot-wide { grid-column: span 2; }
.sala-nota { max-width: var(--max); margin: 1.6rem auto 0; font-size: .85rem; color: var(--tenue); }

/* ══════════ DOVE ══════════ */
#dove { background: var(--sfondo-alt); transition: background-color .6s ease; }
.dove-grid {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: .85fr 1.15fr;
  gap: clamp(2rem, 5vw, 4rem); align-items: start;
}
.dove-info address { font-style: normal; font-size: 1.1rem; line-height: 1.5; margin-bottom: .6rem; }
.dove-tel a { font-family: var(--display); font-weight: 600; font-size: 1.25rem; text-decoration: none; color: var(--accento); }
.dove-stato { font-size: .92rem; color: var(--tenue); margin-bottom: 1.4rem; }
.orari { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.orari li { display: flex; justify-content: space-between; gap: 1rem; padding: .48rem 0; border-bottom: 1px solid var(--bordo); }
.orari li.is-today { color: var(--accento); font-weight: 600; }
.orari li.is-today b { color: var(--accento); }
.dove-serv { margin-top: 1.2rem; font-size: .88rem; color: var(--tenue); }
.dove-map iframe { width: 100%; height: clamp(340px, 46vw, 470px); border-radius: 8px; border: 1px solid var(--bordo); }

/* ══════════ FAQ ══════════ */
#faq h2 { max-width: var(--max); margin: 0 auto clamp(1.6rem, 4vw, 2.4rem); }
.faq-list { max-width: 820px; margin: 0 auto; }
.faq-list details { border-bottom: 1px solid var(--bordo); padding: 1.1rem 0; }
.faq-list summary {
  cursor: pointer; font-weight: 600; font-size: 1.03rem;
  list-style: none; display: flex; justify-content: space-between; gap: 1rem;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '+'; color: var(--accento); font-size: 1.4rem; line-height: 1; }
.faq-list details[open] summary::after { content: '–'; }
.faq-list p { margin: .8rem 0 0; color: var(--tenue); font-size: .97rem; max-width: 62ch; }

/* ══════════ FOOTER ══════════ */
footer { background: var(--testo); color: var(--sfondo); transition: background-color .6s ease, color .6s ease; }
.foot-inner {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gut) 1.5rem;
  display: grid; grid-template-columns: auto 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem); align-items: start;
}
.foot-name { font-family: var(--display); font-weight: 800; font-size: 1.5rem; }
.foot-col p { margin: 0 0 .4rem; font-size: .93rem; opacity: .82; }
.foot-credit { text-align: center; padding: 0 var(--gut) 2.2rem; font-size: .78rem; opacity: .6; }
.foot-credit a, .foot-col a { color: var(--accento); }

/* ══════════ action bar mobile ══════════ */
#actionBar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 190;
  display: none; gap: 1px; background: var(--testo);
  transform: translateY(100%); transition: transform .35s ease;
}
#actionBar.is-visible { transform: translateY(0); }
#actionBar a { flex: 1; text-align: center; padding: .95rem .5rem; text-decoration: none; font-weight: 600; font-size: .95rem; }
.ab-call { background: var(--accento); color: var(--sfondo); }
.ab-map { background: var(--sfondo-alt); color: var(--testo); }

/* ══════════ lightbox ══════════ */
#lightbox {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(28, 39, 51, .93);
  display: flex; align-items: center; justify-content: center; padding: 2rem;
}
#lightboxImg { max-width: 92vw; max-height: 88vh; border-radius: 6px; }
#lightboxClose { position: absolute; top: 1.2rem; right: 1.4rem; background: none; border: 0; color: #fff; font-size: 2rem; cursor: pointer; line-height: 1; }

/* ══════════ responsive ══════════ */
@media (max-width: 960px) {
  #burger { display: flex; }
  #mainNav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--sfondo); border-bottom: 1px solid var(--bordo);
    padding: .5rem var(--gut) 1.2rem;
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height .35s ease, visibility .35s;
  }
  #mainNav.nav-open { max-height: 34rem; visibility: visible; }
  #mainNav a:not(.cta) { padding: .75rem 0; border-bottom: 1px solid var(--bordo); }
  #langToggle { align-self: flex-start; margin: .8rem 0; }
  .lab-grid, .dove-grid { grid-template-columns: 1fr; }
  .lab-fig { max-width: 440px; }
  #actionBar { display: flex; }
  body { padding-bottom: 3.4rem; }
}
@media (max-width: 640px) {
  .voci-grid { columns: 1; }
  .shot-wide { grid-column: span 1; }
  .shot img { height: 220px; }
  .foot-inner { grid-template-columns: 1fr; }
  .switch-wrap { gap: .7rem; }
}
