.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 70px;
  width: 100%;
  padding-top: 200px;
  overflow: hidden;
}

.hero-ai-constellation {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.78;
  pointer-events: none;
  mix-blend-mode: screen;
  mask-image: radial-gradient(circle at 50% 28%, #000 0%, #000 44%, transparent 78%);
}

.hero-heading {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 0 40px;
  text-align: center;
}

.hero-title-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 800px;
}

.hero-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 70px;
  font-weight: 400;
  letter-spacing: -3px;
  line-height: 0.9em;
  color: var(--color-text);
}

.hero-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
  background-color: var(--color-accent);
  border-radius: 8px;
  transform: rotate(3deg);
}

.hero-title-badge-text {
  color: var(--color-bg-alt);
  transform: rotate(-3deg);
}

.hero-title-badge-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  transform: rotate(-16deg);
}

.hero-subtitle {
  max-width: 600px;
  margin: 0;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.5;
  color: var(--color-text);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-link);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.hero-cta:hover {
  box-shadow: 0 0 20px 2px var(--color-accent);
}

.hero-cta-label {
  padding: 12px 20px;
  background-color: var(--color-accent);
  color: var(--color-bg);
  font-family: var(--font-heading);
  font-size: 13px;
  text-transform: uppercase;
}

.hero-cta-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--color-accent);
}

.hero-cta-icon svg {
  width: 16px;
  height: 16px;
  fill: var(--color-bg);
  transform: rotate(45deg);
}

.hero-marquee {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 520px;
  overflow: hidden;
}

/* La sfumatura sfuma verso --color-bg (lo stesso colore della sezione
   sottostante) e resta fuori dal filtro contrast del testo scorrevole:
   applicare il contrasto anche al gradiente rendeva il passaggio netto.
   Occupa tutta l'altezza del marquee con tappe in percentuale: con
   un'altezza fissa veniva tagliata da overflow:hidden sugli schermi
   stretti (dove il marquee è più basso), creando un gradino netto. */
.hero-marquee-gradient {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(13, 13, 13, 0) 27%,
    rgba(13, 13, 13, 0.08) 42%,
    rgba(13, 13, 13, 0.22) 55%,
    rgba(13, 13, 13, 0.45) 67%,
    rgba(13, 13, 13, 0.72) 80%,
    rgba(13, 13, 13, 0.92) 90%,
    var(--color-bg) 100%
  );
}

.hero-marquee-track {
  display: flex;
  align-items: center;
  height: 100%;
  width: max-content;
  gap: 50px;
  filter: contrast(1.23) grayscale(0.14);
  animation: hero-marquee-scroll 30s linear infinite;
}

.hero-marquee-group {
  display: flex;
  align-items: center;
  gap: 50px;
}

.hero-marquee-track span {
  font-family: var(--font-heading);
  font-size: 96px;
  font-weight: 400;
  color: var(--color-text);
  white-space: nowrap;
}

@keyframes hero-marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.hero-glow {
  position: absolute;
  z-index: -1;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 650px;
  background: linear-gradient(180deg, rgba(191, 49, 13, 0) 4%, var(--color-accent) 60%);
}

@media (max-width: 900px) {
  .hero {
    padding-top: 140px;
  }

  .hero-title {
    font-size: 52px;
  }

  .hero-title-badge-icon {
    width: 38px;
    height: 38px;
  }

  .hero-marquee {
    height: 441px;
  }

  .hero-marquee-track span {
    font-size: 52px;
  }

  /* Il bagliore segue l'altezza del marquee (~130px più alto), altrimenti
     su schermi corti invade il titolo e la CTA. */
  .hero-glow {
    height: 570px;
  }
}

@media (max-width: 600px) {
  .hero-title {
    font-size: 36px;
  }

  /* Su mobile il testo va a capo da solo: teniamo solo l'interruzione
     dopo "web." per non ritrovarci con 4 righe invece di 3. Serve anche
     più larghezza utile, altrimenti la prima frase occupa da sola 3 righe. */
  .hero-br-wide {
    display: none;
  }

  .hero-heading {
    padding: 0 16px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .hero-ai-constellation {
    opacity: 0.55;
  }

  .hero-marquee {
    height: 241px;
  }

  .hero-marquee-track span {
    font-size: 46px;
  }

  .hero-glow {
    height: 370px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-ai-constellation {
    opacity: 0.42;
  }
}
