/* =========================================
   ANIMATIONS.CSS — Scroll Reveals, Hover
   Effects, Keyframes, Transitions
   ========================================= */

/* ---- Scroll Reveal Base ---- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Keep hero content always visible so mobile observer timing cannot hide headline/text. */
#hero .reveal,
#hero .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Stagger delay variants */
.reveal--delay-1 { transition-delay: 0.1s; }
.reveal--delay-2 { transition-delay: 0.2s; }
.reveal--delay-3 { transition-delay: 0.3s; }
.reveal--delay-4 { transition-delay: 0.4s; }
.reveal--delay-5 { transition-delay: 0.5s; }
.reveal--delay-6 { transition-delay: 0.6s; }

/* From left */
.reveal--left {
  transform: translateX(-40px);
}
.reveal--left.is-visible {
  transform: translateX(0);
}

/* From right */
.reveal--right {
  transform: translateX(40px);
}
.reveal--right.is-visible {
  transform: translateX(0);
}

/* Scale up */
.reveal--scale {
  transform: scale(0.9);
}
.reveal--scale.is-visible {
  transform: scale(1);
}

/* Fade only */
.reveal--fade {
  transform: none;
}
.reveal--fade.is-visible {
  transform: none;
}

/* ---- Section Enter Animation ---- */
.section-header .section-label { transition-delay: 0s; }
.section-header .section-title { transition-delay: 0.1s; }
.section-header .section-subtitle { transition-delay: 0.2s; }

/* ---- Floating Animation (badge stats) ---- */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

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

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

.float-1 { animation: float 4s ease-in-out infinite; }
.float-2 { animation: float-2 5s ease-in-out infinite 0.5s; }
.float-3 { animation: float-3 3.5s ease-in-out infinite 1s; }

/* ---- Pulse Glow ---- */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(79, 142, 247, 0.4);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(79, 142, 247, 0);
  }
}

.pulse-glow {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

/* ---- Gradient Shift (background) ---- */
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-animate {
  background-size: 200% 200%;
  animation: gradient-shift 5s ease-in-out infinite;
}

/* ---- Spin ---- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 8s linear infinite;
}

/* ---- Shimmer (loading skeleton) ---- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--glass-bg) 25%,
    rgba(255,255,255,0.1) 50%,
    var(--glass-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
}

/* ---- Nav Active Indicator ---- */
@keyframes nav-indicator {
  from { transform: translateX(-50%) scaleX(0); }
  to { transform: translateX(-50%) scaleX(1); }
}

/* ---- Timeline Dot Pulse ---- */
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 142, 247, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(79, 142, 247, 0); }
}

.timeline__dot {
  animation: dot-pulse 2s ease-in-out infinite;
}

/* ---- Card Hover Glow ---- */
.glass-card,
.project-card,
.glass-stat,
.counter-card,
.testimonial-card,
.timeline__card {
  will-change: transform;
}

/* ---- Orbit Ring (hero decoration) ---- */
@keyframes orbit {
  to { transform: rotate(360deg); }
}

.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(79, 142, 247, 0.15);
  animation: orbit 20s linear infinite;
  pointer-events: none;
}

.orbit-ring:nth-child(2) { animation-duration: 30s; animation-direction: reverse; }
.orbit-ring:nth-child(3) { animation-duration: 15s; }

/* ---- Noise Texture Overlay ---- */
.noise-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px;
  z-index: 0;
}

/* ---- Project card filter transition ---- */
.project-card {
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base),
              opacity 0.35s ease,
              background var(--transition-theme);
}

.project-card.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

/* ---- Toast Animation ---- */
@keyframes toast-in {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---- Testimonial Carousel Scroll ---- */
@keyframes scroll-x {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---- Prefers Reduced Motion Overrides ---- */
@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 {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .float-1, .float-2, .float-3,
  .spin, .pulse-glow, .orbit-ring,
  .gradient-animate {
    animation: none;
  }
}
