.hero-stage {
  height: min(1100px, 100vh + 420px);
  overflow: hidden;
}

.hero-tech {
  position: absolute;
  inset: 0;
  background: transparent;
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 62%,
    rgba(0, 0, 0, 0.72) 78%,
    rgba(0, 0, 0, 0.18) 92%,
    rgba(0, 0, 0, 0) 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 62%,
    rgba(0, 0, 0, 0.72) 78%,
    rgba(0, 0, 0, 0.18) 92%,
    rgba(0, 0, 0, 0) 100%
  );
}

#home {
  background: transparent;
}

/* Canvas per linee serpente hero */
#heroSnakeCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  opacity: 0.5;
}

.hero-grid {
  opacity: 0.18;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 90%);
  -webkit-mask-image: radial-gradient(circle at center, black 35%, transparent 90%);
}

.hero-radial {
  background:
    radial-gradient(circle at 50% 16%, rgba(59,130,246,0.18), transparent 40%),
    radial-gradient(circle at 20% 26%, rgba(255,255,255,0.08), transparent 28%),
    radial-gradient(circle at 80% 24%, rgba(0,212,255,0.12), transparent 32%),
    radial-gradient(circle at 50% 80%, rgba(99,102,241,0.10), transparent 35%);
  filter: blur(1px);
}

.hero-stars {
  opacity: 0.75;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.95) 0 1px, transparent 1.6px),
    radial-gradient(circle at 24% 62%, rgba(255,255,255,0.75) 0 1px, transparent 1.8px),
    radial-gradient(circle at 37% 28%, rgba(255,255,255,0.85) 0 1.2px, transparent 2px),
    radial-gradient(circle at 52% 14%, rgba(255,255,255,0.8) 0 1px, transparent 1.8px),
    radial-gradient(circle at 68% 40%, rgba(255,255,255,0.7) 0 1.1px, transparent 2px),
    radial-gradient(circle at 82% 22%, rgba(255,255,255,0.95) 0 1.2px, transparent 2px),
    radial-gradient(circle at 74% 68%, rgba(255,255,255,0.8) 0 1px, transparent 1.8px),
    radial-gradient(circle at 16% 78%, rgba(255,255,255,0.75) 0 1px, transparent 1.8px),
    radial-gradient(circle at 90% 72%, rgba(255,255,255,0.7) 0 1px, transparent 1.8px);
  animation: starsPulse 8s ease-in-out infinite;
}

.hero-lines {
  opacity: 0.35;
  background:
    linear-gradient(115deg, transparent 0%, transparent 42%, rgba(80,180,255,0.14) 49%, transparent 56%, transparent 100%),
    linear-gradient(62deg, transparent 0%, transparent 46%, rgba(255,255,255,0.08) 49%, transparent 52%, transparent 100%);
  filter: blur(0.5px);
}

/* Luci dinamiche */
.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0;
  animation: glowPulse 12s ease-in-out infinite;
}

.hero-glow-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,0.4), transparent 70%);
  top: 10%;
  left: 15%;
  animation-delay: 0s;
}

.hero-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.35), transparent 70%);
  top: 40%;
  right: 10%;
  animation-delay: 4s;
}

.hero-glow-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(0,212,255,0.3), transparent 70%);
  bottom: 20%;
  left: 25%;
  animation-delay: 8s;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.15); }
}

.hero-streak {
  width: 200px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,1), rgba(120,200,255,0.5), transparent);
  box-shadow: 0 0 20px rgba(120,200,255,0.4), 0 0 40px rgba(59,130,246,0.3);
  transform: rotate(-24deg);
  opacity: 0;
}

.hero-streak-1 { top: 18%; left: 8%; animation: techStreak 8s ease-in-out infinite; }
.hero-streak-2 { top: 32%; right: 12%; animation: techStreak 10s ease-in-out infinite 2.5s; }
.hero-streak-3 { top: 70%; left: 30%; animation: techStreak 9s ease-in-out infinite 5s; }

@keyframes techStreak {
  0% { transform: translate3d(0,0,0) rotate(-24deg); opacity: 0; }
  10% { opacity: 0.8; }
  35% { transform: translate3d(180px,80px,0) rotate(-24deg); opacity: 0.6; }
  50% { opacity: 0.8; }
  70% { transform: translate3d(280px,140px,0) rotate(-24deg); opacity: 0.4; }
  85% { opacity: 0; }
  100% { transform: translate3d(350px,180px,0) rotate(-24deg); opacity: 0; }
}

