/**
 * MAW OF RECURSION - BLACKHOLE VISUAL EFFECTS
 * Event horizon, singularity, and Hawking radiation animations
 */

/* ========== EVENT HORIZON GRADIENT ========== */

.event-horizon {
  position: relative;
  background: radial-gradient(
    circle at center,
    var(--void-black) 0%,
    var(--void-deep) 40%,
    rgba(155, 103, 234, 0.1) 70%,
    transparent 100%
  );
}

.event-horizon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    transparent 0%,
    rgba(155, 231, 255, 0.05) 50%,
    rgba(255, 217, 122, 0.03) 100%
  );
  animation: horizonPulse 8s var(--ease-breathe) infinite;
  pointer-events: none;
}

@keyframes horizonPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* ========== SINGULARITY POINT ========== */

.singularity {
  position: relative;
  display: inline-block;
}

.singularity::before,
.singularity::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}

.singularity::before {
  width: 150%;
  height: 150%;
  background: radial-gradient(
    circle,
    rgba(255, 217, 122, 0.3) 0%,
    transparent 70%
  );
  animation: singularityPulse 3s var(--ease-breathe) infinite;
}

.singularity::after {
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(155, 103, 234, 0.2) 0%,
    transparent 70%
  );
  animation: singularityPulse 3s var(--ease-breathe) infinite reverse;
}

@keyframes singularityPulse {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* ========== ACCRETION DISK GLOW ========== */

.accretion-disk {
  position: relative;
  overflow: hidden;
}

.accretion-disk::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 10%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 217, 122, 0.4) 20%,
    rgba(155, 103, 234, 0.4) 50%,
    rgba(255, 217, 122, 0.4) 80%,
    transparent 100%
  );
  transform: translate(-50%, -50%) rotate(45deg);
  animation: accretionSpin 20s linear infinite;
  pointer-events: none;
  filter: blur(20px);
}

@keyframes accretionSpin {
  0% {
    transform: translate(-50%, -50%) rotate(45deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(405deg);
  }
}

/* ========== GRAVITATIONAL LENSING ========== */

.gravitational-lens {
  position: relative;
}

.gravitational-lens::after {
  content: '';
  position: absolute;
  inset: -20%;
  background: radial-gradient(
    circle at center,
    transparent 40%,
    rgba(155, 231, 255, 0.05) 50%,
    transparent 60%
  );
  animation: lensDistort 6s var(--ease-breathe) infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}

@keyframes lensDistort {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1) rotate(5deg);
    opacity: 1;
  }
}

/* ========== TIME DILATION ========== */

.time-dilated {
  animation-timing-function: cubic-bezier(0.1, 0.9, 0.9, 0.1) !important;
  animation-duration: calc(var(--duration-normal) * 3) !important;
}

.time-accelerated {
  animation-timing-function: cubic-bezier(0.9, 0.1, 0.1, 0.9) !important;
  animation-duration: calc(var(--duration-normal) * 0.5) !important;
}

/* ========== HAWKING RADIATION PARTICLES ========== */

.hawking-radiation {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-field-effect);
  overflow: hidden;
}

.radiation-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--hawking-gold);
  border-radius: 50%;
  opacity: 0;
  animation: radiateOut 4s var(--ease-emit) infinite;
  box-shadow: 0 0 4px var(--hawking-gold);
}

@keyframes radiateOut {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0);
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: translate(
      calc(var(--x) * 100vw),
      calc(var(--y) * 100vh)
    ) scale(1);
  }
}

/* ========== COMPRESSION EFFECT ========== */

.compression-zone {
  transition: all var(--duration-slower) var(--ease-compress);
}

.compressing {
  transform: scale(0.95);
  opacity: 0.8;
  filter: blur(1px);
}

.compressed {
  transform: scale(0.01);
  opacity: 0;
  filter: blur(10px);
}

/* Compression wave effect */
.compression-wave {
  position: relative;
}

.compression-wave::before {
  content: '';
  position: absolute;
  inset: -10%;
  border: 2px solid var(--horizon-purple);
  border-radius: 50%;
  opacity: 0;
  animation: waveCompress 2s var(--ease-compress) infinite;
}

