/* Enhanced Animations CSS for Portfolio Website */

/* ===== Performance Optimizations ===== */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .laser-flow-container {
    display: none;
  }
}

/* ===== Page Load Fixes ===== */
html {
  scroll-behavior: smooth;
}

body {
  opacity: 1 !important;
  visibility: visible !important;
  background: var(--bg-color, #0a0a0a) !important;
}

/* Typewriter cursor effect */
.typewriter {
  border-right: 0.15em solid transparent;
  white-space: nowrap;
  margin: 0;
  letter-spacing: 0.02em;
}

/* ===== Laser Flow Effect ===== */
.laser-flow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 1;
}

.laser-beam {
  position: absolute;
  width: 2px;
  height: 100vh;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(147, 51, 234, 0.8) 20%,
    rgba(236, 72, 153, 1) 50%,
    rgba(147, 51, 234, 0.8) 80%,
    transparent 100%
  );
  filter: blur(0.5px);
  animation: laserPulse 3s ease-in-out infinite;
}

.laser-beam::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 255, 255, 0.9) 20%,
    rgba(255, 255, 255, 1) 50%,
    rgba(255, 255, 255, 0.9) 80%,
    transparent 100%
  );
  transform: translateX(-50%);
  filter: blur(0.2px);
}

.laser-beam::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 6px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(147, 51, 234, 0.3) 20%,
    rgba(236, 72, 153, 0.4) 50%,
    rgba(147, 51, 234, 0.3) 80%,
    transparent 100%
  );
  transform: translateX(-50%);
  filter: blur(2px);
}

.laser-glow {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(
    circle,
    rgba(236, 72, 153, 0.8) 0%,
    rgba(147, 51, 234, 0.4) 40%,
    transparent 70%
  );
  border-radius: 50%;
  filter: blur(1px);
  animation: laserGlow 2s ease-in-out infinite alternate;
}

@keyframes laserPulse {
  0%, 100% {
    opacity: 0.6;
    transform: scaleX(1);
  }
  50% {
    opacity: 1;
    transform: scaleX(1.5);
  }
}

@keyframes laserGlow {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes laserMove {
  0% {
    transform: translateX(-100px);
  }
  100% {
    transform: translateX(calc(100vw + 100px));
  }
}

.laser-beam.moving {
  animation: laserMove 8s linear infinite, laserPulse 3s ease-in-out infinite;
}

/* Laser intensity variants */
.laser-beam.intense {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(147, 51, 234, 1) 20%,
    rgba(236, 72, 153, 1.2) 50%,
    rgba(147, 51, 234, 1) 80%,
    transparent 100%
  );
  width: 3px;
  filter: blur(0.3px);
}

.laser-beam.subtle {
  opacity: 0.4;
  width: 1px;
  filter: blur(1px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .laser-beam {
    width: 1.5px;
  }
  
  .laser-glow {
    width: 15px;
    height: 15px;
  }
}

/* Ensure hero section is always visible */
.hero {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

/* Fix for sections being hidden initially */
section {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Override AOS hidden state for critical sections */
[data-aos] {
  opacity: 1 !important;
  transform: none !important;
}

/* Re-enable animations after page loads */
body.animations-ready [data-aos] {
  opacity: 0;
  transform: translateY(50px);
}

body.animations-ready section:not(.animated) {
  opacity: 0;
  transform: translateY(50px);
}

/* ===== Lenis Smooth Scrolling Enhancement ===== */
html.lenis {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

/* ===== Base Animation Variables ===== */
:root {
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out-quart: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-out-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --animation-speed: 0.6s;
  --stagger-delay: 0.1s;
  --lenis-easing: cubic-bezier(0.25, 0.0, 0.35, 1.0);
}

/* ===== Scroll Reveal Animations ===== */
.reveal-animation {
  opacity: 0;
  transform: translateY(60px) scale(0.95);
  transition: all var(--animation-speed) var(--ease-out-quart);
  will-change: transform, opacity;
}

.reveal-animation.revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.reveal-left {
  transform: translateX(-60px) scale(0.95);
}

.reveal-right {
  transform: translateX(60px) scale(0.95);
}

.reveal-scale {
  transform: scale(0.8);
}

/* ===== Enhanced Project Card Animations ===== */
.project-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-out-quart);
  transform-origin: center;
  will-change: transform;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(108, 99, 255, 0.1),
    transparent
  );
  transition: left 0.6s ease;
  z-index: 1;
}

.project-card:hover::before {
  left: 100%;
}

.project-card .project-image {
  overflow: hidden;
  transition: transform 0.4s var(--ease-out-quart);
}

.project-card:hover .project-image img {
  transform: scale(1.1);
  transition: transform 0.4s var(--ease-out-quart);
}

.project-card .project-content {
  position: relative;
  z-index: 2;
}

/* ===== Advanced Button Animations ===== */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-out-quart);
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.6s var(--ease-out-quart);
  z-index: 0;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn span {
  position: relative;
  z-index: 1;
}

/* ===== Navigation Animations ===== */
.nav-links {
  position: relative;
}

