/* 
 * Metallura Website - Modern Animations & Motion Design
 * Advanced animations, micro-interactions, and scroll-based effects
 */

/* ============================================
   ADVANCED KEYFRAME ANIMATIONS
   ============================================ */

@keyframes heroGlow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(212, 130, 42, 0.3);
  }
  50% {
    text-shadow: 0 0 40px rgba(212, 130, 42, 0.5), 0 0 60px rgba(212, 130, 42, 0.3);
  }
}

@keyframes floatingCard {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes slideInFromLeft {
  0% {
    transform: translateX(-100px);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  0% {
    transform: translateX(100px);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromBottom {
  0% {
    transform: translateY(100px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInFromTop {
  0% {
    transform: translateY(-100px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes scaleInBounce {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes rotateIn {
  0% {
    transform: rotate(-200deg) scale(0);
    opacity: 0;
  }
  100% {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes counterIncrement {
  0% {
    transform: translateY(100%);
  }
  100% {
    transform: translateY(0%);
  }
}

@keyframes progressBar {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

@keyframes typewriter {
  0% {
    width: 0ch;
  }
  100% {
    width: 100%;
  }
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

@keyframes morphShape {
  0%, 100% {
    border-radius: var(--radius-xl);
  }
  25% {
    border-radius: var(--radius-full);
  }
  50% {
    border-radius: var(--radius-sm);
  }
  75% {
    border-radius: var(--radius-2xl);
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes particleFloat {
  0%, 100% {
    transform: translateY(0px) translateX(0px) rotate(0deg);
    opacity: 0.7;
  }
  25% {
    transform: translateY(-20px) translateX(10px) rotate(90deg);
    opacity: 1;
  }
  50% {
    transform: translateY(-40px) translateX(20px) rotate(180deg);
    opacity: 0.8;
  }
  75% {
    transform: translateY(-20px) translateX(10px) rotate(270deg);
    opacity: 1;
  }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes magneticPull {
  0% {
    transform: translateX(0) translateY(0);
  }
  100% {
    transform: translateX(var(--mouse-x, 0)) translateY(var(--mouse-y, 0));
  }
}

/* ============================================
   MODERN HOVER EFFECTS
   ============================================ */

/* Magnetic Button Effect */
.magnetic-hover {
  position: relative;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.magnetic-hover::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(212, 130, 42, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
  z-index: -1;
}

.magnetic-hover:hover::before {
  width: 300px;
  height: 300px;
}

/* Shimmer Effect */
.shimmer-effect {
  position: relative;
  overflow: hidden;
}

.shimmer-effect::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.8s ease;
}

.shimmer-effect:hover::before {
  left: 100%;
}

/* 3D Card Tilt Effect */
.tilt-card {
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.tilt-card:hover {
  transform: rotateY(5deg) rotateX(5deg);
}

.tilt-card .card-content {
  transform: translateZ(50px);
  transition: transform 0.3s ease;
}

/* Glowing Border Effect */
.glow-border {
  position: relative;
  border: 2px solid transparent;
  background: linear-gradient(var(--white), var(--white)) padding-box,
              var(--gradient-copper) border-box;
  transition: all 0.3s ease;
}

.glow-border:hover {
  box-shadow: 0 0 20px rgba(212, 130, 42, 0.5), 
              inset 0 0 20px rgba(212, 130, 42, 0.1);
}

/* Morphing Shape Effect */
.morphing-shape {
  transition: border-radius 0.8s ease;
}

.morphing-shape:hover {
  animation: morphShape 2s ease-in-out infinite;
}

/* Parallax Scroll Effect */
.parallax-element {
  transform: translateZ(0);
  transition: transform 0.1s ease-out;
}

/* ============================================
   SCROLL-BASED ANIMATIONS
   ============================================ */

/* Intersection Observer Animations */
.scroll-animate {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-animate.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered Animation Classes */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.stagger-children.animate-in > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.animate-in > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.animate-in > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.animate-in > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.animate-in > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.animate-in > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-children.animate-in > * {
  opacity: 1;
  transform: translateY(0);
}

/* Progressive Enhancement Animations */
.progressive-blur {
  filter: blur(20px);
  transition: filter 1s ease-out;
}

.progressive-blur.in-view {
  filter: blur(0px);
}

/* ============================================
   MODERN LOADING ANIMATIONS
   ============================================ */

.loading-skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 25%,
    var(--gray-100) 50%,
    var(--gray-200) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--copper);
  animation: loading-dots-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loading-dots-bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Pulse Loading */
.pulse-loader {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-copper);
}

.pulse-loader::before,
.pulse-loader::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--copper);
  animation: pulse-ring 2s linear infinite;
}

.pulse-loader::after {
  animation-delay: 1s;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* ============================================
   MICRO-INTERACTIONS
   ============================================ */

/* Button Ripple Effect */
.ripple-button {
  position: relative;
  overflow: hidden;
}

.ripple-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}

.ripple-button:active::before {
  width: 300px;
  height: 300px;
}

/* Icon Bounce Animation */
.icon-bounce {
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.icon-bounce:hover {
  transform: scale(1.2) rotate(10deg);
}

/* Text Reveal Animation */
.text-reveal {
  position: relative;
  overflow: hidden;
}

.text-reveal::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-copper);
  transition: left 0.8s ease;
  z-index: 1;
}

.text-reveal:hover::before {
  left: 100%;
}

.text-reveal span {
  position: relative;
  z-index: 2;
}

/* Counter Animation */
.animated-counter {
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* Progress Ring */
.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke: var(--gray-200);
  stroke-width: 4;
}

.progress-ring .progress {
  stroke: var(--copper);
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 2s ease-in-out;
}

/* ============================================
   ADVANCED SCROLL ANIMATIONS
   ============================================ */

/* Parallax Sections */
.parallax-section {
  position: relative;
  overflow: hidden;
}

.parallax-bg {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 120%;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* Sticky Reveal Animation */
.sticky-reveal {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticky-reveal .content {
  transform: scale(0.8);
  opacity: 0;
  transition: all 0.8s ease;
}

.sticky-reveal.in-view .content {
  transform: scale(1);
  opacity: 1;
}

/* ============================================
   MODERN PARTICLE SYSTEM
   ============================================ */

.particle-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--copper);
  border-radius: 50%;
  opacity: 0.7;
  animation: particleFloat 8s ease-in-out infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 6s; }
.particle:nth-child(8) { left: 80%; animation-delay: 7s; }
.particle:nth-child(9) { left: 90%; animation-delay: 8s; }

/* ============================================
   MODERN TAB ANIMATIONS
   ============================================ */

.animated-tabs {
  position: relative;
}

.tab-indicator {
  position: absolute;
  bottom: 0;
  height: 3px;
  background: var(--gradient-copper);
  border-radius: var(--radius-full);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.4s ease;
}

.tab-content.active {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   MODERN MODAL ANIMATIONS
   ============================================ */

.modal-backdrop {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-backdrop.show {
  opacity: 1;
}

.modal-content {
  transform: scale(0.8) translateY(-50px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content.show {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ============================================
   MODERN NOTIFICATION ANIMATIONS
   ============================================ */

.notification {
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.notification.show {
  transform: translateX(0);
}

.notification.hide {
  transform: translateX(100%);
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Hardware Acceleration */
.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Reduce motion for accessibility */
@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-element,
  .parallax-bg {
    transform: none !important;
  }
  
  .particle {
    display: none;
  }
}

/* ============================================
   RESPONSIVE ANIMATION ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Reduce animation complexity on mobile */
  .morphing-shape:hover {
    animation: none;
  }
  
  .tilt-card:hover {
    transform: none;
  }
  
  .parallax-bg {
    position: static;
    height: auto;
    transform: none !important;
  }
  
  /* Optimize mobile animations */
  .scroll-animate {
    transform: translateY(20px);
  }
  
  .stagger-children > * {
    transform: translateY(15px);
  }
  
  /* Reduce particle count on mobile */
  .particle:nth-child(n+4) {
    display: none;
  }
}

@media (max-width: 480px) {
  /* Further reduce animations on small screens */
  .magnetic-hover:hover::before {
    width: 150px;
    height: 150px;
  }
  
  .ripple-button:active::before {
    width: 150px;
    height: 150px;
  }
}

/* ============================================
   MODERN FOCUS ANIMATIONS
   ============================================ */

.focus-ring {
  position: relative;
}

.focus-ring:focus::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px solid var(--copper);
  border-radius: inherit;
  animation: focus-pulse 2s ease-in-out infinite;
}

@keyframes focus-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.02);
  }
}