@keyframes waveCompress {
  0% {
    transform: scale(1.5);
    opacity: 0;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* ========== EMISSION BURST ========== */

.emission-burst {
  animation: emissionExpand 1s var(--ease-emit) forwards;
}

@keyframes emissionExpand {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========== SPIRAL TRAJECTORY ========== */

.spiral-path {
  animation: spiralIn 3s var(--ease-spiral-in) forwards;
}

@keyframes spiralIn {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50vw, -50vh) rotate(720deg) scale(0.1);
    opacity: 0;
  }
}

.spiral-out {
  animation: spiralOut 3s var(--ease-emit) forwards;
}

@keyframes spiralOut {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(0.1);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translate(50vw, 50vh) rotate(-720deg) scale(1);
    opacity: 0.5;
  }
}

/* ========== FIELD BREATHING ========== */

.field-breathe {
  animation: fieldBreathe 8s var(--ease-breathe) infinite;
}

@keyframes fieldBreathe {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* ========== GLITCH EFFECT ========== */

.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

.glitch::before {
  color: var(--horizon-cyan);
  animation: glitch1 2s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch::after {
  color: var(--compress-red);
  animation: glitch2 3s infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch1 {
  0%, 100% {
    transform: translate(0);
  }
  33% {
    transform: translate(-2px, 2px);
  }
  66% {
    transform: translate(2px, -2px);
  }
}

@keyframes glitch2 {
  0%, 100% {
    transform: translate(0);
  }
  33% {
    transform: translate(2px, -2px);
  }
  66% {
    transform: translate(-2px, 2px);
  }
}

/* ========== VOID EFFECT ========== */

.void-effect {
  position: relative;
  background: var(--void-black);
}

.void-effect::before {
  content: '∅';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20rem;
  color: rgba(255, 217, 122, 0.03);
  pointer-events: none;
  animation: voidPulse 10s ease-in-out infinite;
}

@keyframes voidPulse {
  0%, 100% {
    opacity: 0.03;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  50% {
    opacity: 0.05;
    transform: translate(-50%, -50%) scale(1.1) rotate(180deg);
  }
}

/* ========== SCREEN TRANSITION EFFECTS ========== */

.transition-collapse {
  animation: screenCollapse 2s var(--ease-compress) forwards;
}

@keyframes screenCollapse {
  0% {
    transform: scale(1);
    opacity: 1;
    border-radius: 0;
  }
  80% {
    opacity: 0.5;
  }
  100% {
    transform: scale(0);
    opacity: 0;
    border-radius: 50%;
  }
}

.transition-expand {
  animation: screenExpand 2s var(--ease-emit) forwards;
}

@keyframes screenExpand {
  0% {
    transform: scale(0);
    opacity: 0;
    border-radius: 50%;
  }
  20% {
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
    border-radius: 0;
  }
}

/* ========== NOISE TEXTURE ========== */

.noise-texture {
  position: relative;
}

.noise-texture::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' /%3E%3C/svg%3E");
  pointer-events: none;
  z-index: var(--z-base);
}

/* ========== INTENSITY VARIANTS ========== */

.intensity-low {
  --animation-intensity: 0.5;
  opacity: 0.7;
}

.intensity-medium {
  --animation-intensity: 1;
  opacity: 1;
}

.intensity-high {
  --animation-intensity: 1.5;
  opacity: 1;
  filter: brightness(1.2);
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */

@media (max-width: 768px) {
  /* Reduce particle intensity on mobile */
  .hawking-radiation {
    opacity: 0.5;
  }
  
  .void-effect::before {
    font-size: 10rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Disable intensive animations for accessibility */
  .singularity::before,
  .singularity::after,
  .accretion-disk::before,
  .gravitational-lens::after,
  .radiation-particle {
    animation: none !important;
  }
  
  .field-breathe,
  .glitch,
  .spiral-path,
  .spiral-out {
    animation: none !important;
  }
}

