/* ================================
   Animation Keyframes
   ================================ */

/* Fade In Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

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

/* Scale Animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px var(--color-accent-glow);
  }
  50% {
    box-shadow: 0 0 40px var(--color-accent-glow), 0 0 60px var(--color-accent-glow);
  }
}

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

/* Glow Pulse */
@keyframes glowPulse {
  0%, 100% {
    filter: blur(80px);
    opacity: 0.15;
  }
  50% {
    filter: blur(100px);
    opacity: 0.25;
  }
}

/* Slide In Timeline */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Shimmer Effect */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Line Draw */
@keyframes drawLine {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Gradient Animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Rotate */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ================================
   Initial Hidden States
   ================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

/* Staggered children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.stagger-children.active > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children.active > *:nth-child(2) { transition-delay: 100ms; }
.stagger-children.active > *:nth-child(3) { transition-delay: 200ms; }
.stagger-children.active > *:nth-child(4) { transition-delay: 300ms; }
.stagger-children.active > *:nth-child(5) { transition-delay: 400ms; }
.stagger-children.active > *:nth-child(6) { transition-delay: 500ms; }
.stagger-children.active > *:nth-child(7) { transition-delay: 600ms; }
.stagger-children.active > *:nth-child(8) { transition-delay: 700ms; }
.stagger-children.active > *:nth-child(9) { transition-delay: 800ms; }
.stagger-children.active > *:nth-child(10) { transition-delay: 900ms; }

.stagger-children.active > * {
  opacity: 1;
  transform: translateY(0);
}

/* ================================
   Hero Animations
   ================================ */
.hero-content {
  animation: fadeIn 1s ease forwards;
}

.hero-image-container {
  animation: scaleIn 0.8s ease 0.2s forwards;
  opacity: 0;
}

.hero-greeting {
  animation: fadeInUp 0.6s ease 0.4s forwards;
  opacity: 0;
}

.hero-name {
  animation: fadeInUp 0.6s ease 0.5s forwards;
  opacity: 0;
}

.hero-title-wrapper {
  animation: fadeInUp 0.6s ease 0.6s forwards;
  opacity: 0;
}

.hero-description {
  animation: fadeInUp 0.6s ease 0.7s forwards;
  opacity: 0;
}

.hero-cta {
  animation: fadeInUp 0.6s ease 0.8s forwards;
  opacity: 0;
}

.scroll-indicator {
  animation: fadeIn 1s ease 1.5s forwards, float 2s ease-in-out 2s infinite;
  opacity: 0;
}

/* Glow orb animations */
.glow-orb-1 {
  animation: glowPulse 4s ease-in-out infinite, float 6s ease-in-out infinite;
}

.glow-orb-2 {
  animation: glowPulse 5s ease-in-out 1s infinite, float 8s ease-in-out 0.5s infinite;
}

/* Hero image glow pulse */
.hero-image-glow {
  animation: pulseGlow 3s ease-in-out infinite;
}

/* ================================
   Navigation Animations
   ================================ */
.navbar {
  animation: fadeInDown 0.5s ease forwards;
}

.nav-menu li {
  animation: fadeInDown 0.5s ease forwards;
  opacity: 0;
}

.nav-menu li:nth-child(1) { animation-delay: 0.1s; }
.nav-menu li:nth-child(2) { animation-delay: 0.15s; }
.nav-menu li:nth-child(3) { animation-delay: 0.2s; }
.nav-menu li:nth-child(4) { animation-delay: 0.25s; }
.nav-menu li:nth-child(5) { animation-delay: 0.3s; }
.nav-menu li:nth-child(6) { animation-delay: 0.35s; }

/* ================================
   Section Title Animations
   ================================ */
.section-title {
  position: relative;
}

.section-title.active::after {
  animation: expandWidth 0.8s ease forwards;
}

@keyframes expandWidth {
  from {
    width: 0;
  }
  to {
    width: 100%;
    max-width: 300px;
  }
}

/* ================================
   Timeline Animations
   ================================ */
.timeline-line {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1s ease;
}

.timeline-line.active {
  transform: scaleY(1);
}

.timeline-item {
  opacity: 0;
}

.timeline-item:nth-child(odd) {
  transform: translateX(-50px);
}

.timeline-item:nth-child(even) {
  transform: translateX(50px);
}

.timeline-item.active {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-marker {
  transform: scale(0);
  transition: transform 0.4s ease;
}

.timeline-item.active .timeline-marker {
  transform: scale(1);
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ================================
   Experience Item Animations
   ================================ */
.experience-item {
  opacity: 0;
  transform: translateX(-30px);
}

.experience-item.active {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.15s ease, box-shadow 0.25s ease;
}

.experience-item:nth-child(1).active { transition-delay: 0s; }
.experience-item:nth-child(2).active { transition-delay: 0.15s; }
.experience-item:nth-child(3).active { transition-delay: 0.3s; }
.experience-item:nth-child(4).active { transition-delay: 0.45s; }

/* ================================
   Project Card Animations
   ================================ */
.project-card {
  opacity: 0;
  transform: translateY(40px);
}

.project-card.active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

/* Tilt effect handled by JS */
.project-card[data-tilt] {
  /* 3D transforms removed to prevent blur */
}

/* ================================
   Skills Animations
   ================================ */
.skills-categories {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.skills-categories.active {
  opacity: 1;
  transform: translateY(0);
}

/* Skills row stagger animation */
.skills-row {
  opacity: 0;
  transform: translateX(-20px);
}

.skills-categories.active .skills-row {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.15s ease;
}

.skills-categories.active .skills-row:nth-child(1) { transition-delay: 0.1s; }
.skills-categories.active .skills-row:nth-child(2) { transition-delay: 0.2s; }
.skills-categories.active .skills-row:nth-child(3) { transition-delay: 0.3s; }
.skills-categories.active .skills-row:nth-child(4) { transition-delay: 0.4s; }

/* ================================
   Education Animations
   ================================ */
.education-card {
  opacity: 0;
  transform: translateY(30px);
}

.education-card.active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.education-icon {
  animation: none;
  transition: transform 0.3s ease;
}

.education-card:hover .education-icon {
  transform: scale(1.1);
}

/* ================================
   Contact Animations
   ================================ */
.contact-content {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.contact-content.active {
  opacity: 1;
  transform: translateY(0);
}

/* Form input focus animations */
.form-group input,
.form-group textarea {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Social link animations */
.social-link {
  opacity: 0;
  transform: translateY(20px);
}

.contact-content.active .social-link {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.contact-content.active .social-link:nth-child(1) { transition-delay: 0.4s; }
.contact-content.active .social-link:nth-child(2) { transition-delay: 0.5s; }
.contact-content.active .social-link:nth-child(3) { transition-delay: 0.6s; }

/* ================================
   About Block Animation
   ================================ */
.about-block {
  opacity: 0;
  transform: translateY(20px);
}

.about-block.active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.15s ease, box-shadow 0.25s ease;
}

.about-block:nth-child(1).active { transition-delay: 0s; }
.about-block:nth-child(2).active { transition-delay: 0.15s; }
.about-block:nth-child(3).active { transition-delay: 0.3s; }

/* ================================
   Loading Animation
   ================================ */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

/* ================================
   Parallax Effect Classes
   ================================ */
.parallax {
  will-change: transform;
}

.parallax-slow {
  transform: translateY(calc(var(--scroll-y) * 0.1));
}

.parallax-medium {
  transform: translateY(calc(var(--scroll-y) * 0.2));
}

.parallax-fast {
  transform: translateY(calc(var(--scroll-y) * 0.3));
}

/* ================================
   Hover Effect Enhancements
   ================================ */
.hover-lift {
  transition: transform 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 30px var(--color-accent-glow);
}

/* ================================
   Text Gradient Animation
   ================================ */
.text-gradient-animated {
  background: linear-gradient(
    90deg,
    var(--color-accent),
    var(--color-accent-secondary),
    var(--color-accent)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}

/* ================================
   Reduced Motion
   ================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .stagger-children > * {
    opacity: 1;
    transform: none;
  }
}
