/* ==========================================================================
   Navigazione, menu mobile, hero 3D, selettore animazione
   ========================================================================== */

.salta { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--mattone); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.salta:focus { top: 12px; }

.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  color: #fff;
  transition: background .4s var(--ease), box-shadow .4s var(--ease);
}
.nav__bar { display: flex; align-items: center; gap: 26px; height: 76px; }
.nav__logo { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.nav__logo img { height: 40px; width: auto; }
.nav__brand { font: 800 .95rem/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.nav nav { margin-left: auto; }
.nav__links { display: flex; gap: 24px; list-style: none; padding: 0; margin: 0; }
.nav__links a { font-size: .92rem; font-weight: 600; text-decoration: none; opacity: .82; transition: opacity .2s; }
.nav__links a:hover { opacity: 1; }
.nav__tel { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .92rem; text-decoration: none; white-space: nowrap; }
.nav__tel .ico { width: 17px; height: 17px; color: var(--mattone-chiaro); }
.nav .btn { min-height: 44px; padding: 0 20px; font-size: .88rem; }
.nav__burger { display: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; place-items: center; }
.nav__burger .ico { width: 22px; height: 22px; }
.nav.is-solid { background: rgba(11, 29, 51, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 1px 0 rgba(255, 255, 255, .06); }
@media (max-width: 1120px) { .nav__links { display: none; } .nav__burger { display: grid; } }
@media (max-width: 760px) { .nav__tel, .nav__cta { display: none; } .nav nav { margin-left: auto; } .nav__bar { justify-content: space-between; } }

.menu-mobile {
  position: fixed; inset: 0; z-index: 45; background: var(--blu-notte); color: #fff;
  padding: calc(100px + env(safe-area-inset-top, 0px)) var(--gutter) 40px;
  display: flex; flex-direction: column; gap: 32px; overflow-y: auto;
}
.menu-mobile[hidden] { display: none; }
.menu-mobile ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.menu-mobile a:not(.btn) { display: block; padding: 12px 0; font: 600 1.6rem/1.2 var(--font-display); text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.menu-aperto { overflow: hidden; }

/* --- Hero --- */
.hero { position: relative; height: 260vh; background: var(--blu-notte); color: #fff; }
.hero__sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__sticky::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 19, 36, .8) 0%, rgba(7, 19, 36, .4) 40%, rgba(7, 19, 36, 0) 62%),
    linear-gradient(0deg, rgba(7, 19, 36, .5) 0%, rgba(7, 19, 36, 0) 28%);
}
.hero__labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.map-label {
  position: absolute; left: 0; top: 0; opacity: 0; white-space: nowrap;
  padding: 5px 10px; border-radius: 999px;
  font: 600 .72rem/1 var(--font-ui); letter-spacing: .02em; color: #fff;
  background: rgba(11, 29, 51, .74); border: 1px solid rgba(224, 138, 98, .45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  will-change: transform, opacity;
}
.map-label.is-main { font-size: .84rem; font-weight: 800; background: var(--mattone); border-color: transparent; padding: 7px 14px; }
.map-label.is-region { background: none; border: 0; backdrop-filter: none; font: italic 500 1.05rem/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 220, 200, .75); }

.hero__content { position: relative; z-index: 3; height: 100%; display: grid; align-items: center; padding-top: 76px; }
.hero__step { grid-area: 1 / 1; max-width: 610px; }
/* il titolo si adatta anche all'altezza dello schermo (portatili con schermo basso) */
.hero__step h1 { font-size: clamp(2.4rem, min(1.4rem + 5.2vw, 9.2vh), 5.6rem); margin: 18px 0 22px; text-wrap: balance; }
.hero__step h2 { font-size: var(--fs-h2); margin: 16px 0 18px; text-wrap: balance; }
.hero__step .lead { font-size: var(--fs-lead); color: rgba(255, 255, 255, .84); max-width: 520px; margin: 0 0 30px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__fiducia { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; padding: 0; margin: 28px 0 0; font-size: .86rem; font-weight: 600; color: rgba(255, 255, 255, .78); }
.hero__fiducia li { display: inline-flex; align-items: center; gap: 8px; }
.hero__fiducia .ico { width: 16px; height: 16px; color: var(--mattone-chiaro); stroke-width: 2.6; }
.hero__step--2 { opacity: 0; visibility: hidden; max-width: 470px; }
.hero__step--2 p { color: rgba(255, 255, 255, .82); margin: 0 0 26px; font-size: var(--fs-lead); }

.hero__scroll {
  position: absolute; z-index: 3; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: var(--fs-label); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: rgba(255, 255, 255, .6);
}
.hero__scroll::after { content: ''; width: 1.5px; height: 44px; background: linear-gradient(rgba(255, 255, 255, .7), transparent); animation: scorri 2s var(--ease) infinite; transform-origin: top; }
@keyframes scorri { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* Mirino della videocamera (scena "La casa"): opacità guidata dalla scena con --mirino e --flash */
.mirino { position: absolute; inset: 14% 8% 12% 46%; z-index: 2; pointer-events: none; opacity: var(--mirino, 0); }
.mirino::after { content: ''; position: fixed; inset: 0; background: #fff; opacity: var(--flash, 0); pointer-events: none; }
.mirino i { position: absolute; width: 34px; height: 34px; border: 2px solid rgba(255, 255, 255, .85); }
.mirino i:nth-of-type(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.mirino i:nth-of-type(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.mirino i:nth-of-type(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.mirino i:nth-of-type(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.mirino__rec, .mirino__info { position: absolute; top: 14px; font: 700 .72rem/1 var(--font-ui); letter-spacing: .14em; color: #fff; }
.mirino__rec { left: 48px; display: inline-flex; align-items: center; gap: 8px; }
.mirino__rec::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #ff4b3a; animation: lampeggia 1.2s steps(2) infinite; }
.mirino__info { right: 48px; opacity: .8; }
@keyframes lampeggia { 50% { opacity: 0; } }

/* Fallback senza WebGL */
.hero__fallback { display: none; position: absolute; right: 8%; top: 50%; width: min(38vw, 440px); transform: translateY(-50%); opacity: .95; }
.no-webgl .hero__fallback { display: block; }
.no-webgl .hero__canvas, .no-webgl .hero__labels, .no-webgl .zona__mappa { display: none; }

/* Selettore animazione 3D (solo in fase di scelta) */
.scelta-hero {
  position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  display: flex; align-items: center; gap: 4px; padding: 6px;
  background: rgba(11, 29, 51, .88); border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; box-shadow: var(--shadow-lg);
}
.scelta-hero span { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 0 8px 0 10px; color: var(--mattone-chiaro); }
.scelta-hero button { border: 0; background: none; color: rgba(255, 255, 255, .8); font: 700 .8rem/1 var(--font-ui); padding: 10px 14px; border-radius: 999px; cursor: pointer; }
.scelta-hero button[aria-pressed="true"] { background: var(--mattone); color: #fff; }

/* Telefono */
@media (max-width: 760px) {
  .hero { height: 230vh; }
  .hero__sticky::after { background: linear-gradient(0deg, rgba(7, 19, 36, .94) 0%, rgba(7, 19, 36, .62) 48%, rgba(7, 19, 36, 0) 72%); }
  .hero__content { align-items: end; padding-bottom: 92px; }
  .hero__step .lead { margin-bottom: 22px; }
  .hero__cta .btn { flex: 1 1 100%; }
  .hero__fiducia { display: none; }
  .hero__fallback { right: 50%; top: 26%; transform: translate(50%, -50%); width: 56vw; }
  .hero__scroll { display: none; }
  .mirino { inset: 12% 6% 52% 6%; }
  .map-label { font-size: .64rem; padding: 4px 8px; }
  .map-label.is-main { font-size: .76rem; padding: 6px 11px; }
  .scelta-hero { left: 50%; transform: translateX(-50%); bottom: auto; top: calc(84px + env(safe-area-inset-top, 0px)); }
  .scelta-hero span { display: none; }
  .scelta-hero button { padding: 9px 12px; white-space: nowrap; }
}

/* Movimento ridotto: niente scroll "incollato" */
.reduced .hero { height: auto; }
.reduced .hero__step--2, .reduced .hero__scroll { display: none; }
