/* =========================================================
   Doña Mimma · pasticceria artigianale a Milano
   ========================================================= */
:root {
  --cream: #FBF6EC;
  --cream-2: #F4ECDC;
  --ink: #1E1E1E;
  --ink-soft: #4A4640;
  --sky: #6FA8DC;
  --sky-deep: #2F6EA8;      /* versione scura dell'accento, per testo su crema */
  --radius: 18px;
  --display: "Amatic SC", "Comic Sans MS", cursive;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --header-h: 72px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.1; margin: 0; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: 10px;
  text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 300;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--cream);
  transition: opacity .6s var(--ease), visibility .6s;
}
.js .loader { display: flex; }
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__logo { font-family: var(--display); font-weight: 700; font-size: 56px; letter-spacing: .04em; }
.loader__bar { width: 160px; height: 2px; background: rgba(30,30,30,.12); border-radius: 2px; overflow: hidden; }
.loader__bar span { display: block; height: 100%; width: 0; background: var(--sky); transition: width .2s; }
.loader__pct { font-size: 13px; letter-spacing: .12em; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  color: #fff;
  transition: background-color .35s var(--ease), color .35s var(--ease), box-shadow .35s;
}
.site-header__inner {
  max-width: 1320px; margin: 0 auto;
  height: var(--header-h);
  padding: 0 24px;
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between;
  transition: height .35s var(--ease);
}
.site-header.is-scrolled {
  background: rgba(251, 246, 236, .78);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(30,30,30,.08);
}
.site-header.is-scrolled .site-header__inner { height: 56px; }
/* Senza JS o con movimento ridotto la pagina non parte su una foto scura */
html:not(.js) .site-header, .no-story .site-header { color: var(--ink); background: rgba(251,246,236,.9); }

.logo {
  font-family: var(--display); font-weight: 700;
  font-size: 34px; letter-spacing: .06em; text-decoration: none; line-height: 1;
  text-shadow: 0 1px 12px rgba(0,0,0,.18);
  transition: font-size .35s var(--ease), text-shadow .35s;
}
.is-scrolled .logo, .no-story .logo { font-size: 28px; text-shadow: none; }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.site-nav a {
  display: block; padding: 8px 14px; border-radius: 999px;
  text-decoration: none; font-size: 15px; font-weight: 500;
  text-shadow: 0 1px 10px rgba(0,0,0,.25);
  transition: background-color .2s, color .2s;
}
.is-scrolled .site-nav a, .no-story .site-nav a { text-shadow: none; }
.site-nav a:hover { background: rgba(111,168,220,.22); }

.nav-toggle {
  display: none; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer;
  position: relative; border-radius: 10px;
}
.nav-toggle span {
  position: absolute; left: 11px; right: 11px; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform .3s var(--ease), opacity .2s;
}
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: block; z-index: 2; }
  .site-nav {
    position: fixed; inset: 0; z-index: 1;
    background: rgba(251, 246, 236, .97);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    color: var(--ink);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility .3s;
  }
  .nav-open .site-nav { opacity: 1; visibility: visible; }
  .nav-open .site-header { color: var(--ink); }
  .site-nav ul { flex-direction: column; align-items: center; gap: 8px; }
  .site-nav a { font-family: var(--display); font-weight: 700; font-size: 44px; text-shadow: none; padding: 4px 20px; }
}

/* ---------- Storia (canvas sticky) ---------- */
.story { position: relative; height: 900vh; background: #1a1714; }
.stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  width: 100%; overflow: hidden;
}
#story-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage__shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 18%),
    linear-gradient(to top, rgba(0,0,0,.62) 0%, rgba(0,0,0,.25) 28%, rgba(0,0,0,0) 50%);
}

.caption {
  position: absolute; left: 0; right: 0;
  bottom: calc(96px + env(safe-area-inset-bottom));
  padding: 0 max(24px, 6vw);
  color: #fff;
  opacity: 0; visibility: hidden;
  transform: translateY(24px);
  will-change: opacity, transform;
  text-shadow: 0 2px 18px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35);
}
.caption p {
  margin: 0; max-width: 16em;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(40px, 6.2vw, 84px); line-height: 1.02; letter-spacing: .01em;
}
.caption .btn { margin-top: 22px; text-shadow: none; }

