/* ============================================================
   GitImsi Animations — Scroll Reveal, Micro-Interactions, Keyframes
   ============================================================ */

/* --- Scroll Reveal Animations --- */
[data-animate] {
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate="fade-up"] {
  transform: translateY(40px);
}

[data-animate="fade-down"] {
  transform: translateY(-40px);
}

[data-animate="fade-left"] {
  transform: translateX(40px);
}

[data-animate="fade-right"] {
  transform: translateX(-40px);
}

[data-animate="scale-in"] {
  transform: scale(0.9);
}

[data-animate="blur-in"] {
  filter: blur(10px);
  transform: translateY(20px);
}

[data-animate].animated {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
  filter: blur(0);
}

/* Stagger children */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-stagger].animated > *:nth-child(1) { transition-delay: 0ms; }
[data-stagger].animated > *:nth-child(2) { transition-delay: 80ms; }
[data-stagger].animated > *:nth-child(3) { transition-delay: 160ms; }
[data-stagger].animated > *:nth-child(4) { transition-delay: 240ms; }
[data-stagger].animated > *:nth-child(5) { transition-delay: 320ms; }
[data-stagger].animated > *:nth-child(6) { transition-delay: 400ms; }
[data-stagger].animated > *:nth-child(7) { transition-delay: 480ms; }
[data-stagger].animated > *:nth-child(8) { transition-delay: 560ms; }

[data-stagger].animated > * {
  opacity: 1;
  transform: translateY(0);
}

/* --- Keyframe Animations --- */
@keyframes pulse-glow {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-10px) rotate(1deg); }
  66% { transform: translateY(5px) rotate(-1deg); }
}

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

@keyframes float-delayed {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(3deg); }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

@keyframes border-flow {
  0% { border-image-source: linear-gradient(0deg, var(--accent-indigo), var(--accent-emerald)); }
  33% { border-image-source: linear-gradient(120deg, var(--accent-indigo), var(--accent-emerald)); }
  66% { border-image-source: linear-gradient(240deg, var(--accent-indigo), var(--accent-emerald)); }
  100% { border-image-source: linear-gradient(360deg, var(--accent-indigo), var(--accent-emerald)); }
}

@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-in-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  0%, 50% { border-right-color: var(--accent-indigo); }
  51%, 100% { border-right-color: transparent; }
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes orbit {
  from { transform: rotate(0deg) translateX(120px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(120px) rotate(-360deg); }
}

@keyframes count-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Utility Animation Classes --- */
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-float-slow { animation: float-slow 8s ease-in-out infinite; }
.animate-float-delayed { animation: float-delayed 7s ease-in-out infinite 1s; }
.animate-rotate-slow { animation: rotate-slow 20s linear infinite; }
.animate-pulse-glow { animation: pulse-glow 4s ease-in-out infinite; }
.animate-bounce-subtle { animation: bounce-subtle 2s ease-in-out infinite; }
.animate-gradient { 
  background-size: 200% 200%; 
  animation: gradient-shift 3s ease-in-out infinite; 
}

.animate-text-shimmer {
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--accent-indigo-glow) 50%, var(--text-primary) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: text-shimmer 3s ease-in-out infinite;
}

/* --- Hover Effects --- */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow-indigo);
}

.hover-scale {
  transition: transform var(--transition-fast);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* --- Page Transitions --- */
.page-enter {
  animation: fadeIn 0.5s ease forwards;
}

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

/* --- Particle Background --- */
.particles-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--accent-indigo);
  border-radius: 50%;
  opacity: 0.3;
  animation: float-slow var(--duration, 10s) ease-in-out infinite;
}

/* --- Hero-Specific Animations --- */
.hero-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
}

.hero-glow-orb.indigo {
  background: var(--accent-indigo);
  width: 400px;
  height: 400px;
  top: -100px;
  right: -100px;
  animation: float-slow 10s ease-in-out infinite;
}

.hero-glow-orb.emerald {
  background: var(--accent-emerald);
  width: 300px;
  height: 300px;
  bottom: -50px;
  left: -50px;
  animation: float-slow 12s ease-in-out infinite 2s;
}

.hero-glow-orb.amber {
  background: var(--accent-amber);
  width: 200px;
  height: 200px;
  top: 50%;
  left: 50%;
  animation: float-slow 8s ease-in-out infinite 4s;
}

/* --- Grid Background Lines --- */
.grid-bg {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
