:root {
  color-scheme: dark;
  --bg: #000;
  --blue: #2d67b2;
  --blue-hi: #1594ff;
  --text: #f7f8fb;
  --muted: #a6b5d0;
  --line: rgba(36, 134, 232, .28);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; background: #000; }
body {
  overflow: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hero {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background: #000;
}

.video-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
  transition: opacity 1s ease;
}

/* Mai tagliato a sinistra/destra: il video usa sempre il 100% della larghezza.
   Se il monitor è più largo del 16:9, l'eventuale eccedenza viene persa solo sopra/sotto. */
.hero__video {
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: auto;
  min-height: 0;
  transform: translateY(-50%);
  display: block;
  background: #000;
}

.final-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 47% 48%, rgba(12, 44, 82, .18), rgba(0,0,0,.72) 42%, #000 82%),
    rgba(0,0,0,.56);
  transition: opacity 1.1s ease;
}

.final-card {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 72px);
  pointer-events: none;
}

.final-card__inner {
  width: min(1040px, 82vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(20px) scale(.985);
  transition: opacity .9s ease, transform .9s cubic-bezier(.2,.8,.2,1);
}

.logo {
  display: block;
  width: min(960px, 80vw);
  max-height: 38vh;
  object-fit: contain;
  filter: drop-shadow(0 0 26px rgba(18,126,255,.18));
}

.copy {
  margin-top: clamp(8px, 1.25vh, 16px);
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .65s ease .22s, transform .65s ease .22s;
}

.copy h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 2rem);
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: .005em;
}

.copy p {
  margin: .55rem 0 0;
  color: var(--muted);
  font-size: clamp(.88rem, 1.25vw, 1.2rem);
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.contacts {
  margin-top: clamp(22px, 3vh, 34px);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .65s ease .46s, transform .65s ease .46s;
  pointer-events: auto;
}

.contact {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 7, 17, .66);
  color: #f2f6ff;
  text-decoration: none;
  font-size: clamp(.9rem, 1vw, 1.03rem);
  line-height: 1;
  backdrop-filter: blur(8px);
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.contact:hover {
  transform: translateY(-2px);
  border-color: rgba(37,145,255,.62);
  background: rgba(5,24,47,.82);
  box-shadow: 0 0 24px rgba(23,127,255,.09);
}

.contact svg { width: 19px; height: 19px; fill: var(--blue-hi); flex: 0 0 auto; }
.contact--whatsapp svg { fill: #28e59a; }

.hero.final-visible .video-stage { opacity: .23; }
.hero.final-visible .final-shade { opacity: 1; }
.hero.final-visible .final-card__inner { opacity: 1; transform: translateY(0) scale(1); }
.hero.copy-visible .copy { opacity: 1; transform: translateY(0); }
.hero.contacts-visible .contacts { opacity: 1; transform: translateY(0); }

.replay {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 4;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 50%;
  background: rgba(0,0,0,.4);
  color: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 1.28rem;
  opacity: 0;
  transition: opacity .35s ease, border-color .2s ease, color .2s ease;
}
.hero.ended .replay { opacity: 1; }
.replay:hover { color: #fff; border-color: rgba(45,130,225,.65); }

@media (max-width: 820px) {
  .hero { min-height: 580px; }

  .hero__video {
    top: 44%;
    width: 100%;
  }

  .final-card { padding: 28px 18px 56px; }
  .final-card__inner { width: min(100%, 620px); }
  .logo { width: min(94vw, 610px); max-height: 29vh; }
  .copy { margin-top: 14px; }
  .copy h1 { font-size: clamp(1.08rem, 5vw, 1.5rem); }
  .copy p { font-size: clamp(.72rem, 3.2vw, .95rem); letter-spacing: .11em; }
  .contacts { width: 100%; margin-top: 24px; gap: 9px; }
  .contact { min-height: 46px; padding: 11px 14px; }
}

@media (max-width: 520px) {
  .final-card { align-items: center; }
  .logo { width: min(96vw, 470px); max-height: 25vh; }
  .contacts { display: grid; grid-template-columns: 1fr 1fr; }
  .contact { width: 100%; font-size: .86rem; }
  .contact:first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .video-stage { display: none; }
  .final-shade { opacity: 1 !important; }
  .final-card__inner, .copy, .contacts { opacity: 1 !important; transform: none !important; transition: none !important; }
  .replay { display: none; }
}

/* MOBILE: niente video, mostra direttamente la schermata finale */
@media (max-width: 700px) {
  body { overflow: auto; }
  .hero {
    min-height: 100dvh;
    height: auto;
    display: grid;
    place-items: center;
    padding: 20px 0;
  }

  .video-stage,
  .replay {
    display: none !important;
  }

  .final-shade {
    opacity: 1 !important;
    background:
      radial-gradient(circle at 50% 42%, rgba(12,44,82,.20), rgba(0,0,0,.80) 46%, #000 86%),
      #000;
  }

  .final-card {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 100dvh;
    padding:
      max(28px, env(safe-area-inset-top))
      max(18px, env(safe-area-inset-right))
      max(32px, env(safe-area-inset-bottom))
      max(18px, env(safe-area-inset-left));
  }

  .final-card__inner {
    width: min(100%, 520px);
    opacity: 1 !important;
    transform: none !important;
  }

  .logo {
    width: 100%;
    max-width: 500px;
    max-height: none;
    margin-inline: auto;
  }

  .copy {
    margin-top: 18px;
    opacity: 1 !important;
    transform: none !important;
  }

  .copy h1 {
    font-size: clamp(1.12rem, 5vw, 1.48rem);
    line-height: 1.28;
  }

  .copy p {
    margin-top: .7rem;
    font-size: clamp(.72rem, 3.3vw, .9rem);
    letter-spacing: .10em;
    line-height: 1.45;
  }

  .contacts {
    width: min(100%, 400px);
    margin-top: 26px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    opacity: 1 !important;
    transform: none !important;
  }

  .contact {
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    font-size: .93rem;
  }
}

@media (max-width: 390px) {
  .logo { width: 100%; max-width: 100%; }
  .copy h1 { font-size: 1.08rem; }
  .copy p { font-size: .7rem; letter-spacing: .08em; }
  .contact { font-size: .87rem; }
}
