/* ============================================================
   ANIMATIONS — animations.css
   Portfolio: Pratap Patra | 2026
   ============================================================ */

/* ── Loader Progress Bar ── */
@keyframes loaderBar {
  0%   { width: 0%; }
  30%  { width: 40%; }
  70%  { width: 78%; }
  100% { width: 100%; }
}

/* ── Fade ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── Slide Animations ── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-32px); }
  to   { opacity: 1; transform: translateY(0); }
}

@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); }
}

/* ── Scale ── */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scaleInBounce {
  0%   { opacity: 0; transform: scale(0.5); }
  70%  { opacity: 1; transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ── Float ── */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-16px); }
}

@keyframes floatGentle {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50%       { transform: translateY(-10px) rotate(2deg); }
}

/* ── Pulse ── */
@keyframes pulseSoft {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.05); opacity: 0.85; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.45); }
  50%       { box-shadow: 0 0 0 14px rgba(99, 102, 241, 0); }
}

@keyframes pulseGlowSuccess {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50%       { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}

/* ── Spin ── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes spinReverse {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}

/* ── Gradient Shift ── */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Blob Morph ── */
@keyframes blobMorph1 {
  0%  { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: scale(1); }
  25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; transform: scale(1.04); }
  50% { border-radius: 50% 60% 30% 60% / 40% 70% 60% 30%; transform: scale(1); }
  75% { border-radius: 60% 40% 60% 30% / 70% 30% 60% 40%; transform: scale(0.97); }
  100%{ border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: scale(1); }
}

@keyframes blobMorph2 {
  0%  { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; transform: scale(1); }
  33% { border-radius: 70% 30% 50% 60% / 30% 40% 70% 60%; transform: scale(1.06); }
  66% { border-radius: 30% 50% 40% 70% / 60% 70% 30% 50%; transform: scale(0.95); }
  100%{ border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; transform: scale(1); }
}

/* ── Typing Cursor Blink ── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Ripple (button click) ── */
@keyframes ripple {
  0%   { transform: scale(0); opacity: 1; }
  100% { transform: scale(4);  opacity: 0; }
}

/* ── Shimmer (skeleton loading) ── */
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Ring Rotation ── */
@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Marquee (horizontal scroll) ── */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── Progress Fill ── */
@keyframes progressFill {
  from { width: 0%; }
  to   { width: var(--progress-value, 100%); }
}

/* ── Bounce ── */
@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.3); }
  50%  { opacity: 1; transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ── Shake ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-5px); }
  30%, 60%, 90% { transform: translateX(5px); }
}

/* ── Hero image frame glow ── */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.2); }
  50%       { box-shadow: 0 0 50px rgba(99, 102, 241, 0.4); }
}

/* ── Page entrance ── */
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   ANIMATION UTILITY CLASSES
   ============================================================ */

/* Typed cursor element */
.typed-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--color-accent);
  margin-left: 2px;
  vertical-align: middle;
  border-radius: 1px;
  animation: blink 1s step-end infinite;
}

/* Apply to elements that should animate in on load */
.anim-fade-in    { animation: fadeIn    0.6s ease both; }
.anim-slide-up   { animation: slideUp   0.6s ease both; }
.anim-slide-down { animation: slideDown 0.6s ease both; }
.anim-scale-in   { animation: scaleIn   0.5s ease both; }

/* Delay utilities for staggered animations */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }

/* Float utility */
.anim-float { animation: float 5s ease-in-out infinite; }

/* Spin utility */
.anim-spin { animation: spin 2s linear infinite; }

/* ============================================================
   REDUCED MOTION — Respect user accessibility preferences
   ============================================================ */
@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,
  .reveal-left,
  .reveal-right {
    opacity: 1 !important;
    transform: none !important;
  }
}
