/* ==========================================
   Keiden Myrai - Animations & Effects
   Electrical & Tech-Inspired Animations
   ========================================== */

/* ==========================================
   Keyframe Animations
   ========================================== */

/* Electric Pulse */
@keyframes electricPulse {
  0%, 100% {
    box-shadow: 0 0 5px rgba(0, 191, 255, 0.3),
                0 0 10px rgba(0, 191, 255, 0.2),
                0 0 15px rgba(0, 191, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.5),
                0 0 20px rgba(0, 191, 255, 0.3),
                0 0 30px rgba(0, 191, 255, 0.2);
  }
}

/* Glow Pulse */
@keyframes glowPulse {
  0%, 100% {
    text-shadow: 0 0 5px rgba(0, 191, 255, 0.5);
  }
  50% {
    text-shadow: 0 0 20px rgba(0, 191, 255, 0.8),
                 0 0 30px rgba(0, 191, 255, 0.6);
  }
}

/* Float Animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Slide In from Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In from Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In from Bottom */
@keyframes slideInBottom {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Rotate In */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

/* Shimmer Effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Circuit Line Animation */
@keyframes circuitFlow {
  0% {
    stroke-dashoffset: 1000;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Glitch Effect */
@keyframes glitch {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(0);
  }
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bounce */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

/* ==========================================
   Electrical Effects
   ========================================== */

/* Electric Border Animation */
.electric-border-animated {
  position: relative;
  border: 1px solid rgba(0, 191, 255, 0.3);
  animation: electricPulse 3s infinite;
}

.electric-border-animated::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    transparent 30%,
    rgba(0, 191, 255, 0.3) 50%,
    transparent 70%
  );
  background-size: 200% 200%;
  animation: shimmer 3s linear infinite;
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

.electric-border-animated:hover::before {
  opacity: 1;
}

/* Glowing Text */
.glow-text-animated {
  animation: glowPulse 2s infinite;
}

/* Electric Line */
.electric-line {
  height: 2px;
  background: linear-gradient(90deg, 
    transparent,
    var(--accent-primary),
    transparent
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

/* Spark Effect */
.spark {
  position: relative;
}

.spark::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: var(--accent-electric-blue);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-electric-blue);
  opacity: 0;
  animation: sparkBurst 1s infinite;
}

@keyframes sparkBurst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0);
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3);
  }
}

/* ==========================================
   Interactive Hover Effects
   ========================================== */

/* Card Lift on Hover */
.card-hover-lift {
  transition: all 0.3s ease;
}

.card-hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 30px rgba(0, 191, 255, 0.3);
}

/* Button Glow on Hover */
.btn-glow:hover {
  box-shadow: 0 0 20px rgba(0, 191, 255, 0.6),
              0 0 30px rgba(0, 191, 255, 0.4),
              0 0 40px rgba(0, 191, 255, 0.2);
}

/* Link Underline Animation */
.link-animated {
  position: relative;
  display: inline-block;
}

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

.link-animated:hover::after {
  width: 100%;
}

/* Icon Spin on Hover */
.icon-spin:hover {
  animation: spin 0.5s ease-in-out;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================
   Loading Animations
   ========================================== */

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 191, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Dot Pulse Loading */
.dot-pulse {
  display: flex;
  gap: 8px;
}

.dot-pulse span {
  width: 10px;
  height: 10px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: dotPulse 1.4s infinite ease-in-out both;
}

.dot-pulse span:nth-child(1) {
  animation-delay: -0.32s;
}

.dot-pulse span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ==========================================
   Scroll Animations
   ========================================== */

/* Fade In on Scroll */
.fade-in-scroll {
  opacity: 0;
  animation: fadeInUp 0.8s forwards;
}

/* Slide In on Scroll */
.slide-in-left {
  opacity: 0;
  animation: slideInLeft 0.8s forwards;
}

.slide-in-right {
  opacity: 0;
  animation: slideInRight 0.8s forwards;
}

.slide-in-bottom {
  opacity: 0;
  animation: slideInBottom 0.8s forwards;
}

/* Scale In on Scroll */
.scale-in {
  opacity: 0;
  animation: scaleIn 0.6s forwards;
}

/* ==========================================
   Background Animations
   ========================================== */

/* Gradient Animation */
.gradient-animated {
  background: linear-gradient(
    135deg,
    var(--base-black),
    var(--base-gray),
    var(--base-black)
  );
  background-size: 200% 200%;
  animation: gradientShift 10s ease infinite;
}

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

/* Particle Effect Background */
.particles-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none; /* Allow clicks to pass through to content below */
}

/* ==========================================
   Tech/Circuit Patterns
   ========================================== */

/* Circuit Board Pattern */
.circuit-pattern {
  position: relative;
  overflow: hidden;
}

.circuit-pattern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(90deg, rgba(0, 191, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(0, 191, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.5;
  z-index: -1;
}

/* Neural Network Lines */
.neural-lines {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0.1;
  pointer-events: none; /* Allow clicks to pass through */
}

.neural-lines svg {
  width: 100%;
  height: 100%;
}

.neural-lines path {
  stroke: var(--accent-primary);
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 1000;
  animation: circuitFlow 5s linear infinite;
}

/* ==========================================
   Delay Classes for Staggered Animations
   ========================================== */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* ==========================================
   Parallax Effect
   ========================================== */
.parallax {
  transform: translateY(calc(var(--scroll) * 0.5px));
}

.parallax-slow {
  transform: translateY(calc(var(--scroll) * 0.3px));
}

.parallax-fast {
  transform: translateY(calc(var(--scroll) * 0.7px));
}

/* ==========================================
   Utility Animation Classes
   ========================================== */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-bounce {
  animation: bounce 2s infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.hover-grow:hover {
  transform: scale(1.05);
}

.hover-shrink:hover {
  transform: scale(0.95);
}

/* ==========================================
   Progress Bar Animations
   ========================================== */
.progress-bar {
  position: relative;
  height: 8px;
  background: rgba(0, 191, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, 
    var(--secondary-electric-blue),
    var(--accent-primary),
    var(--accent-electric-blue)
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* ==========================================
   Typing Effect
   ========================================== */
.typing {
  overflow: hidden;
  border-right: 2px solid var(--accent-primary);
  white-space: nowrap;
  animation: typing 3.5s steps(40) 1s 1 normal both,
             blink 0.75s step-end infinite;
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--accent-primary);
  }
}

