/* ==========================================================================
   HERO — built fresh
   Composition: copy left, plexus sphere right (cropped), streams flowing left,
   metrics strip bottom-right.
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-start;
  padding-top: calc(var(--header-h) + clamp(2.75rem, 7vh, 5.5rem));
  padding-bottom: var(--space-8);
  overflow: hidden;
  background: #04050a;
  isolation: isolate;
}

/* ---------- Layers ---------- */

.hero__bg,
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Glow stays parked under the sphere — the copy side reads near-black. */
.hero__bg {
  z-index: 0;
  background:
    radial-gradient(ellipse 30% 42% at 91% 48%, rgba(43, 104, 255, 0.3), transparent 70%),
    radial-gradient(ellipse 20% 26% at 94% 72%, rgba(255, 92, 196, 0.2), transparent 66%),
    radial-gradient(ellipse 17% 22% at 80% 20%, rgba(70, 224, 255, 0.17), transparent 64%),
    #04050a;
}

.hero__bg::after {
  content: "";
  position: absolute;
  inset: -15%;
  background:
    radial-gradient(ellipse 18% 18% at 84% 40%, rgba(70, 224, 255, 0.14), transparent 68%),
    radial-gradient(ellipse 18% 20% at 90% 66%, rgba(255, 110, 199, 0.12), transparent 70%);
  filter: blur(26px);
  animation: heroAurora 14s ease-in-out infinite alternate;
}

@keyframes heroAurora {
  from {
    transform: translate3d(-1.5%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(2%, 1.5%, 0) scale(1.05);
  }
}

.hero__canvas {
  z-index: 2;
}

/* Grain sits *under* the WebGL canvas and uses plain alpha: a blend mode here
   forces the hero into one compositing group and wipes out the canvas. */
.hero__grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.045;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Keeps the headline legible over the sphere — but leave the right bright */
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(4, 5, 10, 0.78) 0%,
    rgba(4, 5, 10, 0.45) 22%,
    rgba(4, 5, 10, 0.1) 38%,
    transparent 50%
  );
}

/* ---------- Copy ---------- */

.hero__content {
  position: relative;
  z-index: 4;
  max-width: 54rem;
}

.hero__label {
  position: relative;
  display: inline-block;
  margin-bottom: calc(var(--space-4) + 6px);
  color: rgba(255, 255, 255, 0.62);
}

/* Short gradient rule tucked under the tail of the label */
.hero__label::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  width: 38px;
  height: 2px;
  background: linear-gradient(90deg, #46e0ff, #a855f7);
}

.hero__title {
  margin-bottom: var(--space-5);
  font-size: clamp(2.9rem, 7.2vw, 8rem);
  line-height: 0.94;
  letter-spacing: -0.042em;
}

.hero__title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
  white-space: nowrap;
}

