/* ==========================================================================
   ANIMATIONS.CSS — MICRO-INTERACTIONS, KEYFRAMES & ACCESSIBLE MOTION
   Project: Personal Portfolio Website — Shanto Paul (DIU)
   Standards: WCAG 2.1 AA Reduced Motion Fallbacks, GPU Accelerated
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Scroll Reveal Classes (IntersectionObserver)
   -------------------------------------------------------------------------- */
.reveal-on-scroll,
.reveal,
.reveal-left,
.reveal-right,
.reveal-scale {
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll,
.reveal {
  transform: translateY(24px);
}

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

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

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

.reveal-on-scroll.is-revealed,
.reveal-on-scroll.is-visible,
.reveal.is-revealed,
.reveal.is-visible,
.reveal-left.is-revealed,
.reveal-left.is-visible,
.reveal-right.is-revealed,
.reveal-right.is-visible,
.reveal-scale.is-revealed,
.reveal-scale.is-visible {
  opacity: 1;
  transform: translate(0) scale(1);
}

/* Stagger Delays */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* --------------------------------------------------------------------------
   2. Typing Cursor Animation
   -------------------------------------------------------------------------- */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.typing-cursor {
  display: inline-block;
  margin-left: 2px;
  width: 2px;
  height: 1.15em;
  background-color: var(--primary);
  vertical-align: -0.15em;
  animation: blink 0.9s infinite;
}

/* --------------------------------------------------------------------------
   3. Chatbot Typing Indicator (3-Dot Pulse)
   -------------------------------------------------------------------------- */
@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.5rem 0.75rem;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

/* --------------------------------------------------------------------------
   4. Pulse Glow Effect (AI Status Pill)
   -------------------------------------------------------------------------- */
@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--secondary);
  animation: pulseGlow 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
  display: inline-block;
}

/* --------------------------------------------------------------------------
   5. Skeleton Shimmer Placeholder Loading
   -------------------------------------------------------------------------- */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--border) 37%,
    var(--bg-tertiary) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   6. Floating Ambient Badges (Hero Profile)
   -------------------------------------------------------------------------- */
@keyframes floatBadge1 {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

@keyframes floatBadge2 {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(6px) rotate(-1deg);
  }
}

.float-anim-1 {
  animation: floatBadge1 4s ease-in-out infinite;
}

.float-anim-2 {
  animation: floatBadge2 5s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   7. Reduced Motion Accessibility Enforcement (WCAG 2.1 AA)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal-on-scroll,
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1 !important;
    transform: none !important;
  }

  .typing-cursor {
    animation: none !important;
    opacity: 1 !important;
  }

  .pulse-indicator {
    animation: none !important;
  }

  .float-anim-1,
  .float-anim-2 {
    animation: none !important;
  }
}

