/* ============================================
   COOP ARTISTS - Animation System
   Premium artistic site animations
   ============================================ */

/* --------------------------------------------
   KEYFRAMES
   -------------------------------------------- */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes marqueeReverse {
  0% {
    transform: translateX(-50%);
  }
  100% {
    transform: translateX(0);
  }
}

/* --------------------------------------------
   BASE ANIMATION CLASSES
   Elements start hidden, become visible on .visible
   -------------------------------------------- */

.animate-fade,
.animate-up,
.animate-scale,
.animate-slide-left,
.animate-slide-right {
  opacity: 0;
  will-change: opacity, transform;
}

.animate-fade.visible {
  animation: fadeIn 0.6s ease-out forwards;
}

.animate-up.visible {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-scale.visible {
  animation: fadeInScale 0.6s ease-out forwards;
}

.animate-slide-left.visible {
  animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-right.visible {
  animation: slideInRight 0.6s ease-out forwards;
}

/* --------------------------------------------
   ANIMATION DELAYS
   -------------------------------------------- */

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }

/* --------------------------------------------
   STAGGER GROUPS
   Apply to parent, children auto-stagger
   -------------------------------------------- */

.stagger-group > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-group > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-group > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-group > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-group > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-group > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-group > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-group > *:nth-child(8) { animation-delay: 0.4s; }

/* --------------------------------------------
   IMAGE HOVER EFFECTS
   -------------------------------------------- */

.img-hover {
  position: relative;
  overflow: hidden;
  display: block;
}

.img-hover img {
  transition: transform 0.5s ease-out;
  will-change: transform;
}

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

/* Overlay on hover */
.img-hover-overlay {
  position: relative;
  overflow: hidden;
  display: block;
}

.img-hover-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.5) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

.img-hover-overlay img {
  transition: transform 0.5s ease-out;
  will-change: transform;
}

.img-hover-overlay:hover::after {
  opacity: 1;
}

.img-hover-overlay:hover img {
  transform: scale(1.05);
}

/* Reveal overlay content on hover */
.img-hover-reveal {
  position: relative;
  overflow: hidden;
}

.img-hover-reveal .hover-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.img-hover-reveal:hover .hover-content {
  opacity: 1;
}

/* --------------------------------------------
   PARALLAX CLASSES
   -------------------------------------------- */

.parallax {
  will-change: transform;
}

.parallax-slow {
  --parallax-speed: 0.3;
}

.parallax-medium {
  --parallax-speed: 0.5;
}

.parallax-fast {
  --parallax-speed: 0.7;
}

/* --------------------------------------------
   MARQUEE / TICKER
   -------------------------------------------- */

.marquee {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-content {
  display: inline-flex;
  animation: marquee 20s linear infinite;
}

.marquee-content span {
  display: inline-block;
  padding: 0 2rem;
}

/* Duplicate content for seamless loop */
.marquee-content::after {
  content: attr(data-text);
  display: inline-block;
  padding: 0 2rem;
}

/* Reverse direction */
.marquee-reverse .marquee-content {
  animation: marqueeReverse 20s linear infinite;
}

/* Pause on hover */
.marquee-pause:hover .marquee-content {
  animation-play-state: paused;
}

/* Speed variants */
.marquee-slow .marquee-content {
  animation-duration: 30s;
}

.marquee-fast .marquee-content {
  animation-duration: 12s;
}

/* --------------------------------------------
   GENERAL TRANSITIONS
   -------------------------------------------- */

.transition-fast {
  transition: all 0.2s ease-out;
}

.transition-base {
  transition: all 0.3s ease-out;
}

.transition-slow {
  transition: all 0.5s ease-out;
}

/* Link underline animation */
.link-underline {
  position: relative;
  display: inline-block;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease-out;
}

.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Button hover lift */
.btn-lift {
  transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.btn-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------
   PAGE TRANSITIONS
   -------------------------------------------- */

.page-transition {
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.page-transition.is-leaving {
  opacity: 0;
}

/* --------------------------------------------
   REDUCED MOTION
   Respect user preferences
   -------------------------------------------- */

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

  .parallax {
    transform: none !important;
  }

  .marquee-content {
    animation: none;
  }
}
