/* Keyframe Animations */

/* Twinkling stars animation */
@keyframes twinkle {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

/* Shimmer loading effect */
@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Pulse animation for interactive elements */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Glow animation */
@keyframes glow {
  0% { box-shadow: 0 0 5px rgba(121, 152, 254, 0.5); }
  50% { box-shadow: 0 0 20px rgba(121, 152, 254, 0.8); }
  100% { box-shadow: 0 0 5px rgba(121, 152, 254, 0.5); }
}

/* Floating animation */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

/* Rotate animation */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Fade in up animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in left animation */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade in right animation */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Draw line animation */
@keyframes drawLine {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Chart segment animation */
@keyframes drawSegment {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Timeline dot pulse */
@keyframes timelinePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(121, 152, 254, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(121, 152, 254, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(121, 152, 254, 0);
  }
}

/* Gradient shift animation */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Animation Classes */

/* Basic animations */
.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite alternate;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-rotate {
  animation: rotate 2s linear infinite;
}

.animate-shimmer {
  animation: shimmer 1.5s infinite;
}

/* Entrance animations */
.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease-out;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.6s ease-out;
}

/* Staggered animations */
.animate-stagger-1 {
  animation-delay: 0.1s;
}

.animate-stagger-2 {
  animation-delay: 0.2s;
}

.animate-stagger-3 {
  animation-delay: 0.3s;
}

.animate-stagger-4 {
  animation-delay: 0.4s;
}

.animate-stagger-5 {
  animation-delay: 0.5s;
}

.animate-stagger-6 {
  animation-delay: 0.6s;
}

/* Chart animations */
.chart-segment {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawSegment 1s ease-out forwards;
}

.chart-segment-1 { animation-delay: 0.1s; }
.chart-segment-2 { animation-delay: 0.2s; }
.chart-segment-3 { animation-delay: 0.3s; }
.chart-segment-4 { animation-delay: 0.4s; }
.chart-segment-5 { animation-delay: 0.5s; }
.chart-segment-6 { animation-delay: 0.6s; }

/* Timeline animations */
.timeline-dot-active {
  animation: timelinePulse 2s infinite;
}

/* Connection line animations */
.connection-line {
  stroke-dasharray: 10, 5;
  stroke-dashoffset: 0;
  animation: drawLine 2s ease-out;
}

/* Hover animations */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.hover-scale {
  transition: transform 0.3s ease;
}

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

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(121, 152, 254, 0.5);
}

/* Loading animations */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--color-primary-blue);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '';
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Scroll-triggered animations */
.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.6s ease;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s ease;
}

.scroll-reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s ease;
}

.scroll-reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s ease;
}

.scroll-reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Parallax effect */
.parallax {
  transform: translateZ(0);
  transition: transform 0.1s ease-out;
}

/* Typewriter effect */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--color-primary-blue);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

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

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

/* Gradient animation */
.animated-gradient {
  background: linear-gradient(-45deg, #7998FE, #4C76FE, #1F54FE, #7998FE);
  background-size: 400% 400%;
  animation: gradientShift 4s ease infinite;
}

/* Performance optimizations */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .parallax {
    transform: none !important;
  }
  
  .typewriter {
    animation: none;
    border-right: none;
    white-space: normal;
  }
}

/* High performance mode for older devices */
@media (max-width: 768px) {
  .animate-float,
  .animate-glow,
  .animated-gradient {
    animation: none;
  }
  
  .hover-lift:hover,
  .hover-scale:hover {
    transform: none;
  }
}

/* Print mode - disable all animations */
@media print {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