.nav-links a {
  position: relative;
  transition: all 0.3s var(--ease-out-quart);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #6c63ff, #00c7b7);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease-out-quart);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* ===== Enhanced Filter Button Animations ===== */
.filter-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-out-quart);
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #6c63ff, #00c7b7);
  transition: left 0.3s var(--ease-out-quart);
  z-index: -1;
}

.filter-btn.active::before,
.filter-btn:hover::before {
  left: 0;
}

.filter-btn.active {
  color: white;
  transform: scale(1.05);
}

/* ===== Hero Section Animations ===== */
.hero-content > * {
  opacity: 0;
  transform: translateY(40px);
  animation: heroReveal 0.8s var(--ease-out-quart) forwards;
}

.hero-content > *:nth-child(1) { animation-delay: 0.2s; }
.hero-content > *:nth-child(2) { animation-delay: 0.4s; }
.hero-content > *:nth-child(3) { animation-delay: 0.6s; }
.hero-content > *:nth-child(4) { animation-delay: 0.8s; }

@keyframes heroReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Typewriter Effect Enhancement ===== */
.typewriter {
  position: relative;
  overflow: hidden;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ===== Form Animations ===== */
.form-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
  transition: all 0.3s var(--ease-out-quart);
  border: 2px solid transparent;
}

.form-group input:focus,
.form-group textarea:focus {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(108, 99, 255, 0.2);
  border-color: #6c63ff;
}

/* ===== Back to Top Button Animation ===== */
.back-to-top {
  transition: all 0.4s var(--ease-out-back);
  transform: translateY(100px) rotate(180deg) scale(0);
}

.back-to-top.active {
  transform: translateY(0) rotate(0deg) scale(1);
}

.back-to-top:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 15px 30px rgba(108, 99, 255, 0.3);
}

/* ===== Section Transition Animations ===== */
section {
  position: relative;
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s var(--ease-out-quart);
}

section.animated {
  opacity: 1;
  transform: translateY(0);
}

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #6c63ff, transparent);
  opacity: 0;
  transition: opacity 0.6s ease;
}

section.animated::before {
  opacity: 0.3;
}

/* ===== Staggered Content Animations ===== */
.stagger-animation > * {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s var(--ease-out-quart);
}

.stagger-animation.animate > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-animation.animate > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-animation.animate > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-animation.animate > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-animation.animate > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-animation.animate > *:nth-child(6) { transition-delay: 0.6s; }

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



/* ===== Loading Animations ===== */
.loading-shimmer {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

/* ===== Parallax Elements ===== */
.parallax-element {
  will-change: transform;
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ===== Dark Mode Specific Animations ===== */
body.dark-mode .project-card::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 199, 183, 0.1),
    transparent
  );
}

body.dark-mode .nav-links a::after {
  background: linear-gradient(90deg, #00c7b7, #6c63ff);
}

/* ===== Performance Optimizations ===== */
.project-card,
.filter-btn,
.back-to-top,
.nav-links a {
  backface-visibility: hidden;
  perspective: 1000px;
  transform-style: preserve-3d;
}

/* ===== Lenis Integration Optimizations ===== */
body {
  overscroll-behavior: none;
}

/* Smooth transitions for Lenis scroll events */
.parallax-element {
  will-change: transform;
  transform: translateZ(0);
}

/* Enhanced scroll progress with Lenis */
.scroll-progress {
  will-change: transform;
}

/* Optimize floating animations for Lenis */
.floating {
  will-change: transform;
  transform: translateZ(0);
}

/* ===== Reduced Motion Support ===== */
@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;
  }
  
  .parallax-element {
    transform: none !important;
  }
}

/* ===== High Contrast Mode Support ===== */
@media (prefers-contrast: high) {
  .scroll-progress-bar {
    background: #000;
  }
  
  body.dark-mode .scroll-progress-bar {
    background: #fff;
  }
}

/* ===== Custom Scroll Animations ===== */
.scroll-fade-in {
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.scroll-fade-in.visible {
  opacity: 1;
}

.scroll-slide-up {
  transform: translateY(50px);
  opacity: 0;
  transition: all 0.6s var(--ease-out-quart);
}

.scroll-slide-up.visible {
  transform: translateY(0);
  opacity: 1;
}

.scroll-scale-in {
  transform: scale(0.8);
  opacity: 0;
  transition: all 0.6s var(--ease-out-back);
}

.scroll-scale-in.visible {
  transform: scale(1);
  opacity: 1;
}

/* ===== Micro Interactions ===== */
.interactive-element {
  transition: all 0.2s ease;
  cursor: pointer;
}

.interactive-element:hover {
  transform: translateY(-2px);
}

.interactive-element:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

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

.floating {
  animation: float 3s ease-in-out infinite;
}

.floating:nth-child(2) {
  animation-delay: 0.5s;
}

.floating:nth-child(3) {
  animation-delay: 1s;
}

/* ===== Pulse Animation ===== */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(108, 99, 255, 0);
  }
}

.pulse-animation {
  animation: pulse 2s infinite;
} 