.caption--hero {
  top: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; opacity: 1; visibility: visible; transform: none;
}
.hero-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(84px, 15vw, 210px); line-height: .9; letter-spacing: .02em;
}
.hero-sub {
  margin-top: 14px !important; max-width: none !important;
  font-family: var(--sans) !important; font-weight: 500 !important;
  font-size: clamp(15px, 1.6vw, 20px) !important; letter-spacing: .22em; text-transform: uppercase;
}

.scroll-hint {
  position: absolute; left: 50%; bottom: calc(70px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: #fff; font-size: 12px; letter-spacing: .3em; text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0,0,0,.4);
  transition: opacity .5s var(--ease);
}
.scroll-hint i {
  width: 1px; height: 44px; background: rgba(255,255,255,.35); position: relative; overflow: hidden;
}
.scroll-hint i::after {
  content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%;
  background: var(--sky);
  animation: hint 1.8s var(--ease) infinite;
}
@keyframes hint { to { top: 100%; } }
.scroll-hint.is-hidden { opacity: 0; }

.story-static { display: none; }

/* Barra dei capitoli */
.chapters {
  position: fixed; right: max(14px, env(safe-area-inset-right)); top: 50%; z-index: 50;
  transform: translate(12px, -50%); opacity: 0; visibility: hidden;
  transition: opacity .4s var(--ease), transform .4s var(--ease), visibility .4s;
}
.chapters.is-visible { opacity: 1; visibility: visible; transform: translate(0, -50%); }
.chapters ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.chapters button {
  display: block; width: 28px; height: 22px; padding: 0; border: 0; background: transparent; cursor: pointer;
  position: relative;
}
.chapters button::before {
  content: ""; position: absolute; right: 4px; top: 50%; height: 3px; width: 12px; margin-top: -1.5px;
  background: rgba(255,255,255,.55); border-radius: 2px;
  box-shadow: 0 0 6px rgba(0,0,0,.3);
  transition: width .3s var(--ease), background-color .3s;
}
.chapters button:hover::before { width: 18px; background: #fff; }
.chapters button[aria-current="step"]::before { width: 24px; background: var(--sky); }

/* ---------- Sezioni ---------- */
.section { padding: clamp(72px, 11vw, 140px) 0; }
.section--alt { background: var(--cream-2); }
.section__head { margin-bottom: clamp(32px, 5vw, 56px); }
.eyebrow {
  margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: var(--sky-deep);
}
.section h2 { font-family: var(--display); font-weight: 700; font-size: clamp(56px, 8vw, 96px); letter-spacing: .02em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 26px; border-radius: 999px;
  background: var(--ink); color: var(--cream); text-decoration: none;
  font-weight: 600; font-size: 15px; letter-spacing: .02em;
  border: 2px solid var(--ink);
  transition: background-color .25s, color .25s, border-color .25s, transform .25s var(--ease);
}
.btn:hover { background: var(--sky); border-color: var(--sky); color: var(--ink); transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--light { background: #fff; border-color: #fff; color: var(--ink); }

/* Card specialità */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 36px); }
.card h3 { font-family: var(--display); font-weight: 700; font-size: 40px; margin-top: 18px; }
.card p { margin: 4px 0 0; color: var(--ink-soft); }
.card__media { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 5; background: var(--cream-2); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card__media img { transform: scale(1.06); }

/* Identità */
.identity { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px 64px; align-items: start; }
.identity .section__head { grid-row: span 2; }
.lead { font-size: clamp(20px, 2.2vw, 26px); line-height: 1.45; margin-top: 0; }
.todo {
  background: rgba(111,168,220,.25); color: var(--ink); padding: 2px 6px; border-radius: 6px;
  font-size: .92em; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.values { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.values li { border-top: 2px solid var(--sky); padding-top: 14px; }
.values strong { display: block; font-family: var(--display); font-size: 30px; line-height: 1.1; }
.values span { color: var(--ink-soft); font-size: 15px; }

/* Galleria */
.gallery { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(10px, 1.6vw, 20px); }
.gallery button {
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; background: var(--cream-2);
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 5;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease), filter .4s; }
.gallery button:hover img { transform: scale(1.05); }
.gallery__more { margin-top: 32px; text-align: center; color: var(--ink-soft); }
.gallery__more a, .site-footer a { color: var(--sky-deep); font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* Dove siamo */
.where { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px 64px; }
.where .section__head { grid-row: span 2; }
.info { margin: 0; display: grid; gap: 22px; }
.info div { border-bottom: 1px solid rgba(30,30,30,.1); padding-bottom: 18px; }
.info dt { font-size: 13px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--sky-deep); }
.info dd { margin: 4px 0 0; font-size: 19px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }

/* Footer */
.site-footer { background: var(--ink); color: var(--cream); padding: 56px 0 calc(90px + env(safe-area-inset-bottom)); }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 16px 40px; align-items: center; justify-content: space-between; }
.site-footer p { margin: 0; font-size: 14px; color: rgba(251,246,236,.7); }
.site-footer a { color: var(--sky); }
.logo--footer { color: var(--cream) !important; text-shadow: none; font-size: 36px; }

/* Fade-up */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(20, 18, 16, .94);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; touch-action: pan-y;
  animation: lb-in .3s var(--ease);
}
.lightbox[hidden] { display: none; }
@keyframes lb-in { from { opacity: 0; } }
.lightbox__figure { margin: 0; max-width: min(92vw, 640px); text-align: center; }
.lightbox__figure img {
  max-height: 80vh; max-height: 80svh; width: auto; margin: 0 auto; border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.lightbox__figure figcaption { color: rgba(251,246,236,.85); font-size: 15px; margin-top: 14px; }
.lightbox button {
  position: absolute; border: 0; cursor: pointer; color: #fff; background: rgba(255,255,255,.1);
  width: 52px; height: 52px; border-radius: 50%; font-size: 30px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background-color .2s;
}
.lightbox button:hover { background: var(--sky); color: var(--ink); }
.lightbox__close { top: max(16px, env(safe-area-inset-top)); right: 16px; }
.lightbox__nav--prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__nav--next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---------- Badge anteprima ---------- */
.preview-badge {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 150;
  transform: translateX(-50%);
  background: rgba(30,30,30,.86); color: var(--cream);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 8px 16px; border-radius: 999px;
  font-size: 12px; font-weight: 500; letter-spacing: .03em; white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  pointer-events: none;
}
.preview-badge::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sky); margin-right: 8px; vertical-align: 1px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .identity, .where { grid-template-columns: 1fr; }
  .identity .section__head, .where .section__head { grid-row: auto; margin-bottom: 8px; }
  .values { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .site-header__inner { padding-left: 16px; padding-right: 8px; height: 64px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .cards { gap: 22px 14px; }
  .card h3 { font-size: 32px; margin-top: 12px; }
  .card p { font-size: 14px; }
  .caption { padding: 0 52px 0 20px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .lightbox__nav { display: none !important; }
  .preview-badge { font-size: 11px; padding: 7px 13px; }
  .chapters { right: 4px; }
  .chapters button { width: 22px; height: 18px; }
  .chapters button::before { width: 9px; right: 3px; }
  .chapters button[aria-current="step"]::before { width: 16px; }
}

/* ---------- Movimento ridotto: niente scrubbing, sequenza statica ---------- */
/* Attivata da main.js (classe .no-story) se prefers-reduced-motion, oppure senza JavaScript */
html:not(.js) .story, .no-story .story { height: auto; background: var(--cream); padding: calc(var(--header-h) + 24px) 0 40px; }
html:not(.js) .stage, html:not(.js) .chapters,
.no-story .stage, .no-story .chapters, .no-story .loader { display: none !important; }
html:not(.js) .story-static, .no-story .story-static { display: grid; gap: 40px; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.story-static figure { margin: 0; }
.story-static img { width: 100%; border-radius: var(--radius); }
.story-static figcaption { margin-top: 12px; font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1.1; }
.story-static .static-title { display: block; font-size: 72px; }
.story-static .btn { margin-left: 12px; font-family: var(--sans); vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .card__media img, .gallery img, .btn, .site-header, .logo { transition: none; }
  .scroll-hint i::after { animation: none; }
  .lightbox { animation: none; }
}
