/* ====================================
   MOTION SYSTEM - Huly-Inspired
   Natural, Performance-Friendly Animations
   ==================================== */

:root {
  /* Motion Duration System */
  --motion-instant: 120ms;
  --motion-fast: 180ms;
  --motion-base: 240ms;
  --motion-smooth: 320ms;
  --motion-slow: 450ms;
  --motion-slowest: 600ms;
  
  /* Custom Easing Functions - Natural Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-gentle: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  
  /* Motion Preferences */
  --motion-distance-sm: 8px;
  --motion-distance-md: 16px;
  --motion-distance-lg: 24px;
  
  /* Glow & Shadow Layers */
  --glow-size: 120px;
  --glow-intensity: 0.15;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ====================================
   SMOOTH SCROLL ENHANCEMENTS
   ==================================== */

/* Remove harsh visual breaks during scrolling */
.section {
  position: relative;
  /* Smooth transition between sections */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Soften section transitions during scroll */
.section + .section {
  /* Remove harsh borders between sections */
  border-top: none;
}

/* Create natural visual flow - static gradient, no animation */
.section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.1) 100%
  );
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
}

/* ====================================
   HERO BACKGROUND EFFECTS
   ==================================== */

.hero::after {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(99, 102, 241, 0.15),
    rgba(139, 92, 246, 0.1) 30%,
    rgba(6, 182, 212, 0.08) 60%,
    transparent 80%
  );
  animation: heroGlowPulse 8s var(--ease-gentle) infinite;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  mix-blend-mode: screen;
  will-change: opacity, transform;
}

@keyframes heroGlowPulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

/* ====================================
   SOFT BACKGROUND LIGHT DRIFT
   Applied to All Sections
   ==================================== */

/* Soft background light — STATIC for performance (no infinite animation) */
.section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(
      circle at 20% 30%,
      rgba(99, 102, 241, 0.08),
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(6, 182, 212, 0.06),
      transparent 50%
    ),
    radial-gradient(
      circle at 50% 50%,
      rgba(139, 92, 246, 0.05),
      transparent 60%
    );
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  mix-blend-mode: screen;
}

@keyframes lightDrift {
  0%, 100% {
    background-position: 0% 0%, 100% 100%, 50% 50%;
    opacity: 0.5;
  }
  25% {
    background-position: 10% 20%, 90% 80%, 60% 40%;
    opacity: 0.7;
  }
  50% {
    background-position: 20% 10%, 80% 90%, 40% 60%;
    opacity: 0.6;
  }
  75% {
    background-position: 15% 25%, 85% 75%, 55% 45%;
    opacity: 0.8;
  }
}

/* Ensure section content appears above background */
.section > * {
  position: relative;
  z-index: 1;
}

/* Different ambient patterns for alternating sections */
.section:nth-child(even)::before {
  opacity: 0.7;
}

@keyframes lightDriftReverse {
  0%, 100% {
    background-position: 100% 100%, 0% 0%, 50% 50%;
    opacity: 0.6;
  }
  33% {
    background-position: 80% 90%, 20% 10%, 60% 40%;
    opacity: 0.8;
  }
  66% {
    background-position: 90% 80%, 10% 20%, 40% 60%;
    opacity: 0.5;
  }
}

/* Stronger drift for dark sections */
.stats::before,
.testimonials::before {
  opacity: 0.9;
  background: 
    radial-gradient(
      circle at 30% 40%,
      rgba(99, 102, 241, 0.12),
      transparent 60%
    ),
    radial-gradient(
      circle at 70% 60%,
      rgba(6, 182, 212, 0.1),
      transparent 60%
    );
}

/* Elevated sections (lighter background) */
.pillars::before,
.case-studies-preview::before {
  opacity: 0.5;
  background: 
    radial-gradient(
      circle at 40% 30%,
      rgba(99, 102, 241, 0.06),
      transparent 55%
    ),
    radial-gradient(
      circle at 60% 70%,
      rgba(139, 92, 246, 0.05),
      transparent 55%
    );
}

