/*
  Kernex Doctrine hero recursive decomposition animation.
  Scope: #kx-recursive-hero-visual only.
  No navbar, translation, route, DB, Cancer animation, or global page behavior changes.
*/

#kx-recursive-hero-visual {
  position: relative;
  min-height: 470px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(245, 166, 35, 0.22);
  background:
    radial-gradient(circle at 16% 48%, rgba(245, 166, 35, 0.18), transparent 20%),
    radial-gradient(circle at 78% 35%, rgba(31, 210, 255, 0.13), transparent 32%),
    linear-gradient(135deg, rgba(31, 17, 10, 0.94), rgba(6, 13, 18, 0.96));
  box-shadow:
    inset 0 0 60px rgba(245, 166, 35, 0.05),
    inset 0 0 80px rgba(31, 210, 255, 0.04);
}

#kx-recursive-hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(245, 166, 35, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 210, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.42;
  mask-image: radial-gradient(circle at 52% 50%, black, transparent 82%);
  pointer-events: none;
}

#kx-recursive-hero-visual::after {
  content: "";
  position: absolute;
  left: 42px;
  top: 122px;
  width: 145px;
  height: 145px;
  border-radius: 999px;
  border: 1px solid rgba(245, 166, 35, 0.26);
  box-shadow:
    0 0 40px rgba(245, 166, 35, 0.12),
    inset 0 0 35px rgba(245, 166, 35, 0.08);
  animation: kxOrbitPulse 4s ease-in-out infinite;
  pointer-events: none;
}

.kx-rd-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.kx-rd-line {
  stroke: rgba(210, 244, 255, 0.72);
  stroke-width: 2;
  fill: none;
  opacity: 0.10;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  filter: drop-shadow(0 0 3px rgba(31, 210, 255, 0.10));
  transition: opacity 0.35s ease, stroke-dashoffset 0.9s ease, stroke-width 0.35s ease;
}

.kx-rd-line.is-lit {
  opacity: 0.88;
  stroke-dashoffset: 0;
  stroke-width: 2.35;
  filter: drop-shadow(0 0 7px rgba(31, 210, 255, 0.32));
}

.kx-rd-line.kx-gold {
  stroke: rgba(255, 196, 78, 0.82);
  filter: drop-shadow(0 0 5px rgba(245, 166, 35, 0.20));
}

.kx-rd-node {
  opacity: 0.20;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.35s ease, filter 0.35s ease;
}

.kx-rd-node .node-shape {
  fill: rgba(8, 12, 16, 0.78);
  stroke: rgba(255, 225, 157, 0.64);
  stroke-width: 2;
}

.kx-rd-node .node-label {
  fill: rgba(255, 250, 238, 0.82);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  font-weight: 850;
  dominant-baseline: middle;
  text-anchor: middle;
}

.kx-rd-node.kx-reality .node-shape {
  fill: rgba(245, 166, 35, 0.10);
  stroke: rgba(255, 202, 91, 0.90);
  stroke-width: 2.5;
}

.kx-rd-node.kx-leaf .node-shape {
  stroke: rgba(98, 226, 255, 0.78);
  fill: rgba(10, 21, 29, 0.84);
}

.kx-rd-node.is-visible {
  opacity: 1;
  filter:
    drop-shadow(0 0 8px rgba(255, 202, 91, 0.30))
    drop-shadow(0 0 12px rgba(31, 210, 255, 0.12));
}

.kx-rd-node.is-exploding {
  animation: kxNodeExplode 0.82s cubic-bezier(.2,.9,.18,1.15);
}

.kx-rd-node.is-current .node-shape {
  stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(255, 202, 91, 0.55));
}

.kx-rd-particle {
  opacity: 0;
  fill: rgba(255, 225, 125, 0.95);
  transform-box: fill-box;
  transform-origin: center;
}

.kx-rd-node.is-exploding .kx-rd-particle {
  animation: kxParticleBurst 0.82s ease-out;
}

.kx-rd-particle.p2 { animation-delay: 0.03s; fill: rgba(31, 210, 255, 0.95); }
.kx-rd-particle.p3 { animation-delay: 0.06s; }
.kx-rd-particle.p4 { animation-delay: 0.09s; fill: rgba(31, 210, 255, 0.95); }

.kx-rd-caption {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 28px;
  z-index: 4;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(5, 5, 6, 0.62);
  backdrop-filter: blur(10px);
}

.kx-rd-caption strong {
  display: block;
  color: #ffe39a;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.kx-rd-caption span {
  display: block;
  color: rgba(255, 246, 231, 0.66);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 8px;
}

.kx-rd-step-badge {
  position: absolute;
  top: 24px;
  left: 28px;
  z-index: 5;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid rgba(245, 166, 35, 0.30);
  color: #ffe39a;
  background: rgba(245, 166, 35, 0.08);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.kx-rd-controls {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 6;
  display: flex;
  gap: 8px;
}

.kx-rd-controls button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(255,246,231,0.88);
  font-weight: 850;
  font-size: 12px;
  cursor: pointer;
}

.kx-rd-controls button:hover {
  border-color: rgba(245, 166, 35, 0.52);
  background: rgba(245, 166, 35, 0.14);
}

@keyframes kxNodeExplode {
  0% { transform: scale(0.92); }
  45% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

@keyframes kxParticleBurst {
  0% { opacity: 0; transform: scale(0.35) translate(0, 0); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.1) translate(var(--px), var(--py)); }
}

@keyframes kxOrbitPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 0.95; }
}

@media (max-width: 900px) {
  #kx-recursive-hero-visual {
    min-height: 520px;
  }

  .kx-rd-caption {
    left: 18px;
    right: 18px;
    bottom: 18px;
  }

  .kx-rd-controls {
    top: auto;
    bottom: 118px;
    right: 18px;
  }
}
