/**
 * ArGetia Theme — Animations CSS
 * Keyframes, utility classes, animated gradients, blob floats, page transitions
 */

/* ============================================================
   1. CORE KEYFRAMES
   ============================================================ */

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-40px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-60px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scaleInBounce {
  0%   { opacity: 0; transform: scale(0.7); }
  70%  { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

/* ============================================================
   2. GLOW & BORDER EFFECTS
   ============================================================ */

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(108, 99, 255, 0.25),
                0 0 40px rgba(108, 99, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(108, 99, 255, 0.5),
                0 0 80px rgba(59, 130, 246, 0.3),
                0 0 120px rgba(0, 255, 136, 0.1);
  }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(255, 255, 255, 0.08); }
  50%       { border-color: rgba(108, 99, 255, 0.5); }
}

@keyframes accentGlow {
  0%, 100% { text-shadow: 0 0 10px rgba(0, 255, 136, 0.3); }
  50%       { text-shadow: 0 0 30px rgba(0, 255, 136, 0.7), 0 0 60px rgba(0, 255, 136, 0.3); }
}

@keyframes neonFlicker {
  0%, 95%, 100% { opacity: 1; }
  96%            { opacity: 0.8; }
  97%            { opacity: 1; }
  98%            { opacity: 0.6; }
  99%            { opacity: 1; }
}

/* ============================================================
   3. GRADIENT ANIMATIONS
   ============================================================ */

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

@keyframes gradientRotate {
  0%   { transform: rotate(0deg) scale(1.5); }
  100% { transform: rotate(360deg) scale(1.5); }
}

@keyframes hueRotate {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* ============================================================
   4. BLOB / ORB ANIMATIONS
   ============================================================ */

@keyframes blobFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(-20px) rotate(5deg) scale(1.02);
  }
  50% {
    transform: translateY(-10px) rotate(-3deg) scale(0.98);
  }
  75% {
    transform: translateY(-30px) rotate(8deg) scale(1.03);
  }
}

@keyframes blobMorph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25%       { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  50%       { border-radius: 50% 60% 30% 40% / 40% 50% 60% 50%; }
  75%       { border-radius: 40% 50% 60% 30% / 60% 40% 40% 60%; }
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%       { transform: scale(1.1); opacity: 0.8; }
}