@keyframes starsPulse {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50% { opacity: 0.95; transform: scale(1.02); }
}

.site-header {
  position: sticky;
  top: max(0.75rem, env(safe-area-inset-top));
  inset-inline: 0;
  z-index: 50;
  padding-inline: 0.5rem;
}

.site-header__nav {
  position: relative;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background:
    linear-gradient(180deg, rgba(20, 24, 31, 0.72), rgba(20, 24, 31, 0.46)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03));
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px) saturate(155%);
  -webkit-backdrop-filter: blur(16px) saturate(155%);
  overflow: clip;
}

.site-header__nav::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 25px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.04) 38%, rgba(255, 255, 255, 0.02) 100%);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  padding: 1px;
  opacity: 0.9;
}

.site-header__nav::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 55%;
  border-radius: 999px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.02));
  filter: blur(10px);
  opacity: 0.8;
}

.site-header a,
.site-header button {
  transition:
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.site-header a:hover {
  opacity: 1;
}

.site-header a:active,
.site-header button:active {
  transform: scale(0.98);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header__nav {
    background: rgba(20, 24, 31, 0.92);
  }
}

@media (max-width: 767px) {
  .site-header {
    top: max(0.5rem, env(safe-area-inset-top));
    padding-inline: 0.75rem;
  }

  .site-header__nav {
    min-height: 64px;
    padding-block: 0.4rem;
    padding-inline: 0.9rem 0.55rem;
    border-radius: 20px;
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    box-shadow:
      0 8px 24px rgba(0, 0, 0, 0.22),
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      inset 0 -1px 0 rgba(255, 255, 255, 0.03);
  }

  .site-header__nav::before {
    border-radius: 19px;
    opacity: 0.72;
  }

  .site-header__nav::after {
    left: 10px;
    right: 10px;
    height: 48%;
    filter: blur(8px);
    opacity: 0.6;
  }

  .site-header .inline-flex[aria-label="Swisstecna"] {
    gap: 0.65rem;
    min-height: 44px;
    max-width: calc(100% - 56px);
  }

  .site-header .inline-flex[aria-label="Swisstecna"] img {
    width: 28px;
    height: 28px;
  }

  .site-header .inline-flex[aria-label="Swisstecna"] span {
    line-height: 1.05;
  }

  .site-header .md\\:ps-3 > a,
  .site-header #hs-pro-an-collapse {
    min-width: 44px;
    min-height: 44px;
  }

  .site-header .md\\:ps-3 > a {
    padding: 0.72rem 0.95rem;
    font-size: 0.875rem;
    border-radius: 999px;
  }

  .site-header #hs-pro-an-collapse {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.12);
  }

  .site-header #hs-pro-an {
    margin-top: 0.5rem;
    padding-top: 0.25rem;
  }

  .site-header #hs-pro-an .overflow-hidden {
    overflow: visible;
  }

  .site-header #hs-pro-an .flex {
    gap: 0.35rem;
    padding-top: 0.35rem;
    padding-bottom: 0.15rem;
  }

  .site-header #hs-pro-an a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0.85rem 0.9rem;
    border-radius: 14px;
    color: rgba(255,255,255,0.88);
    background: rgba(255,255,255,0.03);
  }

  .site-header #hs-pro-an a:hover,
  .site-header #hs-pro-an a:focus-visible,
  .site-header #hs-pro-an a[aria-current="page"] {
    color: #fff;
    background: rgba(255,255,255,0.08);
  }
}

@media (max-width: 420px) {
  .site-header {
    padding-inline: 0.5rem;
  }

  .site-header__nav {
    border-radius: 18px;
    padding-inline: 0.8rem 0.45rem;
  }

  .site-header .md\\:ps-3 {
    display: none;
  }

  .site-header .inline-flex[aria-label="Swisstecna"] {
    max-width: calc(100% - 52px);
  }

  .site-header .inline-flex[aria-label="Swisstecna"] span {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header a,
  .site-header button {
    transition: none;
  }

  .site-header a:active,
  .site-header button:active {
    transform: none;
  }
}