/* Animated Noise Texture Overlay */
.hero::before,
.pillars::after,
.testimonials::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  animation: noiseShimmer 1.5s steps(4) infinite;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
}

@keyframes noiseShimmer {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(2%, -2%); }
  50% { transform: translate(-2%, 2%); }
  75% { transform: translate(2%, 1%); }
}

/* Hero Visual Parallax Effect */
.hero-visual {
  transition: transform var(--motion-smooth) var(--ease-gentle);
  will-change: transform;
}

.hero-visual[data-parallax-active] {
  transform: perspective(1000px) 
             rotateX(var(--tilt-x, 0deg)) 
             rotateY(var(--tilt-y, 0deg))
             translateZ(20px);
}

.hero-image-wrapper {
  transition: transform var(--motion-base) var(--ease-gentle);
  will-change: transform;
}

.hero-visual:hover .hero-image-wrapper {
  transform: scale(1.02);
}

/* ====================================
   CARD MICRO-ANIMATIONS
   ==================================== */

.glass-card,
.pillar-card,
.case-card,
.testimonial-card {
  transition: 
    transform var(--motion-base) var(--ease-out-expo),
    box-shadow var(--motion-base) var(--ease-out-expo),
    border-color var(--motion-fast) var(--ease-in-out-smooth),
    background var(--motion-smooth) var(--ease-gentle);
  will-change: transform, box-shadow;
  position: relative;
}

.glass-card::before,
.pillar-card::before,
.case-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, 
    rgba(99, 102, 241, 0) 0%,
    rgba(99, 102, 241, 0.2) 50%,
    rgba(6, 182, 212, 0.15) 100%
  );
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--motion-base) var(--ease-out-expo);
  pointer-events: none;
  z-index: -1;
  filter: blur(8px);
}

.glass-card:hover,
.pillar-card:hover,
.case-card:hover,
.testimonial-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 
    0 12px 24px rgba(0, 0, 0, 0.4),
    0 6px 12px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(99, 102, 241, 0.2);
}

.glass-card:hover::before,
.pillar-card:hover::before,
.case-card:hover::before {
  opacity: 1;
}

/* Card Glow Effect on Hover */
.pillar-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(99, 102, 241, 0.15),
    transparent 70%
  );
  opacity: 0;
  transition: opacity var(--motion-smooth) var(--ease-gentle);
  pointer-events: none;
  border-radius: inherit;
}

.pillar-card:hover::after {
  opacity: 1;
  animation: cardGlowPulse 2s var(--ease-gentle) infinite;
}

@keyframes cardGlowPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ====================================
   BUTTON & CTA ANIMATIONS
   ==================================== */

.btn {
  position: relative;
  overflow: hidden;
  transition: 
    transform var(--motion-fast) var(--ease-out-expo),
    box-shadow var(--motion-base) var(--ease-out-expo);
  will-change: transform;
}

/* Button glow effect */
.btn::after {
  content: '';
  position: absolute;
  inset: -8px;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.4),
    transparent 70%
  );
  border-radius: inherit;
  opacity: 0;
  animation: buttonGlowIdle 3s ease-in-out infinite;
  z-index: -1;
  filter: blur(12px);
  pointer-events: none;
}

@keyframes buttonGlowIdle {
  0%, 100% {
    opacity: 0.1;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.1);
  }
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  opacity: 0;
  transition: opacity var(--motion-base) var(--ease-out-expo);
  z-index: 0;
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
}

.btn:hover::before {
  opacity: 1;
}

.btn:hover::after {
  opacity: 0.6;
  animation: buttonGlowHover 1.5s ease-in-out infinite;
}

@keyframes buttonGlowHover {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.3);
  }
}

.btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: var(--motion-instant);
}

/* Gradient Shift on Hover */
.btn-primary {
  background-size: 200% 200%;
  animation: gradientShift 6s ease infinite;
}

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

.btn-primary:hover {
  animation: gradientShiftFast 1.5s ease infinite;
}

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

/* Outline button glow (cyan accent) */
.btn-outline::after {
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.2),
    transparent 70%
  );
}