/* ============================================================
   5. UI MICRO INTERACTIONS
   ============================================================ */

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

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
  50%       { transform: translateY(-12px); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

@keyframes ping {
  0%        { transform: scale(1); opacity: 1; }
  75%, 100% { transform: scale(2); opacity: 0; }
}

@keyframes cursorRipple {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

@keyframes navScrollHide {
  from { transform: translateX(-50%) translateY(0); opacity: 1; }
  to   { transform: translateX(-50%) translateY(-100px); opacity: 0; }
}

@keyframes navScrollShow {
  from { transform: translateX(-50%) translateY(-100px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ============================================================
   6. TEXT ANIMATIONS
   ============================================================ */

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

@keyframes blinkCaret {
  0%, 100% { border-right-color: var(--accent-primary); }
  50%       { border-right-color: transparent; }
}

@keyframes textRevealUp {
  from { clip-path: inset(100% 0 0 0); transform: translateY(20px); }
  to   { clip-path: inset(0 0 0 0); transform: translateY(0); }
}

@keyframes letterSpacingExpand {
  from { letter-spacing: -0.1em; opacity: 0; }
  to   { letter-spacing: normal; opacity: 1; }
}

/* ============================================================
   7. PAGE TRANSITION
   ============================================================ */

@keyframes pageEnter {
  from { clip-path: circle(150% at 50% 50%); }
  to   { clip-path: circle(0% at 50% 50%); }
}

@keyframes pageExit {
  from { clip-path: circle(0% at 50% 50%); }
  to   { clip-path: circle(150% at 50% 50%); }
}

@keyframes slideInFromRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slideOutToLeft {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ============================================================
   8. SKILL BAR & COUNTER
   ============================================================ */

@keyframes skillFill {
  from { width: 0%; }
  to   { width: var(--skill-width, 100%); }
}

@keyframes counterUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   9. SCROLL INDICATOR
   ============================================================ */

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0) translateX(-50%); opacity: 1; }
  50%       { transform: translateY(8px) translateX(-50%); opacity: 0.5; }
}

@keyframes mouseScroll {
  0%   { top: 6px; opacity: 1; }
  100% { top: 18px; opacity: 0; }
}

/* ============================================================
   10. NOISE / GRAIN TEXTURE
   ============================================================ */

@keyframes noiseMove {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-2%, -3%); }
  20%  { transform: translate(3%, 2%); }
  30%  { transform: translate(-1%, 4%); }
  40%  { transform: translate(2%, -1%); }
  50%  { transform: translate(-3%, 3%); }
  60%  { transform: translate(1%, -2%); }
  70%  { transform: translate(-2%, 1%); }
  80%  { transform: translate(3%, -3%); }
  90%  { transform: translate(-1%, 2%); }
  100% { transform: translate(0, 0); }
}

/* ============================================================
   11. UTILITY ANIMATION CLASSES
   ============================================================ */

/* Base state — hidden before animation */
.gsap-hidden {
  opacity: 0;
  transform: translateY(30px);
}

.gsap-hidden-left {
  opacity: 0;
  transform: translateX(-50px);
}

.gsap-hidden-right {
  opacity: 0;
  transform: translateX(50px);
}

.gsap-hidden-scale {
  opacity: 0;
  transform: scale(0.9);
}

/* CSS-only animation classes (non-GSAP fallback) */
.animate-fade-up {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.animate-fade-down {
  animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.animate-fade-left {
  animation: fadeInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.animate-fade-right {
  animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.animate-fade {
  animation: fadeIn 0.6s ease forwards;
  opacity: 0;
}

.animate-scale-in {
  animation: scaleIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.animate-scale-bounce {
  animation: scaleInBounce 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

/* Stagger delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }

/* Continuous animations */
.animate-glow {
  animation: glowPulse 3s ease-in-out infinite;
}

.animate-border-glow {
  animation: borderGlow 3s ease-in-out infinite;
}

.animate-blob-float {
  animation: blobFloat 6s ease-in-out infinite;
}

.animate-blob-float-slow {
  animation: blobFloat 9s ease-in-out infinite reverse;
}

.animate-blob-morph {
  animation: blobMorph 8s ease-in-out infinite;
}

.animate-orb-pulse {
  animation: orbPulse 4s ease-in-out infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-bounce {
  animation: bounce 1s infinite;
}

.animate-ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.animate-neon-flicker {
  animation: neonFlicker 5s linear infinite;
}

.animate-gradient {
  background-size: 400% 400%;
  animation: gradientShift 6s ease infinite;
}

/* ============================================================
   12. ANIMATED GRADIENT BACKGROUND
   ============================================================ */

.animated-gradient-bg {
  background: linear-gradient(
    135deg,
    #0a0f1e 0%,
    #0d1530 25%,
    #0f1035 50%,
    #0d1530 75%,
    #0a0f1e 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 10s ease infinite;
}

.hero-gradient-animated {
  background: radial-gradient(
    ellipse at 20% 50%,
    rgba(108, 99, 255, 0.15) 0%,
    transparent 60%
  ),
  radial-gradient(
    ellipse at 80% 20%,
    rgba(59, 130, 246, 0.12) 0%,
    transparent 60%
  ),
  radial-gradient(
    ellipse at 60% 80%,
    rgba(0, 255, 136, 0.06) 0%,
    transparent 50%
  );
  animation: gradientShift 12s ease-in-out infinite;
}

/* ============================================================
   13. BLOB / ORB ELEMENT STYLES
   ============================================================ */

.blob-1 {
  animation: blobFloat 6s ease-in-out infinite,
             blobMorph 10s ease-in-out infinite;
}

.blob-2 {
  animation: blobFloat 8s ease-in-out infinite reverse,
             blobMorph 12s ease-in-out infinite reverse;
}

.glow-orb {
  border-radius: 50%;
  filter: blur(80px);
  animation: orbPulse 5s ease-in-out infinite;
  pointer-events: none;
}

/* ============================================================
   14. PAGE TRANSITION OVERLAY
   ============================================================ */

#page-transition {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-deep, #0a0f1e);
  clip-path: circle(0% at 50% 50%);
  transition: clip-path 0.65s cubic-bezier(0.76, 0, 0.24, 1);
  pointer-events: none;
}

#page-transition.active {
  clip-path: circle(150% at 50% 50%);
  pointer-events: all;
}

/* ============================================================
   15. SHIMMER / LOADING STATES
   ============================================================ */

.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

.skeleton {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.06),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

/* ============================================================
   16. SCROLL INDICATOR
   ============================================================ */

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
  animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-mouse {
  width: 24px;
  height: 38px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  position: relative;
}

.scroll-mouse::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 6px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 2px;
  animation: mouseScroll 1.5s ease infinite;
}

/* ============================================================
   17. WORD / TEXT REVEAL HELPERS
   ============================================================ */

.word-wrap {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.05em;
}

.word {
  display: inline-block;
}

.char {
  display: inline-block;
}

/* Text gradient animation */
.text-gradient-animate {
  background: linear-gradient(
    135deg,
    var(--accent-primary) 0%,
    var(--accent-secondary) 50%,
    var(--accent-green) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s linear infinite;
}

/* ============================================================
   18. NOISE OVERLAY ANIMATION
   ============================================================ */

.noise-overlay {
  animation: noiseMove 0.5s steps(1) infinite;
  will-change: transform;
}

/* ============================================================
   19. BUTTON HOVER STATES
   ============================================================ */

.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-primary:hover::after {
  opacity: 1;
}

/* Ripple on click */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%) scale(0);
  animation: cursorRipple 0.6s linear;
  pointer-events: none;
  width: 100px;
  height: 100px;
}

/* ============================================================
   20. REDUCE MOTION SUPPORT
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .blob-1,
  .blob-2,
  .glow-orb,
  .animate-blob-float,
  .animate-blob-float-slow,
  .noise-overlay {
    animation: none !important;
  }
}
