/* ============================================================
   Nebula Category Explorer — search engine idle state
   Visual port of PSGE Gateway v2 (DO_NOT_DEPLOY/PSGE)
   ============================================================ */

.nebula-stage {
  position: relative;
  width: 100%;
  height: calc(100vh - 175px);
  min-height: 420px;
  max-height: 740px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 1000px 600px at 20% 10%, rgba(91,211,255,0.06), transparent 60%),
    radial-gradient(ellipse 800px 700px at 85% 90%, rgba(156,107,255,0.07), transparent 60%),
    radial-gradient(ellipse 500px 400px at 50% 50%, rgba(245,113,198,0.025), transparent 70%),
    #06081A;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.nebula-stage.is-hiding {
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

/* Particle canvas */
#nebulaCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Deep haze layer over canvas */
.nebula-haze {
  position: absolute;
  inset: -5%;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse 600px 450px at 30% 75%, rgba(156,107,255,0.10), transparent 70%),
    radial-gradient(ellipse 550px 400px at 70% 20%, rgba(91,211,255,0.08), transparent 70%);
  mix-blend-mode: screen;
}

/* SVG edge lines (behind bubbles) */
#nebulaEdges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  overflow: visible;
}

/* Bubble layer */
#nebulaBubbles {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* ============================================================
   BUBBLE — position wrapper
   ============================================================ */

.nb-bubble-pos {
  position: absolute;
  top: 0; left: 0;
  display: grid;
  place-items: center;
  pointer-events: auto;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

/* Inner visual sphere */
.nb-bubble {
  position: relative;
  border-radius: 50%;
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  transform: scale(1);
  transition: transform .25s cubic-bezier(.2,.7,.2,1.05);
}

/* Entry pop */
.nb-bubble.is-entering {
  animation: nb-bubbleIgnite 0.55s cubic-bezier(.2,.9,.2,1.3) var(--enter-delay, 0s) both;
}
@keyframes nb-bubbleIgnite {
  0%   { transform: scale(0);    opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

.nb-bubble-pos:hover .nb-bubble { transform: scale(1.06); }
.nb-bubble.is-anchored           { transform: scale(1.12) !important; }

.nb-bubble.is-dimmed {
  filter: saturate(0.35) brightness(0.5);
  transform: scale(0.88) !important;
  transition: filter .4s ease, transform .4s ease;
}

.nb-bubble.is-dying {
  animation: nb-bubbleDie 0.38s ease-in forwards;
}
@keyframes nb-bubbleDie {
  0%   { transform: scale(1);    opacity: 1; }
  100% { transform: scale(0.05); opacity: 0; }
}

/* ---- Outer aura ---- */
.nb-aura {
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    hsla(var(--bub-hue), 90%, 60%, 0.32) 0%,
    hsla(var(--bub-hue), 90%, 55%, 0.10) 40%,
    hsla(var(--bub-hue), 90%, 50%, 0.0) 70%);
  filter: blur(8px);
  opacity: 0.55;
  animation: nb-auraPulse 5.4s ease-in-out infinite;
  animation-delay: var(--phase-outer, 0s);
  pointer-events: none;
}
@keyframes nb-auraPulse {
  0%,100% { transform: scale(0.92); opacity: 0.32; }
  50%     { transform: scale(1.08); opacity: 0.55; }
}

/* ---- Inner shell ---- */
.nb-shell {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%,
    hsla(var(--bub-hue), 95%, 78%, 0.16) 0%,
    hsla(var(--bub-hue), 90%, 45%, 0.08) 45%,
    hsla(var(--bub-hue), 80%, 20%, 0) 75%);
  box-shadow:
    0 0 18px hsla(var(--bub-hue), 95%, 60%, 0.45),
    inset 0 0 12px hsla(var(--bub-hue), 95%, 75%, 0.18);
  animation: nb-shellPulse 2.05s ease-in-out infinite;
  animation-delay: var(--phase-inner, 0s);
  display: grid;
  place-items: center;
}
@keyframes nb-shellPulse {
  0%,100% {
    box-shadow: 0 0 14px hsla(var(--bub-hue),95%,60%,0.35),
                inset 0 0 10px hsla(var(--bub-hue),95%,75%,0.16);
  }
  50% {
    box-shadow: 0 0 26px hsla(var(--bub-hue),95%,65%,0.65),
                inset 0 0 16px hsla(var(--bub-hue),95%,80%,0.28);
  }
}

/* ---- Sharp rim ring ---- */
.nb-rim {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 1px solid hsla(var(--bub-hue), 95%, 70%, 0.50);
  box-shadow: inset 0 0 0 1px hsla(var(--bub-hue), 100%, 90%, 0.10);
  pointer-events: none;
}

/* ---- Bubble content ---- */
.nb-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  width: 100%; height: 100%;
  color: hsl(var(--bub-hue), 100%, 92%);
  font-family: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  z-index: 2;
}
.nb-icon {
  color: hsl(var(--bub-hue), 100%, 82%);
  filter: drop-shadow(0 0 6px hsla(var(--bub-hue), 95%, 65%, 0.5));
  line-height: 1;
}
.nb-label {
  margin-top: 5px;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  max-width: 88%;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ---- Child bubble (specialization) ---- */
.nb-child-label {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: hsl(var(--bub-hue), 100%, 90%);
  text-align: center;
  max-width: 86%;
  line-height: 1.2;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ---- Depth tweaks ---- */
.nb-depth-1 .nb-shell {
  box-shadow:
    0 0 22px hsla(var(--bub-hue), 95%, 60%, 0.50),
    inset 0 0 14px hsla(var(--bub-hue), 95%, 80%, 0.20);
}
.nb-depth-2 .nb-aura   { opacity: 0.35; }
.nb-depth-2 .nb-shell {
  box-shadow:
    0 0 12px hsla(var(--bub-hue), 90%, 60%, 0.35),
    inset 0 0 8px hsla(var(--bub-hue), 90%, 75%, 0.14);
  animation-duration: 2.8s;
}

/* Hover accelerates pulse */
.nb-bubble-pos:hover .nb-shell   { animation-duration: 1.2s; }
.nb-bubble-pos:hover .nb-icon    { filter: drop-shadow(0 0 12px hsla(var(--bub-hue),95%,70%,0.85)); }
.nb-bubble.is-anchored .nb-shell { animation-duration: 1.6s; }
.nb-bubble.is-anchored .nb-rim   { border-color: hsla(var(--bub-hue), 95%, 80%, 0.85); }

/* ============================================================
   HINT TEXT (bottom of stage)
   ============================================================ */
.nebula-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 20;
  animation: nb-hintBreath 4s ease-in-out infinite;
  white-space: nowrap;
  font-family: 'Inter Tight', 'Inter', -apple-system, sans-serif;
}
@keyframes nb-hintBreath {
  0%,100% { opacity: 0.35; }
  50%     { opacity: 0.65; }
}

/* Provider count badge (top-right) */
.nebula-count-badge {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 10px;
  color: rgba(255,255,255,0.42);
  font-weight: 600;
  letter-spacing: 0.06em;
  z-index: 20;
  pointer-events: none;
  font-family: 'Inter Tight', 'Inter', -apple-system, sans-serif;
}

/* Centered stage label (shows on hover of category in expanded state) */
.nebula-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: rgba(255,255,255,0.20);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 5;
  font-family: 'Inter Tight', 'Inter', -apple-system, sans-serif;
  transition: opacity 0.3s ease;
}