/* Special glow class for premium CTAs */
.btn.glow::after {
  animation: buttonGlowPremium 2s ease-in-out infinite;
}

@keyframes buttonGlowPremium {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.2);
  }
}

/* Arrow Icon Slide Animation */
.pillar-cta,
.btn:has(svg) {
  transition: gap var(--motion-base) var(--ease-spring);
}

.pillar-card:hover .pillar-cta {
  gap: var(--space-4);
}

/* Icon Button Ripple Effect */
.social-link,
.mobile-toggle {
  position: relative;
  overflow: visible;
}

/* Social link glow */
.social-link::before {
  content: '';
  position: absolute;
  inset: -6px;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.4),
    transparent 70%
  );
  border-radius: 50%;
  opacity: 0;
  animation: socialGlowIdle 3s ease-in-out infinite;
  z-index: -1;
  filter: blur(10px);
}

@keyframes socialGlowIdle {
  0%, 100% {
    opacity: 0.1;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.1);
  }
}

.social-link:hover::before {
  opacity: 0.6;
  animation: socialGlowHover 1.5s ease-in-out infinite;
}

@keyframes socialGlowHover {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.4);
  }
}

.social-link::after,
.mobile-toggle::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--color-primary);
  border-radius: inherit;
  opacity: 0;
  transform: scale(0.8);
  transition: 
    opacity var(--motion-base) var(--ease-out-expo),
    transform var(--motion-base) var(--ease-out-expo);
}

.social-link:active::after,
.mobile-toggle:active::after {
  opacity: 1;
  transform: scale(1.2);
  transition-duration: var(--motion-slow);
}

/* ====================================
   SCROLL-TRIGGERED ANIMATIONS
   ==================================== */

.fade-in,
.fade-in-left,
.fade-in-right,
.scale-in {
  opacity: 0;
  transition: 
    opacity var(--motion-smooth) var(--ease-out-expo),
    transform var(--motion-smooth) var(--ease-out-expo);
  will-change: opacity, transform;
}

.fade-in {
  transform: translateY(var(--motion-distance-md));
}

.fade-in-left {
  transform: translateX(calc(var(--motion-distance-md) * -1));
}

.fade-in-right {
  transform: translateX(var(--motion-distance-md));
}

.scale-in {
  transform: scale(0.96);
}

.fade-in.visible,
.fade-in-left.visible,
.fade-in-right.visible,
.scale-in.visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Stagger Timing */
.stagger-1 { transition-delay: 80ms; }
.stagger-2 { transition-delay: 160ms; }
.stagger-3 { transition-delay: 240ms; }
.stagger-4 { transition-delay: 320ms; }
.stagger-5 { transition-delay: 400ms; }
.stagger-6 { transition-delay: 480ms; }

/* ====================================
   NAVIGATION ANIMATIONS
   ==================================== */

.header {
  transition: 
    transform var(--motion-base) var(--ease-out-expo),
    background var(--motion-base) var(--ease-gentle),
    box-shadow var(--motion-base) var(--ease-gentle);
  will-change: transform;
}

.header.hide {
  transform: translateY(-100%);
}

.header.show {
  transform: translateY(0);
}

/* Nav Link Underline Animation */
.nav-link {
  position: relative;
  transition: color var(--motion-fast) var(--ease-in-out-smooth);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: 
    width var(--motion-base) var(--ease-out-expo),
    left var(--motion-base) var(--ease-out-expo);
}

.nav-link:hover::after {
  width: 100%;
  left: 0;
}

/* Mobile Menu Slide Animation */
.nav-menu {
  transition: 
    transform var(--motion-smooth) var(--ease-out-expo),
    opacity var(--motion-smooth) var(--ease-out-expo);
}

