/* =====================================================================
   HF Copisteria — layout.css
   Header (barra Apple), barra di avanzamento, menu mobile, footer,
   barra CTA mobile, intro, velo di transizione.
   ===================================================================== */

/* ---------- Barra di avanzamento (2px spettro, sopra l'header) ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px;
  z-index: var(--z-progress);
  pointer-events: none;
}
.progress-bar {
  display: block; height: 100%;
  background: var(--spectrum-line);
  clip-path: inset(0 calc(100% - var(--p, 0) * 100%) 0 0);
}

/* ---------- Header ---------- */
.gnav {
  position: sticky; top: 0;
  z-index: var(--z-header);
  height: var(--nav-h);
  color: var(--ink);
}
/* vetro sul pseudo-elemento: il backdrop-filter sul contenitore romperebbe il pannello fixed */
.gnav::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(245,245,247,.8);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
  transition: background-color .32s var(--ease-ui);
}
.gnav.is-scrolled::before { box-shadow: 0 .5px 0 rgba(0,0,0,.08); }
.gnav-bar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  height: var(--nav-h);
  width: min(1180px, 100% - 2 * clamp(8px, 2.2vw, 22px));
  margin-inline: auto;
}
.gnav-logo {
  display: flex; align-items: center;
  height: 100%;
  padding: 0 8px 0 6px;
  margin-right: auto;
  flex: none;
}
.gnav-logo img { width: 140px; height: 27px; } /* misure intere: niente bordi sfocati da sub-pixel */
.gnav-links { display: none; }
.gnav-links ul { display: flex; align-items: center; list-style: none; padding: 0; margin: 0; }
.gnav-link {
  display: flex; align-items: center;
  height: var(--nav-h);
  padding: 0 9px;
  font-size: 12px; line-height: 1; letter-spacing: -.01em;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: color .15s var(--ease-ui);
}
.gnav-link:hover { color: #000; text-decoration: none; }
.gnav-link[aria-current="page"] { color: #000; }
.gnav-end { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.gnav-status { display: none; }
.gnav-status-compact { font-size: 12px; min-height: 44px; padding: 0 6px; }
.gnav-cta { display: none; }
@media (min-width: 600px) { .gnav-cta { display: inline-flex; } }

/* hamburger: due linee che diventano una X */
.gnav-burger {
  position: relative;
  width: 44px; height: 44px; margin-right: -6px;
  display: grid; place-items: center;
  color: var(--ink);
}
.gnav-burger-line {
  position: absolute; left: 50%; top: 50%;
  width: 17px; height: 1.5px; margin-left: -8.5px;
  border-radius: 1px;
  background: currentColor;
  transition: transform .32s var(--ease-ui);
}
.gnav-burger-line--a { transform: translateY(-3.5px); }
.gnav-burger-line--b { transform: translateY(3.5px); }
.gnav.is-open .gnav-burger-line--a { transform: rotate(45deg); }
.gnav.is-open .gnav-burger-line--b { transform: rotate(-45deg); }

/* pannello mobile: si allunga dalla barra fino a tutta altezza */
.gnav-panel {
  position: fixed; inset: 0;
  z-index: 1;
  background: var(--bg-soft);
  overflow-y: auto; overscroll-behavior: contain;
  clip-path: inset(0 0 calc(100% - var(--nav-h)) 0);
  visibility: hidden;
  transition: clip-path .42s var(--ease-ui), visibility 0s linear .42s;
}
.gnav.is-open .gnav-panel {
  clip-path: inset(0 0 0 0);
  visibility: visible;
  transition: clip-path .42s var(--ease-ui), visibility 0s;
}
.gnav.is-open::before { background: var(--bg-soft); }
.gnav-panel-inner {
  min-height: 100%;
  padding: calc(var(--nav-h) + 20px) clamp(24px, 8vw, 48px) calc(40px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  width: min(760px, 100%); margin-inline: auto;
}
.gnav-panel-inner > .status-pill { align-self: flex-start; }
.gnav-panel-list { list-style: none; padding: 0; margin: 18px 0 0; }
.gnav-panel-link {
  display: block;
  padding: 7px 0 8px;
  font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -.012em;
  color: #333336;
}
.gnav-panel-link:hover { color: #000; text-decoration: none; }
.gnav-panel-foot { margin-top: 32px; display: grid; gap: 12px; justify-items: start; }
.gnav-panel-foot .btn { min-width: 220px; }
.gnav-panel-meta { margin-top: 20px; font-size: 14px; line-height: 1.43; color: var(--ink-2); }
.gnav-panel-meta a { color: var(--ink-2); text-decoration: underline; text-underline-offset: .15em; }
/* voci a cascata (opacity + translateY), come il flyout Apple */
.gnav-panel [data-stagger] {
  opacity: 0; transform: translateY(-8px);
  transition: opacity .32s var(--ease-ui), transform .32s var(--ease-ui);
}
.gnav.is-open .gnav-panel [data-stagger] {
  opacity: 1; transform: none;
  transition-delay: calc(90ms + var(--i, 0) * 28ms);
}

@media (min-width: 1068px) {
  .gnav-links { display: block; margin-inline: auto; }
  .gnav-logo { margin-right: 0; }
  .gnav-end { margin-left: 0; }
  .gnav-status { display: inline-flex; }
  .gnav-status-compact, .gnav-burger, .gnav-panel { display: none; }
  .gnav-cta { display: inline-flex; }
}
@media (min-width: 1068px) and (max-width: 1180px) {
  .gnav-link { padding: 0 7px; }
  /* "Chiuso al momento · apre lunedì alle 8:30" non ci sta accanto alle voci: resta solo lo stato
     (il dettaglio rimane per i lettori di schermo e nella card Orari) */
  .gnav-status .status-detail {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}

/* ---------- Barra CTA mobile (compare dopo l'hero) ---------- */
.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: var(--z-cta);
  display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(250,250,252,.86);
  -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px);
  box-shadow: 0 -.5px 0 rgba(0,0,0,.1);
  transform: translateY(110%);
  visibility: hidden;
  transition: transform .45s var(--ease-out), visibility 0s linear .45s;
}
.cta-bar.is-visible { transform: none; visibility: visible; transition: transform .45s var(--ease-out), visibility 0s; }
.gnav-open .cta-bar { transform: translateY(110%); }
.cta-bar-item {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 14px; line-height: 1.2; font-weight: 600;
  color: var(--ink);
  background: rgba(0,0,0,.05);
  white-space: nowrap;
}
.cta-bar-item:hover { text-decoration: none; }
.cta-bar-item svg { width: 16px; height: 16px; flex: none; }
.cta-bar-item--main { background: var(--action); color: #fff; }
.cta-bar-item--main:hover { background: var(--action-hover); color: #fff; }
@media (min-width: 834px) { .cta-bar { display: none; } }

/* ---------- Footer (Apple) ---------- */
.gfoot {
  background: var(--bg-alt);
  color: rgba(0,0,0,.56);
  font-size: 12px; line-height: 1.33; letter-spacing: -.01em;
  padding: 17px 0 21px;
}
body.has-cta-bar .gfoot { padding-bottom: calc(21px + 72px + env(safe-area-inset-bottom)); }
@media (min-width: 834px) { body.has-cta-bar .gfoot { padding-bottom: 21px; } }
.gfoot-inner { width: min(980px, 100% - 2 * clamp(16px, 4vw, 22px)); margin-inline: auto; }
.gfoot a { color: rgba(0,0,0,.72); }
.gfoot a:hover { color: rgba(0,0,0,.88); text-decoration: underline; }
.gfoot-notes { padding-bottom: 11px; border-bottom: 1px solid rgba(0,0,0,.16); }
.gfoot-notes p + p { margin-top: 6px; }
.gfoot-brand { display: flex; align-items: center; gap: 10px; padding: 17px 0 0; }
.gfoot-brand img { height: 18px; width: auto; }
.gfoot-dir { display: grid; grid-template-columns: 1fr; padding-top: 8px; }
.gfoot-col { border-bottom: 1px solid rgba(0,0,0,.16); }
.gfoot-title { font-size: 12px; line-height: 1.33; font-weight: 600; color: rgba(0,0,0,.88); margin: 0; }
.gfoot-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 44px; padding: 0;
  text-align: left; font-weight: 600; color: inherit;
}
.gfoot-chev {
  width: 8px; height: 8px; margin-right: 4px;
  border-right: 1.2px solid currentColor; border-bottom: 1.2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .3s var(--ease-ui);
  opacity: .7;
}
.gfoot-col.is-open .gfoot-chev { transform: translateY(2px) rotate(-135deg); }
.gfoot-list { list-style: none; padding: 0 0 14px 14px; margin: 0; }
.gfoot-list li { margin-bottom: 9.6px; }
.gfoot-list li:last-child { margin-bottom: 0; }
.gfoot-list .hours-list--compact .hours-row { margin-bottom: 4px; }
.gfoot-list .hours-row.is-today .hours-day, .gfoot-list .hours-row.is-today .hours-time { color: var(--open-ink); }
html.js .gfoot-col:not(.is-open) .gfoot-list { display: none; }
.gfoot-more { padding: 16px 0; border-bottom: 1px solid rgba(0,0,0,.16); color: rgba(0,0,0,.56); }
.gfoot-more a { color: var(--link); }
.gfoot-more a:hover { color: var(--link); }
.gfoot-legal { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 0; padding-top: 16px; }
.gfoot-copy { flex: 1 1 100%; }
.gfoot-legal-links { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.gfoot-legal-links li + li { border-left: 1px solid rgba(0,0,0,.2); }
.gfoot-legal-links a { display: inline-block; padding: 0 9px; }
.gfoot-legal-links li:first-child a { padding-left: 0; }
.gfoot-locale { flex: 1 1 100%; color: rgba(0,0,0,.72); }

@media (min-width: 834px) {
  .gfoot-dir { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding: 20px 0 16px; border-bottom: 1px solid rgba(0,0,0,.16); }
  .gfoot-col { border: 0; }
  .gfoot-toggle { min-height: 0; pointer-events: none; margin-bottom: 10px; }
  .gfoot-chev { display: none; }
  html.js .gfoot-col:not(.is-open) .gfoot-list, .gfoot-list { display: block; padding: 0; }
  .gfoot-more { border-bottom: 1px solid rgba(0,0,0,.16); }
  .gfoot-legal { flex-wrap: nowrap; }
  .gfoot-copy { flex: 0 1 auto; margin-right: 24px; }
  .gfoot-locale { flex: 0 0 auto; margin-left: auto; }
}

/* ---------- Intro al primo caricamento della sessione ---------- */
.hf-intro {
  position: fixed; inset: 0;
  z-index: var(--z-intro);
  display: none;
  place-items: center;
  background: #fff;
  cursor: pointer;
}
html.hf-intro-on .hf-intro { display: grid; }
html.hf-intro-on body { overflow: hidden; }
.hf-intro-stage { position: relative; display: grid; justify-items: center; }
.hf-intro-slot {
  display: block;
  width: 132px; height: 3px; border-radius: 2px;
  background: var(--ink);
  transform-origin: 50% 50%;
}
.hf-intro-sheet {
  margin-top: -1px;
  padding: 14px 18px 0;
  clip-path: inset(0 0 100% 0);
}
.hf-intro-wheel { width: 88px; height: 88px; }
.hf-intro-wheel svg { width: 100%; height: 100%; }
.hf-intro-skip {
  position: absolute; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-size: 12px; color: var(--ink-3);
  opacity: 0;
}

/* ---------- Velo di transizione tra pagine ---------- */
.hf-veil {
  position: fixed; inset: 0;
  z-index: var(--z-veil);
  display: grid; place-items: center;
  background: #fff;
  transform: translateY(100%);
  visibility: hidden;
  pointer-events: none;
}
html.hf-veil-on .hf-veil { transform: none; visibility: visible; }
.hf-veil.is-active { visibility: visible; pointer-events: auto; }
.hf-veil-mark { width: 56px; height: 56px; }
.hf-veil-mark svg { width: 100%; height: 100%; animation: hf-spin 1.1s var(--ease-slide) infinite; }
@keyframes hf-spin { to { transform: rotate(360deg); } }

/* ---------- Lenis ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* menu aperto: pagina ferma */
html.gnav-open, html.gnav-open body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .hf-intro, .hf-veil { display: none !important; }
  .is-open .status-dot::after { animation: none; }
}
