/* ====== ZAI DIGITAL STUDIO - ANIMATIONS ====== */
/* Animation definitions for motion graphics and transitions */

/* ====== SCROLL ANIMATIONS (via GSAP ScrollTrigger) ====== */
.fade-in-up {
  opacity: 0;
  transform: translateY(50px);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-50px);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(50px);
}

.scale-in {
  opacity: 0;
  transform: scale(0.95);
}

.rotate-in {
  opacity: 0;
  transform: rotate(-5deg) scale(0.95);
}

/* ====== HERO TEXT ANIMATIONS ====== */
.hero-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.2;
}

.hero-title span {
  display: inline-block;
  opacity: 0;
}

/* ====== STAGGER ANIMATIONS ====== */
.stagger-item {
  animation: none;
}

.stagger-item.animated {
  animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ====== HERO ANIMATIONS ====== */
@keyframes floatUp {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes floatDown {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(20px);
  }
}

@keyframes rotateLight {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.6);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* ====== MORPHING SHAPES (for playful animations) ====== */
@keyframes morph {
  0% {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  }
  50% {
    border-radius: 60% 40% 40% 60% / 60% 60% 40% 40%;
  }
  100% {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  }
}

/* ====== FLIP CARDS ====== */
@keyframes flipInX {
  from {
    transform: perspective(400px) rotateX(90deg);
    opacity: 0;
  }
  to {
    transform: perspective(400px) rotateX(0deg);
    opacity: 1;
  }
}

@keyframes flipOutX {
  from {
    transform: perspective(400px) rotateX(0deg);
    opacity: 1;
  }
  to {
    transform: perspective(400px) rotateX(90deg);
    opacity: 0;
  }
}

/* ====== BOUNCE ====== */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* ====== LOADING ANIMATION ====== */
@keyframes loading-dots {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

.loading-dots span {
  animation: loading-dots 1.4s infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ====== SMOOTH PAGE TRANSITIONS ====== */
@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageExit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.page-enter {
  animation: pageEnter 0.4s ease-out;
}

.page-exit {
  animation: pageExit 0.3s ease-out forwards;
}

/* ====== PARALLAX BACKGROUND ====== */
@keyframes slowFloat {
  0%, 100% {
    transform: translateY(0px) translateX(0px);
  }
  25% {
    transform: translateY(-15px) translateX(10px);
  }
  50% {
    transform: translateY(0px) translateX(20px);
  }
  75% {
    transform: translateY(15px) translateX(10px);
  }
}

/* ====== GRADIENT ANIMATION ====== */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ====== STARFIELD ANIMATION ====== */
@keyframes starfield {
  0% {
    background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 50%, 100% 80%, 40% 0%;
  }
  50% {
    background-position: 5% 5%, -3% 8%, 4% -2%, -5% 3%, 3% 7%, -2% 4%, 2% -3%, -4% 5%, 5% 2%, -3% 6%, 0% 50%, 100% 80%, 40% 0%;
  }
  100% {
    background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 50%, 100% 80%, 40% 0%;
  }
}

.animated-gradient {
  background-size: 200% 200%;
  animation: gradientShift 6s ease infinite;
}

/* ====== SKELETON LOADING ====== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.2) 25%,
    rgba(148, 163, 184, 0.3) 50%,
    rgba(148, 163, 184, 0.2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* ====== FLOATING ELEMENTS (for hero) ====== */
.float-element {
  position: absolute;
  animation: floatUp 6s ease-in-out infinite;
}

.float-element:nth-child(2) {
  animation: floatDown 8s ease-in-out infinite;
  animation-delay: 1s;
}

.float-element:nth-child(3) {
  animation: rotateLight 20s linear infinite;
  animation-delay: 0.5s;
}

/* ====== BUTTON RIPPLE EFFECT ====== */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1);
  transform-origin: 50%;
  pointer-events: none;
}

.btn-ripple:active::after {
  animation: ripple 0.6s ease-out;
}

/* ====== SMOOTH TRANSITIONS FOR INTERACTIVE ELEMENTS ====== */
button,
a,
.interactive {
  transition: all 0.3s ease;
}

/* ====== CAROUSEL/SLIDESHOW ANIMATIONS ====== */
@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutToLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-100px);
  }
}