/* Scroll Progress Indicator */
.scroll-progress {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  z-index: 1001;
  transition: width var(--motion-instant) linear;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* ====================================
   SMOOTH ANCHOR SCROLLING
   ==================================== */

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ====================================
   SECTION TRANSITION EFFECTS
   ==================================== */

.section {
  position: relative;
  transition: background var(--motion-slow) var(--ease-gentle);
}

/* Fade-to-dark transition */
.section.fade-to-dark {
  animation: fadeBackgroundDark var(--motion-slow) var(--ease-gentle) forwards;
}

@keyframes fadeBackgroundDark {
  from { background: var(--color-dark-elevated); }
  to { background: var(--color-dark); }
}

/* Fade-to-light transition */
.section.fade-to-light {
  animation: fadeBackgroundLight var(--motion-slow) var(--ease-gentle) forwards;
}

@keyframes fadeBackgroundLight {
  from { background: var(--color-dark); }
  to { background: var(--color-dark-elevated); }
}

/* ====================================
   ICON & BADGE ANIMATIONS
   ==================================== */

.pillar-icon {
  position: relative;
  transition: 
    transform var(--motion-base) var(--ease-spring),
    background var(--motion-base) var(--ease-gentle);
}

/* Icon Glow Effect - Always Animating */
.pillar-icon::before {
  content: '';
  position: absolute;
  inset: -10px;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.4),
    rgba(139, 92, 246, 0.2) 40%,
    transparent 70%
  );
  border-radius: inherit;
  opacity: 0.3;
  animation: iconGlowPulse 3s ease-in-out infinite;
  z-index: -1;
  filter: blur(12px);
}

@keyframes iconGlowPulse {
  0%, 100% {
    opacity: 0.2;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.1);
  }
}

.pillar-card:hover .pillar-icon {
  transform: scale(1.12) rotate(8deg);
  animation: iconBounce var(--motion-slow) var(--ease-spring);
}

.pillar-card:hover .pillar-icon::before {
  animation: iconGlowPulseFast 1.5s ease-in-out infinite;
}

@keyframes iconGlowPulseFast {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.3);
  }
}

@keyframes iconBounce {
  0%, 100% { transform: scale(1.12) rotate(8deg); }
  50% { transform: scale(1.15) rotate(10deg); }
}

/* Emoji/Icon Inner Glow */
.pillar-icon > * {
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.3));
  animation: iconInnerGlow 4s ease-in-out infinite;
}

@keyframes iconInnerGlow {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.5));
  }
}

/* Badge Pop Animation */
.section-tag,
.case-tag {
  position: relative;
  transition: 
    transform var(--motion-base) var(--ease-spring),
    box-shadow var(--motion-base) var(--ease-out-expo);
}

/* Badge glow effect */
.section-tag::before,
.case-tag::before {
  content: '';
  position: absolute;
  inset: -6px;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.3),
    transparent 70%
  );
  border-radius: inherit;
  opacity: 0;
  animation: badgeGlowSubtle 3s ease-in-out infinite;
  z-index: -1;
  filter: blur(8px);
}

@keyframes badgeGlowSubtle {
  0%, 100% {
    opacity: 0.1;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.1);
  }
}

.section-tag:hover,
.case-tag:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.section-tag:hover::before,
.case-tag:hover::before {
  opacity: 0.6;
  animation: badgeGlowHover 1.5s ease-in-out infinite;
}

@keyframes badgeGlowHover {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.3);
  }
}

/* Case tag uses accent color */
.case-tag::before {
  background: radial-gradient(
    circle,
    rgba(6, 182, 212, 0.3),
    transparent 70%
  );
}

/* ====================================
   COUNTER ANIMATIONS
   ==================================== */

.stat-value {
  position: relative;
  display: inline-block;
  transition: transform var(--motion-base) var(--ease-spring);
}

/* Stat value glow */
.stat-value::before {
  content: '';
  position: absolute;
  inset: -10px;
  background: radial-gradient(
    ellipse,
    rgba(99, 102, 241, 0.3),
    rgba(139, 92, 246, 0.2) 40%,
    transparent 70%
  );
  animation: statGlowPulse 4s ease-in-out infinite;
  z-index: -1;
  filter: blur(15px);
  pointer-events: none;
}

@keyframes statGlowPulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

.stat-item:hover .stat-value {
  transform: scale(1.08);
}

.stat-item:hover .stat-value::before {
  animation: statGlowPulseFast 2s ease-in-out infinite;
}

