/* ---------------------------------------------------------
   KEYFRAMES
   --------------------------------------------------------- */
@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

/* FIX: Agregado opacity para que la línea sea visible */
@keyframes fillUp {
  from { 
    transform: scaleX(0); 
    opacity: 0;
  }
  to { 
    transform: scaleX(1); 
    opacity: 1;
  }
}

@keyframes picImage {
  from { opacity: 0; transform: scale(1.2) translateY(-1rem); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes picShadow {
  from { opacity: 0; transform: scale(1.2) translateY(4rem); }
  to { opacity: 1; transform: scale(1.1) translateY(0); }
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(1.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomOutFade {
  from { opacity: 0; transform: scale(1.05); }
  to { opacity: 0.2; transform: scale(1); }
}

/* ---------------------------------------------------------
   ANIMATION UTILITIES
   --------------------------------------------------------- */

/* Base state: hidden before animation */
.wallpaper,
.profile-picture__shadow,
.profile-picture__img,
.profile-info__name,
.profile-info__job,
.separator,
.bio,
.services,
.cta-container,
.social-nav li {
  animation-duration: 1s;
  animation-fill-mode: both;
  will-change: opacity, transform;
  opacity: 0; /* Ensure they are hidden initially */
}

/* Specific Timings */
.wallpaper {
  animation-timing-function: ease-out;
}

.profile-picture__shadow,
.profile-picture__img {
  animation-duration: 800ms;
  animation-timing-function: cubic-bezier(0, 0.5, 0.25, 1.25);
}

/* ---------------------------------------------------------
   TRIGGERS (Selectors)
   --------------------------------------------------------- */

/* Wallpaper trigger */
.wallpaper.is-loaded { 
  animation-name: zoomOutFade; 
}

/* Profile Picture triggers */
#picture.is-loaded .profile-picture__shadow { 
  animation-name: picShadow; 
}

#picture.is-loaded .profile-picture__img { 
  animation-name: picImage; 
}

/* Content triggers (Automatic on load via CSS animations) */
.profile-info__name,
.profile-info__job,
.bio,
.services,
.social-nav li {
  animation-name: slideUpFade;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.separator {
  animation-name: fillUp;
  animation-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
}

.cta-container {
  animation-name: bounceIn;
  animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ---------------------------------------------------------
   ORCHESTRATION (Delays)
   --------------------------------------------------------- */
.profile-info__name { animation-delay: 100ms; }
.profile-info__job  { animation-delay: 200ms; }
.separator          { animation-delay: 300ms; }
.bio                { animation-delay: 400ms; }
.services           { animation-delay: 500ms; }
.cta-container      { animation-delay: 600ms; }

.profile-picture__img    { animation-delay: 400ms; }
.profile-picture__shadow { animation-delay: 400ms; }
.wallpaper.is-loaded     { animation-delay: 800ms; }

/* Social Icons Stagger */
.social-nav li:nth-child(1) { animation-delay: 800ms; }
.social-nav li:nth-child(2) { animation-delay: 850ms; }
.social-nav li:nth-child(3) { animation-delay: 900ms; }
.social-nav li:nth-child(4) { animation-delay: 950ms; }
.social-nav li:nth-child(5) { animation-delay: 1000ms; }
.social-nav li:nth-child(6) { animation-delay: 1050ms; }

/* ---------------------------------------------------------
   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;
    animation-delay: 0ms !important;
    opacity: 1 !important; /* Force visibility if animations are off */
  }
}