/**
 * Hero 3D layer — canvas behind existing #hero marketing HTML.
 * Auth modal satellite backdrop included.
 * Does not restyle CTAs, ticker, stats, or form fields.
 */

#hero.hero-has-3d {
  position: relative;
  isolation: isolate;
  min-height: min(100vh, 920px);
  background: radial-gradient(ellipse at 70% 40%, #0b1e3a 0%, #020617 55%, #000 100%);
}

/* GSAP pin wrapper — same sky as hero so unpin never flashes empty */
.pin-spacer:has(#hero) {
  background: radial-gradient(ellipse at 70% 40%, #0b1e3a 0%, #020617 55%, #000 100%) !important;
}

#hero .hero-3d-root {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  pointer-events: none;
  overflow: hidden;
  opacity: 1;
}

#hero .hero-3d-root canvas,
#hero .hero-3d-root > div,
#hero .hero-3d-root > canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#hero .hero-3d-root::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 65% at 72% 48%, transparent 0%, rgba(2, 6, 23, 0.35) 55%, rgba(2, 6, 23, 0.78) 100%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.45) 0%, transparent 28%, transparent 72%, rgba(2, 6, 23, 0.55) 100%),
    linear-gradient(90deg, rgba(2, 6, 23, 0.72) 0%, rgba(2, 6, 23, 0.35) 38%, transparent 58%);
  transition: opacity 0.85s ease;
}

#hero .hero-3d-fallback {
  z-index: 0;
  transition: opacity 0.6s ease;
}

#hero.hero-3d-ready .hero-3d-fallback {
  /* Keep color floor under the canvas so pin/unpin never goes blank */
  opacity: 1;
  pointer-events: none;
}

#hero.hero-3d-ready .hero-3d-fallback .network-dot {
  animation: none;
}

#hero .hero-3d-content {
  position: relative;
  z-index: 10;
}

/* Settle / exit: keep the last 3D frame fully painted until features covers it */
#hero.hero-3d-settling .hero-3d-root,
#hero.hero-3d-exit .hero-3d-root {
  opacity: 1;
}

#hero.hero-3d-exit .hero-3d-root::after {
  opacity: 1;
}

#features {
  background-color: #020617;
}

@media (min-width: 1024px) {
  #hero.hero-has-3d .hero-3d-content .max-w-6xl {
    max-width: 56rem;
  }
}

@media (max-width: 767px) {
  #hero.hero-has-3d {
    min-height: auto;
  }

  #hero .hero-3d-root::after {
    background:
      radial-gradient(ellipse 90% 50% at 50% 20%, rgba(2, 6, 23, 0.2) 0%, rgba(2, 6, 23, 0.65) 70%),
      linear-gradient(180deg, rgba(2, 6, 23, 0.55) 0%, rgba(2, 6, 23, 0.25) 35%, rgba(2, 6, 23, 0.75) 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  #hero .hero-3d-root {
    opacity: 1;
  }

  #hero.hero-3d-exit .hero-3d-root {
    opacity: 1;
  }
}

/* Auth modal satellite backdrop — full-bleed behind the form */
#auth3dRoot {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.45s ease;
  background: radial-gradient(ellipse at 50% 28%, #0c2a4a 0%, #020617 52%, #000 100%);
}

#auth3dRoot.is-active {
  opacity: 1;
}

#auth3dRoot canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Soft tint only — no heavy black / blur so the satellite stays readable */
#authModal.auth-3d-on > .auth-modal-scrim {
  background: rgba(2, 6, 23, 0.22) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#authModal.auth-3d-on .auth-modal-panel {
  background: rgba(17, 24, 39, 0.9) !important;
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.32),
    0 0 48px rgba(56, 189, 248, 0.18),
    0 25px 50px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.6s ease, background 0.4s ease;
}

#authModal.auth-3d-register .auth-modal-panel {
  box-shadow:
    0 0 0 1px rgba(45, 212, 191, 0.28),
    0 0 52px rgba(45, 212, 191, 0.14),
    0 25px 50px rgba(0, 0, 0, 0.55);
}

#authModal:not(.hidden) {
  display: flex !important;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#authModal .auth-modal-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  align-items: safe center;
  justify-content: safe center;
  padding: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: none;
}

#authModal .auth-modal-panel {
  pointer-events: auto;
  margin: auto;
  width: 100%;
  flex-shrink: 0;
}

/* Integrations — hub + satellite stack behind existing cards */
.pin-spacer:has(#integrations) {
  background: radial-gradient(ellipse at 50% 20%, #0b1e3a 0%, #020617 58%, #020617 100%) !important;
}

#integrations.integrations-has-3d {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: min(100vh, 920px);
  background: radial-gradient(ellipse at 50% 20%, #0b1e3a 0%, #020617 58%, #020617 100%);
}

#integrations .integrations-3d-root {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#integrations .integrations-3d-root canvas,
#integrations .integrations-3d-root > div,
#integrations .integrations-3d-root > canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#integrations .integrations-3d-root::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 50% at 50% 42%, rgba(2, 6, 23, 0.15) 0%, rgba(2, 6, 23, 0.45) 70%, rgba(2, 6, 23, 0.72) 100%);
}

#integrations.integrations-has-3d .container {
  position: relative;
  z-index: 2;
}

#integrations.integrations-has-3d .glass-card {
  background: rgba(15, 23, 42, 0.62);
  opacity: 0.42;
  transform: none;
  transition: opacity 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

#integrations.integrations-has-3d .glass-card.is-int-active {
  opacity: 1;
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25), 0 12px 32px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  #auth3dRoot {
    transition: none;
  }
}
