/* =============================================================================
   FLIESENCENTER S.L. - Animations Stylesheet
   GPU-accelerated animations using CSS transforms
   ============================================================================= */

/* ===================== KEYFRAME ANIMATIONS ===================== */

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scale In from top */
@keyframes scaleInTop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Shimmer / loading effect */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Floating animation – subtle up/down motion */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-12px);
  }
}

/* Pulse – for CTA buttons and attention elements */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }
  50% {
    box-shadow: 0 0 0 16px rgba(220, 38, 38, 0);
  }
}

/* Pulse gold variant */
@keyframes pulseGold {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(212, 168, 83, 0.4);
  }
  50% {
    box-shadow: 0 0 0 16px rgba(212, 168, 83, 0);
  }
}

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

/* Rotate – loading spinner */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Slide In from bottom (mobile menu) */
@keyframes slideInBottom {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Counter tick */
@keyframes counterPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* Gradient shift – for hero overlay */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Underline expand */
@keyframes underlineExpand {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ===================== ANIMATION UTILITY CLASSES ===================== */

/* Hero entrance animations */
.anim-fade-in-up {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.anim-fade-in-down {
  animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.anim-fade-in-left {
  animation: fadeInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.anim-fade-in-right {
  animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.anim-scale-in {
  animation: scaleIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.anim-fade-in {
  animation: fadeIn 0.6s ease both;
  will-change: opacity;
}

/* Animation delays */
.anim-delay-100 { animation-delay: 0.1s; }
.anim-delay-200 { animation-delay: 0.2s; }
.anim-delay-300 { animation-delay: 0.3s; }
.anim-delay-400 { animation-delay: 0.4s; }
.anim-delay-500 { animation-delay: 0.5s; }
.anim-delay-600 { animation-delay: 0.6s; }
.anim-delay-700 { animation-delay: 0.7s; }
.anim-delay-800 { animation-delay: 0.8s; }
.anim-delay-1000 { animation-delay: 1s; }
.anim-delay-1200 { animation-delay: 1.2s; }

/* ===================== PERSISTENT ANIMATIONS ===================== */

/* Floating element */
.anim-float {
  animation: float 4s ease-in-out infinite;
  will-change: transform;
}

.anim-float-slow {
  animation: float 6s ease-in-out infinite;
  will-change: transform;
}

/* Pulse CTA */
.anim-pulse {
  animation: pulse 2.5s ease-in-out infinite;
  will-change: box-shadow;
}

.anim-pulse-gold {
  animation: pulseGold 2.5s ease-in-out infinite;
  will-change: box-shadow;
}

/* ===================== SHIMMER LOADING ===================== */

.shimmer {
  background: linear-gradient(
    90deg,
    var(--color-gray-200) 25%,
    var(--color-gray-100) 50%,
    var(--color-gray-200) 75%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
}

/* ===================== SCROLL-TRIGGERED CLASSES ===================== */
/* These work together with the IntersectionObserver in main.js */

/* Base state – hidden before reveal */
.reveal {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.reveal-up {
  transform: translateY(40px);
}

.reveal-left {
  transform: translateX(-40px);
}

.reveal-right {
  transform: translateX(40px);
}

.reveal-scale {
  transform: scale(0.9);
}

/* Revealed state */
.reveal.revealed {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Staggered children */
.stagger-children > *:nth-child(1) { transition-delay: 0s; }
.stagger-children > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-children > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-children > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-children > *:nth-child(6) { transition-delay: 0.5s; }
.stagger-children > *:nth-child(7) { transition-delay: 0.6s; }
.stagger-children > *:nth-child(8) { transition-delay: 0.7s; }
.stagger-children > *:nth-child(9) { transition-delay: 0.8s; }

/* ===================== HOVER MICRO-ANIMATIONS ===================== */

/* Arrow nudge on hover (for links) */
.hover-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: gap 0.2s ease;
}

.hover-arrow:hover {
  gap: 0.625rem;
}

/* Lift on hover */
.hover-lift {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Scale on hover */
.hover-scale {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
  transform: scale(1.04);
}

/* Image zoom container */
.img-zoom {
  overflow: hidden;
}

.img-zoom img {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.img-zoom:hover img {
  transform: scale(1.07);
}

/* ===================== PARALLAX ===================== */

.parallax-bg {
  will-change: transform;
  transition: transform 0.05s linear;
}

/* ===================== COUNTER ANIMATION ===================== */

.counter-value {
  display: inline-block;
  will-change: contents;
}

.counter-animated {
  animation: counterPop 0.3s ease;
}

/* ===================== PAGE TRANSITION ===================== */

.page-enter {
  animation: fadeIn 0.4s ease both;
}

/* ===================== LIGHTBOX ANIMATION ===================== */

.lightbox {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-inner {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.lightbox:not(.open) .lightbox-inner {
  transform: scale(0.9);
  opacity: 0;
}

.lightbox.open .lightbox-inner {
  transform: scale(1);
  opacity: 1;
}

/* Image transition in lightbox */
.lightbox-img-wrapper {
  position: relative;
  overflow: hidden;
}

.lightbox-img-enter {
  animation: fadeIn 0.25s ease both;
}

/* ===================== FILTER ANIMATION ===================== */

.gallery-item {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item.filtering-out {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.gallery-item.filtering-in {
  animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ===================== NAV ANIMATIONS ===================== */

.navbar {
  transition: background 0.4s ease,
              border-color 0.4s ease,
              box-shadow 0.4s ease;
}

.nav-dropdown-menu {
  transform-origin: top center;
}

/* ===================== MOBILE MENU ANIMATION ===================== */

.mobile-menu a,
.mobile-menu button {
  animation: slideInBottom 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.mobile-menu a:nth-child(1)  { animation-delay: 0.05s; }
.mobile-menu a:nth-child(2)  { animation-delay: 0.1s; }
.mobile-menu a:nth-child(3)  { animation-delay: 0.15s; }
.mobile-menu a:nth-child(4)  { animation-delay: 0.2s; }
.mobile-menu a:nth-child(5)  { animation-delay: 0.25s; }
.mobile-menu a:nth-child(6)  { animation-delay: 0.3s; }

/* ===================== REDUCED MOTION ===================== */
/* Respect user's OS preference */

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

  .parallax-bg {
    transform: none !important;
  }

  .scroll-indicator {
    animation: none;
  }
}