.hero__title .line span {
  display: inline-block;
  background: linear-gradient(180deg, #ffffff 18%, #c3ccea 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__title .line:last-child span {
  background: linear-gradient(96deg, #46e0ff 0%, #4f7dff 42%, #a855f7 74%, #ff6ec7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  max-width: 42ch;
  margin-bottom: var(--space-6);
  font-size: clamp(0.98rem, 1.1vw, 1.08rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.74);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* ---------- Metrics strip (in-flow under CTAs — no overlap) ---------- */

.hero__metrics {
  position: relative;
  z-index: 4;
  display: none;
  flex-wrap: wrap;
  margin-top: clamp(2.25rem, 4.5vh, 3.5rem);
  pointer-events: none;
}

.hero-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding-inline: clamp(1rem, 2vw, 1.9rem);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
  min-width: 7.25rem;
}

.hero-metric:first-child {
  padding-left: 0;
  border-left: 0;
}

.hero-metric__icon {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  color: #46e0ff;
  filter: drop-shadow(0 0 9px currentColor);
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.hero-metric:nth-child(1) .hero-metric__icon {
  color: #ff6ec7;
}

.hero-metric:nth-child(2) .hero-metric__icon {
  color: #a855f7;
}

.hero-metric:nth-child(3) .hero-metric__icon {
  color: #5b8cff;
}

.hero-metric:nth-child(4) .hero-metric__icon {
  color: #46e0ff;
}

.hero-metric__icon svg {
  width: 100%;
  height: 100%;
}

.hero-metric strong {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.2vw, 2rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #ffffff 58%, #cfe6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-metric span:not(.hero-metric__icon) {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.62);
}

/* ==========================================================================
   No-WebGL fallback — sphere + streams drawn in CSS
   ========================================================================== */

.hero__fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  pointer-events: none;
}

.hero__fallback.is-visible {
  display: block;
}

/* Sized without a centering transform so the JS entrance can animate
   translate/scale without fighting a translate(-50%, -50%). */
.hero__sphere {
  --size: min(95svh, 100vw);
  position: absolute;
  top: calc(50% - var(--size) / 2);
  left: calc(99% - var(--size) / 2);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 22% 28%, #46e0ff 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 38% 18%, #5b8cff 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 55% 26%, #7c5cff 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 72% 36%, #ff6ec7 0 3px, transparent 4px),
    radial-gradient(circle at 78% 55%, #a855f7 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 62% 72%, #ff6ec7 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 40% 78%, #5b8cff 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 26% 58%, #46e0ff 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 48% 48%, rgba(70, 224, 255, 0.22), transparent 42%),
    radial-gradient(circle at 62% 60%, rgba(255, 110, 199, 0.2), transparent 40%);
  box-shadow:
    0 0 160px rgba(70, 224, 255, 0.28),
    0 0 240px rgba(255, 110, 199, 0.18);
  opacity: 0.95;
  animation: heroSphereFloat 9s ease-in-out infinite;
}

@keyframes heroSphereFloat {
  50% {
    transform: translateY(-14px);
  }
}

.hero__streams {
  position: absolute;
  inset: 6% 28% 8% 42%;
}

.hero__streams span {
  position: absolute;
  top: var(--y);
  right: 0;
  width: var(--w);
  height: 1px;
  background: linear-gradient(
    270deg,
    rgba(255, 110, 199, 0.6),
    rgba(70, 224, 255, 0.35) 45%,
    transparent
  );
  animation: heroStreamPulse 4s ease-in-out var(--d) infinite;
}

@keyframes heroStreamPulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.85;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (min-width: 1024px) {
  .hero {
    max-height: 100svh;
  }

  .hero__content {
    margin-left: clamp(1rem, 3.5vw, 3.5rem);
  }

  .hero__metrics {
    display: flex;
    align-items: stretch;
  }
}

@media (min-width: 1024px) and (max-height: 820px) {
  .hero__title {
    font-size: clamp(2.4rem, 5.8vw, 5.5rem);
  }

  .hero__sub {
    margin-bottom: var(--space-5);
  }

  .hero__label {
    margin-bottom: var(--space-3);
  }

  .hero__metrics {
    margin-top: 1.75rem;
  }
}

@media (max-width: 1023px) {
  .hero {
    align-items: flex-end;
    padding-bottom: var(--space-9);
    min-height: 92svh;
  }

  .hero__title {
    font-size: clamp(2.45rem, 11vw, 4.5rem);
  }

  .hero__scrim {
    background: linear-gradient(
      180deg,
      rgba(4, 5, 10, 0.35) 0%,
      rgba(4, 5, 10, 0.72) 46%,
      rgba(4, 5, 10, 0.94) 100%
    );
  }

  .hero__sphere {
    --size: min(82vw, 420px);
    top: calc(30% - var(--size) / 2);
    left: calc(62% - var(--size) / 2);
    opacity: 0.75;
  }

  .hero__streams {
    inset: 12% 10% 40% 4%;
    opacity: 0.6;
  }
}

@media (max-width: 379px) {
  .hero__title {
    font-size: clamp(2.15rem, 10.5vw, 2.55rem);
  }

  .hero__title .line {
    white-space: normal;
  }
}

@media (max-width: 479px) {
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__bg::after,
  .hero__sphere,
  .hero__streams span {
    animation: none;
  }
}

html[data-motion="reduce"] .hero__bg::after,
html[data-motion="reduce"] .hero__sphere,
html[data-motion="reduce"] .hero__streams span {
  animation: none;
}