@keyframes statGlowPulseFast {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.4);
  }
}

/* ====================================
   WHATSAPP FLOATING BUTTON
   ==================================== */

.whatsapp-float {
  position: relative;
  animation: whatsappPulse 2.5s ease-in-out 3s infinite;
}

@keyframes whatsappPulse {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45), 0 2px 8px rgba(0,0,0,0.2);
  }
  50% {
    box-shadow: 
      0 4px 16px rgba(37, 211, 102, 0.45),
      0 0 0 10px rgba(37, 211, 102, 0.12),
      0 0 0 20px rgba(37, 211, 102, 0.06);
  }
}

/* WhatsApp button glow ring */
.whatsapp-float::before {
  content: '';
  position: absolute;
  inset: -6px;
  background: radial-gradient(circle, rgba(37, 211, 102, 0.35), transparent 70%);
  border-radius: 50%;
  z-index: -1;
  filter: blur(10px);
  opacity: 0.5;
  animation: whatsappGlow 2s ease-in-out infinite;
}

@keyframes whatsappGlow {
  0%, 100% { opacity: 0.3; transform: scale(0.95); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

/* WhatsApp section removed — phone numbers removed from site */

/* ====================================
   POPUP ANIMATIONS
   ==================================== */

.lead-popup {
  animation: popupBackdropFade var(--motion-smooth) var(--ease-out-expo);
}

.lead-popup-content {
  animation: 
    popupSlideUp var(--motion-smooth) var(--ease-out-expo),
    popupScale var(--motion-smooth) var(--ease-spring);
}

@keyframes popupBackdropFade {
  from { backdrop-filter: blur(0); opacity: 0; }
  to { backdrop-filter: blur(8px); opacity: 1; }
}

@keyframes popupSlideUp {
  from { transform: translateY(var(--motion-distance-lg)); }
  to { transform: translateY(0); }
}

@keyframes popupScale {
  0% { transform: scale(0.94); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ====================================
   FORM INPUT ANIMATIONS
   ==================================== */

input, select, textarea {
  transition: 
    border-color var(--motion-fast) var(--ease-in-out-smooth),
    background var(--motion-fast) var(--ease-gentle),
    box-shadow var(--motion-fast) var(--ease-gentle);
}

input:focus, select:focus, textarea:focus {
  animation: inputFocusGlow var(--motion-base) var(--ease-out-expo);
}

@keyframes inputFocusGlow {
  from { 
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
  }
  to {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  }
}

/* ====================================
   LOADING & STATE TRANSITIONS
   ==================================== */

.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 15, 0.5);
  border-radius: inherit;
  animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ====================================
   PERFORMANCE OPTIMIZATIONS
   ==================================== */

/* GPU Acceleration for animated elements */
.hero-visual,
.glass-card,
.pillar-card,
.case-card,
.btn,
.nav-link::after {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Contain layout calculations */
.section {
  contain: layout style paint;
}

/* Optimize repaints */
.fade-in,
.fade-in-left,
.fade-in-right,
.scale-in {
  will-change: opacity, transform;
}

.fade-in.visible,
.fade-in-left.visible,
.fade-in-right.visible,
.scale-in.visible {
  will-change: auto;
}

/* ====================================
   IMAGE LOADING TRANSITIONS
   ==================================== */

img {
  transition: opacity var(--motion-smooth) var(--ease-gentle);
}

img:not(.loaded) {
  opacity: 0;
}

img.loaded {
  opacity: 1;
}

/* Progressive image reveal */
@keyframes imageReveal {
  from {
    opacity: 0;
    transform: scale(1.05);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

.hero-image.loaded {
  animation: imageReveal var(--motion-slow) var(--ease-out-expo);
}

/* ====================================
   ACCESSIBILITY: Focus Indicators
   ==================================== */

*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
  animation: focusRing var(--motion-base) var(--ease-out-expo);
}

@keyframes focusRing {
  from {
    outline-offset: 2px;
    outline-color: transparent;
  }
  to {
    outline-offset: 4px;
    outline-color: var(--color-primary);
  }
}
