/* 
 * animations.css - Performance optimized
 * Animation styles for Code 3Dynamics (code3d.dev)
 * Reduced animation complexity for better performance
 */

/* ==== PERFORMANCE SETTINGS ==== */
.reduce-animations *,
.reduce-animations *::before,
.reduce-animations *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  animation-delay: 0ms !important;
}

.reduce-animations .matrix-rain,
.reduce-animations .printer-animation,
.reduce-animations .scanner-line,
.reduce-animations .digital-noise::before,
.reduce-animations .glitch-overlay::before,
.reduce-animations .circuit-path,
.reduce-animations .particle,
.reduce-animations .floating-element {
  display: none !important;
}

/* ==== ESSENTIAL KEYFRAMES ==== */

/* Optimized floating animation - reduced complexity */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Simplified pulse glow effect */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(0, 249, 255, 0.4); }
  50% { box-shadow: 0 0 15px rgba(0, 249, 255, 0.6); }
}

/* Reduced complexity glitch effect */
@keyframes glitch {
  0%, 100% { transform: none; opacity: 1; }
  33% { transform: translateX(1px); opacity: 0.9; }
  66% { transform: translateX(-1px); opacity: 0.8; }
}

/* Simplified bounce */
@keyframes bounce {
  0%, 100% { transform: translateY(0) translateX(-50%); }
  50% { transform: translateY(-10px) translateX(-50%); }
}

/* ==== OPTIMIZED ANIMATIONS ==== */

/* Simplified floating elements with reduced impact */
.float-1 {
  animation: float 6s ease-in-out infinite;
  will-change: transform;
}

.float-2 {
  animation: float 8s ease-in-out infinite;
  animation-delay: -2s;
  will-change: transform;
}

.float-3 {
  animation: float 10s ease-in-out infinite;
  animation-delay: -4s;
  will-change: transform;
}

/* Pulse glow - hardware accelerated */
.pulse-glow {
  animation: pulse-glow 3s infinite;
  will-change: box-shadow;
}

/* Simplified glitch text effect */
.glitch-text {
  position: relative;
}

.glitch-text.active::before {
  content: attr(data-text);
  position: absolute;
  left: 2px;
  text-shadow: -1px 0 rgba(255, 0, 229, 0.5);
  animation: glitch 3s infinite linear alternate-reverse;
  clip: rect(0, 900px, 0, 0);
  transform: translateZ(0);
}

/* Reduced scanner effect */
.scanner-container {
  position: relative;
  overflow: hidden;
}

.scanner-line {
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(to bottom, rgba(0, 249, 255, 0), rgba(0, 249, 255, 0.5), rgba(0, 249, 255, 0));
  animation: scan-line 3s linear infinite;
  animation-play-state: paused;
  will-change: transform;
}

.scanner-container:hover .scanner-line {
  animation-play-state: running;
}

@keyframes scan-line {
  0% { transform: translateY(0); }
  100% { transform: translateY(200%); }
}

/* Hardware-accelerated parallax card effect */
.parallax-card {
  transform: translate3d(0, 0, 0);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
  will-change: transform;
}

.parallax-card:hover {
  transform: translate3d(0, -10px, 0);
}

/* Optimized fade-in animations with will-change */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}

.fade-in.active {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}

.fade-in-left.active {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}

.fade-in-right.active {
  opacity: 1;
  transform: translateX(0);
}

/* Optimized staggered animations with reduced items */
.stagger-fade-in > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-fade-in.active > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-fade-in.active > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-fade-in.active > *:nth-child(3) { transition-delay: 0.3s; }

.stagger-fade-in.active > * {
  opacity: 1;
  transform: translateY(0);
}

/* Static background fallback for animated backgrounds */
.static-bg {
  background-size: 100px;
  background-image: 
    linear-gradient(to right, rgba(0, 249, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 249, 255, 0.05) 1px, transparent 1px);
}

/* ===== SIMPLIFIED SPECIAL EFFECTS ===== */

/* Simplified cyber button hover */
.cyber-button {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}

.cyber-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(0, 249, 255, 0.2);
  transition: transform 0.5s ease;
  will-change: transform;
}

.cyber-button:hover::before {
  transform: translateX(100%);
}

/* Reduced complexity glitch overlay */
.glitch-overlay {
  position: relative;
  overflow: hidden;
}

.glitch-overlay::before {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 200%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 249, 255, 0.05) 50%,
    transparent 100%
  );
  animation: glitch-overlay 3s linear infinite;
  animation-play-state: paused;
  will-change: transform;
}

.glitch-overlay:hover::before {
  animation-play-state: running;
}

@keyframes glitch-overlay {
  0% { transform: translateY(0); }
  100% { transform: translateY(50%); }
}

/* Reduced digital noise effect */
.digital-noise {
  position: relative;
}

.digital-noise::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDkuMS1jMDAxIDc5LjE0NjI4OTk3NjksIDIwMjMvMDYvMjUtMjM6NTc6MTQgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyNC43IChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkJDMkQ3RjdBRTk3MDExRUVBNEUzOTRFODQwQzk0MTc4IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkJDMkQ3RjdCRTk3MDExRUVBNEUzOTRFODQwQzk0MTc4Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QkMyRDdGNzhFOTcwMTFFRUE0RTM5NEU4NDBDOTQXNT7IiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QkMyRDdGNzlFOTcwMTFFRUE0RTM5NEU4NDBDOTQXNT7IiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5NSaJpAAAAGElEQVR42mL8z8AATDACGB9JggEgwAAxgALaHuaNwQAAAABJRU5ErkJggg==');
  background-size: 10px;
  opacity: 0.03;
  pointer-events: none;
}

/* ===== REDUCED TRANSITION DURATIONS ===== */
:root {
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* ==== MINIMAL PRELOADER ==== */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--midnight-blue);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.preloader.loaded {
  opacity: 0;
  visibility: hidden;
}

/* Simplified spinner */
.cyber-spinner {
  width: 40px;
  height: 40px;
  position: relative;
}

.cyber-spinner-circle {
  position: absolute;
  border: 3px solid transparent;
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  animation: cyber-spin 1s linear infinite;
}

.cyber-spinner-circle:nth-child(1) {
  width: 100%;
  height: 100%;
}

.cyber-spinner-circle:nth-child(2) {
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
  border-top-color: transparent;
  border-right-color: var(--neon-pink);
}

@keyframes cyber-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}