/* Animation Styles */

/* Scroll-triggered animations */
@keyframes fadeInUp {
  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);
  }
}

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

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

/* Animation classes that will be applied by JavaScript */
.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease-out forwards;
}

.animate-fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

.animate-scale-in {
  animation: scaleIn 0.5s ease-out forwards;
}

/* Staggered animation delays */
.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-400 { animation-delay: 0.4s; }
.animate-delay-500 { animation-delay: 0.5s; }
.animate-delay-600 { animation-delay: 0.6s; }

/* Initial states for elements that will be animated */
.animate-on-scroll {
  opacity: 0;
  will-change: transform, opacity;
}

.animate-on-scroll.fade-up {
  transform: translateY(30px);
}

.animate-on-scroll.fade-left {
  transform: translateX(-30px);
}

.animate-on-scroll.fade-right {
  transform: translateX(30px);
}

.animate-on-scroll.scale {
  transform: scale(0.9);
}

/* Hero section animations */
.hero-title {
  animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-subtitle {
  animation: fadeInUp 1s ease-out 0.4s both;
}

.hero-cta {
  animation: fadeInUp 1s ease-out 0.6s both;
}

/* Navigation animations */
.nav-header {
  animation: fadeInUp 0.8s ease-out both;
}

/* Loading animation for content */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.loading-shimmer {
  background: linear-gradient(
    90deg,
    var(--glass-bg) 0px,
    rgba(255, 255, 255, 0.2) 40px,
    var(--glass-bg) 80px
  );
  background-size: 400px;
  animation: shimmer 1.2s ease-in-out infinite;
}

/* Hover animations for interactive elements */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

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

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

/* Pulse animation for attention */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

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

/* Bounce animation */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translate3d(0, -30px, 0);
  }
  70% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0, -4px, 0);
  }
}

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

/* Progress bar animation */
.scroll-progress {
  transform-origin: left;
  transition: transform var(--transition-fast);
}

/* Parallax effect simulation */
.parallax-slow {
  transition: transform 0.1s ease-out;
}

/* Text animations */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

.typewriter-text {
  overflow: hidden;
  border-right: 2px solid var(--accent-color);
  white-space: nowrap;
  animation: typewriter 3s steps(40) 1s both, blink 0.5s step-end infinite 1s;
}

/* Section transition animations */
.section-transition {
  transition: all var(--transition-slow);
}

.section-transition.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Card entrance animations */
.card-entrance {
  animation: scaleIn 0.6s ease-out both;
}

.card-entrance:nth-child(1) { animation-delay: 0.1s; }
.card-entrance:nth-child(2) { animation-delay: 0.2s; }
.card-entrance:nth-child(3) { animation-delay: 0.3s; }
.card-entrance:nth-child(4) { animation-delay: 0.4s; }
.card-entrance:nth-child(5) { animation-delay: 0.5s; }
.card-entrance:nth-child(6) { animation-delay: 0.6s; }

/* Smooth scrolling enhancements */
@supports (scroll-behavior: smooth) {
  html {
    scroll-behavior: smooth;
  }
}

/* Intersection Observer triggered animations */
.observe-fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.observe-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.observe-slide-left {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.observe-slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.observe-slide-right {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.observe-slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Performance optimizations */
.gpu-accelerate {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Force GPU acceleration for smooth animations */
.thought-card, .idea-card, .project-card, .reading-item,
.observation-content, .cta-button, .nav-header {
  will-change: transform;
  transform: translateZ(0);
}

/* Optimize transforms for 60fps */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale3d(0.9, 0.9, 1);
  }
  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

/* Reduced motion preferences */
@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-slow {
    transform: none !important;
  }
  
  .hover-lift:hover {
    transform: none !important;
  }
  
  .hover-scale:hover {
    transform: none !important;
  }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }
  
  .observe-fade-in,
  .observe-slide-left,
  .observe-slide-right {
    opacity: 1;
    transform: none;
  }
}
