/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-3xl) var(--space-md);
  position: relative;
  overflow: hidden;
}

/* Constellation starfield background */
.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.8) 0%,
      rgba(255, 255, 255, 0.8) 1px,
      transparent 1px
    ),
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.6) 0%,
      rgba(255, 255, 255, 0.6) 2px,
      transparent 2px
    ),
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.9) 0%,
      rgba(255, 255, 255, 0.9) 1px,
      transparent 1px
    ),
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.5) 0%,
      rgba(255, 255, 255, 0.5) 1px,
      transparent 1px
    ),
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.7) 0%,
      rgba(255, 255, 255, 0.7) 2px,
      transparent 2px
    ),
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.4) 1px,
      transparent 1px
    ),
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.6) 0%,
      rgba(255, 255, 255, 0.6) 1px,
      transparent 1px
    );
  background-size:
    600px 600px,
    800px 800px,
    700px 700px,
    900px 900px,
    500px 500px,
    1000px 1000px,
    650px 650px;
  background-position:
    0% 0%,
    40% 60%,
    50% 50%,
    80% 10%,
    90% 60%,
    33% 80%,
    15% 90%;
  opacity: 1;
  animation: twinkle 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  transform: translate(var(--tilt-x, 0px), var(--tilt-y, 0px));
  transition: transform 0.3s ease-out;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.32;
  }
}

/* Accent stars with orange glow */
.hero-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(
      circle,
      rgba(var(--color-accent-orange-rgb), 0.6) 0%,
      rgba(var(--color-accent-orange-rgb), 0.3) 2px,
      transparent 4px
    ),
    radial-gradient(
      circle,
      rgba(var(--color-accent-yellow-rgb), 0.5) 0%,
      rgba(var(--color-accent-yellow-rgb), 0.2) 3px,
      transparent 6px
    ),
    radial-gradient(
      circle,
      rgba(var(--color-accent-orange-rgb), 0.4) 0%,
      rgba(var(--color-accent-orange-rgb), 0.2) 2px,
      transparent 5px
    );
  background-size:
    1200px 1200px,
    1000px 1000px,
    800px 800px;
  background-position:
    10% 20%,
    70% 80%,
    85% 15%;
  opacity: 0.8;
  animation: twinkle-slow 15s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  transform: translate(
    calc(var(--tilt-x, 0px) * 1.6),
    calc(var(--tilt-y, 0px) * 1.6)
  );
  transition: transform 0.3s ease-out;
}

@keyframes twinkle-slow {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.05);
  }
}

/* Occasional shooting star - spawned by animations.js. Sits with the
   starfield (z-index 0), behind the hero content. */
.hero-section .shooting-star {
  position: absolute;
  z-index: 0;
  width: 110px;
  height: 1.5px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.85)
  );
  box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.35);
  opacity: 0;
  pointer-events: none;
  transform-origin: 100% 50%;
  animation: shooting-star 1.1s ease-in forwards;
}

@keyframes shooting-star {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(var(--star-angle, 30deg));
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--star-dx, 300px), var(--star-dy, 150px))
      rotate(var(--star-angle, 30deg));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-section .shooting-star {
    display: none;
  }
}

.hero-section > * {
  position: relative;
  z-index: 1;
}

/* Rotating headline word - cycles through outcome phrases via
   animations.js. Falls back to the first (always-present) phrase when JS
   is unavailable or the user prefers reduced motion. */
.hero-rotate {
  position: relative;
  display: block;
  font-size: clamp(1.75rem, 4.5vw, 3rem);
  height: 1.3em;
  margin-top: 0.1em;
  overflow: hidden;
}

.hero-rotate-word {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0.3em);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  /* The rotating outcome word is the hero's single deliberate hit of colour -
     solid accent orange against the near-white headline above it. */
  color: var(--color-accent-orange);
}

.hero-rotate-word.is-active {
  opacity: 1;
  transform: translateY(0);
}

/* Literal constellation mark - a companion graphic to the ambient starfield
   dots, tying the brand name to a concrete "connect the dots" motif rather
   than texture alone. Sits at a different parallax depth than the dot
   layers behind it. */
.constellation-mark {
  position: absolute;
  top: 8%;
  right: 2%;
  width: clamp(140px, 16vw, 200px);
  height: auto;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 0 10px rgba(var(--color-accent-orange-rgb), 0.3));
  transform: translate(
      calc(var(--tilt-x, 0px) * 2),
      calc(var(--tilt-y, 0px) * 2)
    )
    scale(0.9);
  transition: transform 0.3s ease-out;
  animation: constellation-mark-in 0.8s ease-out 0.5s forwards;
}

