/* ================================================
   Knowledge Center — Dark Space Theme Styles
   ================================================ */

/* --- Space Travel Overlay --- */
#space-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#space-overlay .stars-layer {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  will-change: transform, opacity;
}

#space-overlay .stars-small {
  background-image:
    radial-gradient(1px 1px at 15px 25px, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 55px 65px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 80px 18px, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 35px 82px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 68px 42px, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 8px 70px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 92px 55px, rgba(255,255,255,0.7), transparent);
  background-size: 100px 100px;
  animation: warpStars 0.7s linear infinite;
}

#space-overlay .stars-medium {
  background-image:
    radial-gradient(1.5px 1.5px at 30px 40px, rgba(200,220,255,0.8), transparent),
    radial-gradient(1.5px 1.5px at 90px 20px, rgba(200,220,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 60px 110px, rgba(200,220,255,0.9), transparent),
    radial-gradient(1.5px 1.5px at 140px 70px, rgba(200,220,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 20px 130px, rgba(200,220,255,0.8), transparent);
  background-size: 160px 160px;
  animation: warpStars 1s linear infinite;
  animation-delay: 0.1s;
}

#space-overlay .stars-large {
  background-image:
    radial-gradient(2px 2px at 50px 80px, rgba(180,200,255,0.9), transparent),
    radial-gradient(2.5px 2.5px at 180px 40px, rgba(180,200,255,0.7), transparent),
    radial-gradient(2px 2px at 100px 180px, rgba(180,200,255,0.8), transparent);
  background-size: 240px 240px;
  animation: warpStars 1.3s linear infinite;
  animation-delay: 0.2s;
}

@keyframes warpStars {
  0% {
    transform: scale(1);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

#space-overlay .overlay-title {
  position: relative;
  z-index: 10;
  opacity: 0;
  animation: fadeInTitle 0.8s ease-out 0.5s forwards;
}

@keyframes fadeInTitle {
  to { opacity: 1; }
}

#space-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease-out;
  pointer-events: none;
}

/* --- Reduced Motion: skip animation entirely --- */
@media (prefers-reduced-motion: reduce) {
  #space-overlay {
    display: none !important;
  }
}

/* ================================================
   Dark Nav / Header Overrides (scoped to .kc-page)
   ================================================ */
.kc-page header {
  background: rgba(10, 22, 40, 0.95) !important;
  border-bottom-color: #1e293b !important;
}

.kc-page header a.nav-link {
  color: #cbd5e1 !important;
}

.kc-page header a.nav-link:hover {
  color: #60a5fa !important;
}

.kc-page header a.nav-link.active,
.kc-page header a.kc-active {
  color: #60a5fa !important;
  border-bottom-color: #60a5fa !important;
}

.kc-page header button {
  color: #cbd5e1 !important;
}

.kc-page header button:hover {
  color: #60a5fa !important;
}

.kc-page .mobile-nav {
  background-color: #0a1628 !important;
  background: #0a1628 !important;
  opacity: 1 !important;
}

.kc-page .mobile-nav:not(.hidden) {
  opacity: 1 !important;
  visibility: visible !important;
}

.kc-page .mobile-nav a {
  color: #cbd5e1 !important;
}

.kc-page .mobile-nav a:hover {
  color: #60a5fa !important;
}

.kc-page .mobile-nav .border-b {
  border-color: #1e293b !important;
}

.kc-page .mobile-nav button {
  color: #cbd5e1 !important;
}

.kc-page .mobile-nav button:hover {
  color: #60a5fa !important;
}

.kc-page header img {
  filter: invert(1) brightness(1.8);
}

.kc-page .mobile-nav img {
  filter: invert(1) brightness(1.8);
}

/* ================================================
   Ambient Star Background (persists behind content)
   ================================================ */
.kc-ambient-stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 120px 80px, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 350px 200px, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 580px 120px, rgba(255,255,255,0.25), transparent),
    radial-gradient(1px 1px at 200px 350px, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 480px 300px, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 50px 420px, rgba(255,255,255,0.2), transparent),
    radial-gradient(1.5px 1.5px at 700px 180px, rgba(200,220,255,0.2), transparent),
    radial-gradient(1.5px 1.5px at 300px 500px, rgba(200,220,255,0.15), transparent);
  background-size: 800px 600px;
  animation: driftStars 60s linear infinite;
}

@keyframes driftStars {
  from { background-position: 0 0; }
  to { background-position: 800px 600px; }
}

/* ================================================
   Glowing Cards
   ================================================ */
.kc-glow-card {
  position: relative;
  border-radius: 16px;
  padding: 2px;
  background: linear-gradient(135deg, #1e40af, #10b981, #1e40af);
  background-size: 200% 200%;
  animation: glowBorder 6s ease-in-out infinite;
}

.kc-glow-card-inner {
  background: #111827;
  border-radius: 14px;
  padding: 2rem;
  height: 100%;
}

@keyframes glowBorder {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.kc-glow-card:hover {
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.3), 0 0 60px rgba(16, 185, 129, 0.15);
}

/* ================================================
   Timeline Connector
   ================================================ */
.kc-timeline {
  position: relative;
}

.kc-timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, #1e40af, #10b981, #1e40af, transparent);
  transform: translateX(-50%);
  animation: timelinePulse 3s ease-in-out infinite;
}