.carousel-slide {
  animation: slideInFromRight 0.6s ease-out;
}

.carousel-slide.exit {
  animation: slideOutToLeft 0.3s ease-in;
}

/* ====== UNDERLINE ANIMATION ====== */
@keyframes underlineExpand {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.underline-animate {
  position: relative;
  display: inline-block;
}

.underline-animate::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, #22c55e, #38bdf8);
}

.underline-animate:hover::after {
  animation: underlineExpand 0.3s ease forwards;
}

/* ====== HOVER LIFT EFFECT ====== */
@keyframes liftUp {
  to {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(34, 197, 94, 0.2);
  }
}

.hover-lift:hover {
  animation: liftUp 0.3s ease forwards;
}

/* ====== FLOATING LOGO ANIMATION ====== */
@keyframes floatLogoBounce {
  0% {
    transform: translateY(0) scale(1);
  }
  25% {
    transform: translateY(-8px) scale(1.05);
  }
  50% {
    transform: translateY(-12px) scale(1.08);
  }
  75% {
    transform: translateY(-6px) scale(1.06);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* ====== COLOR SHIFT ANIMATION ====== */
@keyframes colorShift {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

.color-shift:hover {
  animation: colorShift 0.6s ease;
}

/* ====== NEW CREATIVE ANIMATIONS ====== */

/* Carousel slide smooth transitions */
@keyframes slideInCarousel {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.carousel-slide.entering {
  animation: slideInCarousel 0.6s ease-out;
}

/* Pulsing glow for accent elements (badges, coming soon) */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
    transform: scale(1.02);
  }
}

/* Float and ascend with subtle rotation */
@keyframes floatAscend {
  0%, 100% {
    transform: translateY(0px) rotateZ(0deg);
  }
  25% {
    transform: translateY(-10px) rotateZ(1deg);
  }
  50% {
    transform: translateY(-20px) rotateZ(0deg);
  }
  75% {
    transform: translateY(-10px) rotateZ(-1deg);
  }
}

/* Enhanced gradient shift for background */
@keyframes gradientShiftBackground {
  0% {
    background-position: 0% 50%, 100% 100%, 50% 0%;
    opacity: 1;
  }
  50% {
    background-position: 100% 50%, 0% 0%, 100% 100%;
    opacity: 0.8;
  }
  100% {
    background-position: 0% 50%, 100% 100%, 50% 0%;
    opacity: 1;
  }
}

/* Gradient text animation */
@keyframes gradientText {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 100% center;
  }
}

.text-gradient-animate {
  background-size: 200% auto;
  animation: gradientText 3s linear infinite;
}

/* Shimmer overlay loading effect */
@keyframes shimmerOverlay {
  0% {
    background-position: -1200px 0;
  }
  100% {
    background-position: 1200px 0;
  }
}

.shimmer-loading {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.1) 0%,
    rgba(148, 163, 184, 0.3) 50%,
    rgba(148, 163, 184, 0.1) 100%
  );
  background-size: 200% 100%;
  animation: shimmerOverlay 2s infinite;
}

/* Fade in with stagger (CSS-based for no JS) */
.fade-in-stagger {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.fade-in-stagger:nth-child(1) { animation-delay: 0ms; }
.fade-in-stagger:nth-child(2) { animation-delay: 100ms; }
.fade-in-stagger:nth-child(3) { animation-delay: 200ms; }
.fade-in-stagger:nth-child(4) { animation-delay: 300ms; }
.fade-in-stagger:nth-child(5) { animation-delay: 400ms; }
.fade-in-stagger:nth-child(6) { animation-delay: 500ms; }
.fade-in-stagger:nth-child(7) { animation-delay: 600ms; }
.fade-in-stagger:nth-child(8) { animation-delay: 700ms; }

/* ====== REDUCE MOTION ====== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
