/* Studio Minna - Animations & Keyframes */

/* 1. Core Scroll Entrance Keyframes */
@keyframes scrollSlideInLeft {
  0% {
    opacity: 0;
    transform: translate3d(-70px, 0, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes scrollSlideInRight {
  0% {
    opacity: 0;
    transform: translate3d(70px, 0, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes scrollFadeInUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 50px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes heroZoomIn {
  0% {
    opacity: 0;
    transform: scale(0.78);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes heroWatermarkZoom {
  0% {
    opacity: 0;
    transform: scale(0.82);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 2. Scroll Reveal States */
/* When animations script initializes, unrevealed items start hidden for dynamic scroll entrance */
body.animations-ready .reveal-on-scroll:not(.is-revealed) {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate3d(0, 45px, 0);
  will-change: opacity, transform;
}

/* Default scroll entrance animation */
.reveal-on-scroll.is-revealed {
  opacity: 1;
  visibility: visible;
  animation: scrollFadeInUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* 3. Directional Lateral Entrances (Statements & Tre Motivi in Home) */
.statements-grid > .statement-card:nth-child(1).is-revealed,
.cards-grid > .tilt-card:nth-child(1).is-revealed {
  animation: scrollSlideInLeft 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.statements-grid > .statement-card:nth-child(2).is-revealed,
.cards-grid > .tilt-card:nth-child(2).is-revealed {
  animation: scrollFadeInUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.statements-grid > .statement-card:nth-child(3).is-revealed,
.cards-grid > .tilt-card:nth-child(3).is-revealed {
  animation: scrollSlideInRight 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.28s both;
}

/* 4. Staggered Delays for Grid Elements Across the Site */
.fast-grid > .reveal-on-scroll:nth-child(1),
.competenze-grid > .reveal-on-scroll:nth-child(1),
.team-grid > .reveal-on-scroll:nth-child(3n+1),
.blog-grid > .reveal-on-scroll:nth-child(3n+1) {
  animation-delay: 0.05s;
}

.fast-grid > .reveal-on-scroll:nth-child(2),
.competenze-grid > .reveal-on-scroll:nth-child(2),
.team-grid > .reveal-on-scroll:nth-child(3n+2),
.blog-grid > .reveal-on-scroll:nth-child(3n+2) {
  animation-delay: 0.18s;
}

.fast-grid > .reveal-on-scroll:nth-child(3),
.competenze-grid > .reveal-on-scroll:nth-child(3),
.team-grid > .reveal-on-scroll:nth-child(3n),
.blog-grid > .reveal-on-scroll:nth-child(3n) {
  animation-delay: 0.30s;
}

.fast-grid > .reveal-on-scroll:nth-child(4),
.competenze-grid > .reveal-on-scroll:nth-child(4) {
  animation-delay: 0.42s;
}

/* 5. Once Entrance Animation Completes: Restore Full Normal Hover Interactivity */
.reveal-on-scroll.is-revealed.animation-done {
  animation: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* 6. Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll,
  .reveal-on-scroll:not(.is-revealed),
  .reveal-on-scroll.is-revealed {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}
