/* ==========================================================================
   Khan Creative Studio - Public Website - Animations
   Scroll reveal, hero motion, micro-interactions. Respects reduced motion.
   ========================================================================== */

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

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

@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@keyframes floatSlow {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(10px, -18px) rotate(4deg); }
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(111, 220, 183, 0.55); }
  70% { box-shadow: 0 0 0 16px rgba(111, 220, 183, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 220, 183, 0); }
}

@keyframes cue {
  0% { opacity: 0; transform: translateY(0); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-20px, 16px, 0) scale(1.05); }
}

/* Scroll reveal (toggled by main.js using IntersectionObserver) */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--delay, 0ms);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* Hero entrance */
.hero-enter {
  animation: fadeUp 0.9s var(--ease) both;
}

.hero-enter.d1 { animation-delay: 0.08s; }
.hero-enter.d2 { animation-delay: 0.18s; }
.hero-enter.d3 { animation-delay: 0.28s; }
.hero-enter.d4 { animation-delay: 0.4s; }

/* Hero visual motion */
.hero-visual .visual-canvas {
  animation: float 9s ease-in-out infinite;
}

.hero-visual .float-card {
  animation: floatSlow 7s ease-in-out infinite;
}

.hero-visual .card-b {
  animation-delay: -2.5s;
}

.hero-visual .card-c {
  animation-delay: -4s;
}

.hero-visual .icon-pill {
  animation: pulseRing 2.8s ease-out infinite;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  animation: drift 16s ease-in-out infinite;
}

.blob.one {
  width: 340px;
  height: 340px;
  background: rgba(111, 220, 183, 0.6);
  top: 10%;
  left: -120px;
}

.blob.two {
  width: 420px;
  height: 420px;
  background: rgba(123, 79, 209, 0.45);
  bottom: -160px;
  right: -120px;
  animation-delay: -6s;
}

.hero .container {
  position: relative;
  z-index: 1;
}

/* Service and project media hover details */
.service-visual i,
.project-media i {
  animation: float 6s ease-in-out infinite;
}

.service-card:nth-child(3n + 2) .service-visual i {
  animation-delay: -2s;
}

.service-card:nth-child(3n + 3) .service-visual i {
  animation-delay: -4s;
}

/* Header button and link micro-interactions */
.site-header .btn-primary {
  animation: none;
}

.socials a i {
  transition: transform 0.3s var(--ease);
}

.socials a:hover i {
  transform: scale(1.12);
}

/* Reduced motion: no transforms, instant states */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .blob,
  .hero-visual .visual-canvas,
  .hero-visual .float-card,
  .service-visual i,
  .project-media i {
    animation: none !important;
  }
}
