.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  overflow: clip;
  background: linear-gradient(165deg, var(--sky-deep) 0%, var(--sky-mid) 48%, var(--sky-lift) 100%);
}

.hero__sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.hero__glow {
  position: absolute;
  z-index: 1;
  width: min(70vw, 520px);
  height: min(70vw, 520px);
  right: 5%;
  top: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 140, 255, 0.16) 0%, rgba(20, 40, 90, 0.06) 42%, transparent 70%);
  pointer-events: none;
  filter: blur(8px);
  will-change: transform, opacity;
}

.hero__inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: clamp(1.5rem, 4vh, 3rem);
  width: min(100% - (var(--page-inline) * 2), var(--page-max));
  margin-inline: auto;
  padding-block: calc(var(--header-h) + clamp(1rem, 3vh, 2rem)) clamp(2rem, 6vh, 4rem);
  padding-inline: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.hero__copy {
  position: relative;
  z-index: 3;
  max-width: 34rem;
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  will-change: transform, opacity;
}

.hero__eyebrow {
  margin: 0 0 0.75rem;
  font-family: var(--font-ui);
  font-size: clamp(0.75rem, 0.25vw + 0.72rem, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.hero__title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: var(--title-size);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: #f5f8ff;
  text-wrap: balance;
}

.hero__title-rotator {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 1.05em;
}

.hero__title-word {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 0.28em, 0);
  white-space: nowrap;
  will-change: transform, opacity;
}

.hero__title-word.is-active {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
}

.hero__title-word.is-leaving {
  opacity: 0;
  visibility: visible;
  transform: translate3d(0, -0.22em, 0);
}

.hero__subtitle {
  margin: 0 0 1.75rem;
  max-width: 36ch;
  font-size: var(--subtitle-size);
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1.35rem;
  border: 1px solid var(--cta-border);
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--accent-strong);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.hero__cta:hover {
  background: rgba(158, 197, 255, 0.2);
  border-color: rgba(210, 230, 255, 0.75);
  color: #fff;
  transform: translateY(-1px);
}

.hero__cta:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.hero__constellation {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  margin: 0;
  width: 100%;
  min-height: clamp(220px, 42vh, 460px);
  will-change: transform;
}

.constellation {
  width: var(--constellation-max);
  max-width: 100%;
  height: auto;
  aspect-ratio: 640 / 520;
  overflow: visible;
  filter: drop-shadow(0 0 12px rgba(120, 170, 255, 0.18));
}

.constellation__path {
  opacity: 0.85;
}

.constellation__charge-group {
  pointer-events: none;
  will-change: opacity, transform;
}

.constellation__charge-soft {
  fill: rgba(180, 215, 255, 0.32);
}

.constellation__charge {
  fill: #ffffff;
  stroke: #c9deff;
  stroke-width: 1;
}

.star__label {
  fill: rgba(200, 220, 255, 0.55);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  pointer-events: none;
  user-select: none;
}

.star {
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform, opacity;
}

.star__hit {
  pointer-events: all;
}

.star__halo,
.star__core {
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.star.is-hot .star__label {
  fill: rgba(235, 245, 255, 0.95);
}

@media (min-width: 900px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
  }

  .hero__constellation {
    justify-self: end;
    min-height: clamp(280px, 58vh, 520px);
  }

  .constellation {
    --constellation-max: min(48vw, 70vh, 640px);
  }
}

@media (max-width: 899px) {
  .hero__subtitle {
    max-width: 40ch;
  }

  .hero__glow {
    top: 8%;
    right: 50%;
    translate: 50% 0;
    opacity: 0.75;
  }

  .star__label {
    font-size: 10px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 1rem;
    padding-block: calc(var(--header-h) + 0.5rem) 1rem;
  }

  .hero__title {
    font-size: clamp(2rem, 7vh + 1rem, 3.5rem);
  }

  .hero__subtitle {
    margin-bottom: 1rem;
    font-size: 0.9rem;
  }

  .hero__constellation {
    min-height: 0;
  }

  .constellation {
    --constellation-max: min(42vw, 78vh, 420px);
  }
}

/* Compact hero for generic inner pages */
.hero--compact {
  min-height: 0;
  height: auto;
}

.hero--compact .hero__inner {
  min-height: clamp(220px, 34vh, 340px);
  padding-block: calc(var(--header-h) + 0.75rem) clamp(1.25rem, 3vh, 2rem);
  gap: clamp(1rem, 3vh, 2rem);
  grid-template-columns: 1fr;
}

.hero--compact .hero__title {
  font-size: clamp(2.25rem, 6vw + 0.5rem, 4.5rem);
  margin: 0;
}

.hero--compact .hero__eyebrow {
  margin-bottom: 0.55rem;
  font-family: var(--font-nav, var(--font-ui));
  font-size: clamp(0.8rem, 0.2vw + 0.75rem, 0.95rem);
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 600;
  color: var(--accent);
}

.hero--compact .hero__constellation {
  min-height: clamp(160px, 28vh, 280px);
}

.hero--compact .constellation {
  --constellation-max: min(72vw, 42vh, 420px);
}

.hero--compact .hero__glow {
  width: min(50vw, 340px);
  height: min(50vw, 340px);
  top: 22%;
  opacity: 0.85;
}

.hero--compact .hero__subtitle,
.hero--compact .hero__cta {
  display: none;
}

.hero--compact .hero__copy {
  max-width: none;
}

@media (min-width: 900px) {
  .hero--compact:has(.hero__constellation) .hero__inner {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }

  .hero--compact .constellation {
    --constellation-max: min(36vw, 38vh, 420px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__copy {
    opacity: 1;
    transform: none;
  }

  .hero__cta {
    transition: none;
  }

  .hero__cta:hover {
    transform: none;
  }
}