@keyframes timelinePulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@media (max-width: 1023px) {
  .kc-timeline::before {
    left: 24px;
    transform: none;
  }
}

.kc-timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1e40af;
  border: 3px solid #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

@media (max-width: 1023px) {
  .kc-timeline-dot {
    left: 24px;
    transform: translateX(-50%);
  }
}

/* ================================================
   Platform Pill Badges
   ================================================ */
.kc-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(30, 64, 175, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
}

.kc-pill:hover {
  background: rgba(30, 64, 175, 0.4);
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* ================================================
   Connected Stack Constellation
   ================================================ */
.kc-constellation {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1;
  margin: 0 auto;
}

.kc-node {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  background: #111827;
  border: 2px solid #1e40af;
  transition: all 0.4s ease;
  z-index: 2;
  text-decoration: none;
}

.kc-node:hover {
  transform: scale(1.15);
  border-color: #10b981;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.5);
  color: white;
}

.kc-node-center {
  width: 120px;
  height: 120px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #1e3a5f, #1e40af);
  border-color: #10b981;
  font-size: 0.875rem;
  box-shadow: 0 0 30px rgba(30, 64, 175, 0.4);
}

.kc-node-center:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

/* Orbital positions (percentage-based for responsiveness) */
.kc-node-1 { left: 50%; top: 2%; transform: translate(-50%, 0); }
.kc-node-2 { left: 88%; top: 28%; transform: translate(-50%, 0); }
.kc-node-3 { left: 80%; top: 70%; transform: translate(-50%, 0); }
.kc-node-4 { left: 50%; top: 88%; transform: translate(-50%, 0); }
.kc-node-5 { left: 12%; top: 28%; transform: translate(-50%, 0); }
.kc-node-6 { left: 20%; top: 70%; transform: translate(-50%, 0); }

/* Hover states for orbital nodes */
.kc-node-1:hover { transform: translate(-50%, 0) scale(1.15); }
.kc-node-2:hover { transform: translate(-50%, 0) scale(1.15); }
.kc-node-3:hover { transform: translate(-50%, 0) scale(1.15); }
.kc-node-4:hover { transform: translate(-50%, 0) scale(1.15); }
.kc-node-5:hover { transform: translate(-50%, 0) scale(1.15); }
.kc-node-6:hover { transform: translate(-50%, 0) scale(1.15); }

.kc-constellation svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.kc-constellation svg line {
  stroke: #1e40af;
  stroke-width: 1;
  opacity: 0.4;
  transition: opacity 0.3s;
}

/* Mobile: stack constellation nodes vertically */
@media (max-width: 639px) {
  .kc-constellation {
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 200px;
  }

  .kc-constellation svg { display: none; }

  .kc-node {
    position: static !important;
    transform: none !important;
  }

  .kc-node:hover {
    transform: scale(1.1) !important;
  }

  .kc-node-center {
    order: -1;
  }
}

/* ================================================
   Section Backgrounds
   ================================================ */
.kc-hero-bg {
  background: linear-gradient(180deg, #050a15 0%, #0a1628 50%, #0d1f3c 100%);
}

.kc-section-dark {
  background: #050a15;
}

.kc-section-darker {
  background: #020617;
}

.kc-cta-bg {
  background: linear-gradient(135deg, #0d1f3c 0%, #064e3b 50%, #0d1f3c 100%);
}

/* ================================================
   Stage Number Badge
   ================================================ */
.kc-stage-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', monospace;
  font-size: 0.875rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1e40af, #10b981);
  color: white;
  flex-shrink: 0;
}

/* ================================================
   Value Prop Icon Glow
   ================================================ */
.kc-icon-glow {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 64, 175, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* ================================================
   Platform Connector Cards (reused in Constellation)
   ================================================ */
.kc-connector-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 1.25rem;
  transition: all 0.3s ease;
}

.kc-connector-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: #334155;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.15);
}

/* ================================================
   Self-Assessment Quiz
   ================================================ */
.kc-quiz-question {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid #1e293b;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  transition: all 0.3s ease;
}

.kc-quiz-question:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: #334155;
}

.kc-quiz-toggle {
  padding: 6px 20px;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  cursor: pointer;
  transition: all 0.3s ease;
}

.kc-quiz-toggle:hover {
  color: #e2e8f0;
  border-color: #475569;
}

.kc-quiz-toggle.selected {
  background: linear-gradient(135deg, #1e40af, #059669);
  color: white;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.kc-quiz-result {
  animation: quizReveal 0.5s ease-out;
}

@keyframes quizReveal {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