@keyframes constellation-mark-in {
  to {
    opacity: 0.5;
    transform: translate(
        calc(var(--tilt-x, 0px) * 2),
        calc(var(--tilt-y, 0px) * 2)
      )
      scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .constellation-mark {
    animation: none;
    opacity: 0.5;
  }
}

@media (max-width: 900px) {
  .constellation-mark {
    top: 2%;
    right: -4%;
    width: 130px;
    opacity: 0.28;
  }
}

@media (max-width: 600px) {
  .constellation-mark {
    display: none;
  }
}

/* Secondary "minor" constellation, bottom-left. Made of the same connect-the
   dots language as the brand mark but faint and white - it gives the loose
   ambient star dots a shape to belong to instead of drifting as texture. */
.constellation-minor {
  position: absolute;
  left: 2%;
  bottom: 9%;
  width: clamp(260px, 34vw, 440px);
  height: auto;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
  transform: translate(
    calc(var(--tilt-x, 0px) * 1.2),
    calc(var(--tilt-y, 0px) * 1.2)
  );
  transition: transform 0.3s ease-out;
}

.constellation-minor-path {
  stroke-dasharray: 640;
  stroke-dashoffset: 640;
  animation: draw-constellation 2.6s ease-out 1s forwards;
}

.constellation-minor-nodes circle {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: constellation-node-in 0.5s ease-out forwards;
}

.constellation-minor-nodes circle:nth-child(1) {
  animation-delay: 2.6s;
}
.constellation-minor-nodes circle:nth-child(2) {
  animation-delay: 2.75s;
}
.constellation-minor-nodes circle:nth-child(3) {
  animation-delay: 2.9s;
}
.constellation-minor-nodes circle:nth-child(4) {
  animation-delay: 3.05s;
}
.constellation-minor-nodes circle:nth-child(5) {
  animation-delay: 3.2s;
}
.constellation-minor-nodes circle:nth-child(6) {
  animation-delay: 3.35s;
}

@keyframes draw-constellation {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes constellation-node-in {
  from {
    opacity: 0;
    transform: scale(0);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .constellation-minor-path {
    animation: none;
    stroke-dashoffset: 0;
  }

  .constellation-minor-nodes circle {
    animation: none;
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .constellation-minor {
    opacity: 0.5;
    bottom: 3%;
  }
}

@media (max-width: 600px) {
  .constellation-minor {
    display: none;
  }
}

.hero-section h1 {
  position: relative;
  font-size: clamp(3.25rem, 8vw, 5.75rem);
  letter-spacing: var(--tracking-tight);
  line-height: 1.02;
  margin-bottom: var(--space-lg);
  color: var(--color-ink-invert);
  text-wrap: balance;
}

/* Soft warm bloom behind the headline so the dark hero has a focal glow
   instead of reading as a flat black field */
.hero-section h1::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120%;
  height: 240%;
  transform: translate(-50%, -50%);
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(var(--color-accent-orange-rgb), 0.16) 0%,
    rgba(var(--color-accent-orange-rgb), 0) 60%
  );
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--color-text-secondary);
  max-width: 640px;
  margin: 0 auto var(--space-xl);
}

/* Credibility strip - immediate substance directly under the CTAs */
.hero-cred {
  list-style: none;
  margin: var(--space-xl) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-md) var(--space-lg);
  font-size: 0.9rem;
  color: var(--color-text-tertiary);
}

.hero-cred li {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.hero-cred li + li {
  padding-left: var(--space-lg);
  border-left: 1px solid var(--color-border);
}

.hero-cred strong {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--color-ink-invert);
}

@media (max-width: 900px) {
  .hero-cred li + li {
    padding-left: 0;
    border-left: 0;
  }
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  left: 50%;
  bottom: var(--space-2xl);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  opacity: 0.6;
  transition: opacity var(--transition-base);
  animation: scroll-indicator-float 2.4s ease-in-out infinite;
}

.scroll-indicator:hover {
  opacity: 1;
}

.scroll-indicator-mouse {
  width: 26px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-full);
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.scroll-indicator-dot {
  width: 4px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-green-text);
  animation: scroll-indicator-dot 1.6s ease-in-out infinite;
}

@keyframes scroll-indicator-float {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(8px);
  }
}

@keyframes scroll-indicator-dot {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  70% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 0;
    transform: translateY(0);
  }
}

/* Pause infinite animations while their section is scrolled out of view
   (the .is-offscreen class is toggled in animations.js). Saves compositor
   and battery work for the long page below the hero. */
.hero-section.is-offscreen::before,
.hero-section.is-offscreen::after,
.hero-section.is-offscreen .scroll-indicator,
.hero-section.is-offscreen .scroll-indicator-dot {
  animation-play-state: paused;
}
