/* Apple-Inspired Animations & Keyframes */

/* Fade 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% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Slide animations */
@keyframes slideInFromTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Rotation animations */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes rotateIn {
  from {
    transform: rotate(-90deg) scale(0);
    opacity: 0;
  }
  to {
    transform: rotate(0) scale(1);
    opacity: 1;
  }
}

/* Gradient animations */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Shimmer effect */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Float animation */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Bounce animation */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

/* Glow effect */
@keyframes glow {
  from {
    box-shadow: 0 0 10px rgba(180, 99, 45, 0.3);
  }
  to {
    box-shadow: 0 0 22px rgba(180, 99, 45, 0.55);
  }
}

/* Wave animation */
@keyframes wave {
  0% {
    transform: rotate(0deg);
  }
  10% {
    transform: rotate(14deg);
  }
  20% {
    transform: rotate(-8deg);
  }
  30% {
    transform: rotate(14deg);
  }
  40% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(10deg);
  }
  60% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Earthy atmosphere animations */
@keyframes emberPulse {
  0% {
    transform: translate3d(-2%, -2%, 0) scale(1);
    opacity: 0.62;
  }
  50% {
    transform: translate3d(2%, 3%, 0) scale(1.08);
    opacity: 0.82;
  }
  100% {
    transform: translate3d(-2%, -2%, 0) scale(1);
    opacity: 0.62;
  }
}

@keyframes chessFloat {
  0% {
    transform: translate3d(0, 0, 0) rotate(-3deg);
  }
  50% {
    transform: translate3d(0, -18px, 0) rotate(3deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(-3deg);
  }
}

@keyframes cyberDrift {
  0% {
    transform: translate3d(0, 0, 0) rotate(-6deg);
    text-shadow: 0 0 12px rgba(90, 241, 255, 0.25);
  }
  40% {
    transform: translate3d(-16px, 12px, 0) rotate(4deg) scale(1.04);
    text-shadow: 0 0 22px rgba(255, 201, 134, 0.3);
  }
  70% {
    transform: translate3d(10px, -14px, 0) rotate(-3deg) scale(0.98);
    text-shadow: 0 0 18px rgba(180, 99, 45, 0.28);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(-6deg);
    text-shadow: 0 0 12px rgba(90, 241, 255, 0.25);
  }
}

@keyframes neonOrbit {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(14px, -18px, 0) rotate(6deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
}

@keyframes glitchSlice {
  0% {
    clip-path: inset(0 0 55% 0);
    transform: translate3d(-1px, -1px, 0);
  }
  25% {
    clip-path: inset(45% 0 10% 0);
    transform: translate3d(1px, 1px, 0);
  }
  50% {
    clip-path: inset(10% 0 40% 0);
    transform: translate3d(-2px, 1px, 0);
  }
  75% {
    clip-path: inset(60% 0 5% 0);
    transform: translate3d(2px, -1px, 0);
  }
  100% {
    clip-path: inset(0 0 55% 0);
    transform: translate3d(-1px, -1px, 0);
  }
}

@keyframes glitchColor {
  0%,
  100% {
    text-shadow:
      0 0 6px rgba(90, 241, 255, 0.4),
      0 0 10px rgba(255, 201, 134, 0.4);
  }
  50% {
    text-shadow:
      0 0 8px rgba(255, 201, 134, 0.45),
      0 0 14px rgba(90, 241, 255, 0.45);
  }
}

@keyframes codeDrift {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 220px 120px, 120px 0;
  }
}

@keyframes codeFall {
  0% {
    background-position-y: 0;
  }
  100% {
    background-position-y: 240px;
  }
}

@keyframes circuitDrift {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0.4;
  }
  50% {
    transform: translate3d(-4%, -2%, 0) rotate(-1deg);
    opacity: 0.55;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 0.4;
  }
}

@keyframes scanSweep {
  0% {
    transform: translateY(-120%);
    opacity: 0;
  }
  20% {
    opacity: 0.25;
  }
  50% {
    opacity: 0.35;
  }
  100% {
    transform: translateY(120%);
    opacity: 0;
  }
}

@keyframes gridPulse {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.28;
  }
}

/* checkeredParallax animation removed - no longer used after hero pattern fix */

/* Utility classes */
.animate-fadeIn {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-fadeInUp {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-fadeInDown {
  animation: fadeInDown 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-scaleIn {
  animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-float {
  animation: float 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-bounce {
  animation: bounce 2s infinite;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

/* Hover animations */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-5px);
}

.hover-grow {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-grow:hover {
  transform: scale(1.05);
}

.hover-rotate {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

/* Loading animations */
.loading-pulse {
  display: inline-block;
  width: 40px;
  height: 40px;
  background-color: var(--color-accent);
  border-radius: 100%;
  animation: scaleIn 1s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.loading-dots {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 20px;
}

.loading-dots div {
  position: absolute;
  top: 8px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--color-accent);
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading-dots div:nth-child(1) {
  left: 8px;
  animation: loading-dots1 0.6s infinite;
}

.loading-dots div:nth-child(2) {
  left: 8px;
  animation: loading-dots2 0.6s infinite;
}

.loading-dots div:nth-child(3) {
  left: 32px;
  animation: loading-dots2 0.6s infinite;
}

.loading-dots div:nth-child(4) {
  left: 56px;
  animation: loading-dots3 0.6s infinite;
}

@keyframes loading-dots1 {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes loading-dots3 {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(0);
  }
}

@keyframes loading-dots2 {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(24px, 0);
  }
}

/* Stagger animation 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; }

/* Performance optimizations */
.will-transform {
  will-change: transform;
}

.gpu-accelerated {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* Smooth scroll enhancements */
@keyframes smoothFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes smoothSlideIn {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes smoothScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scroll-triggered animation classes */
.scroll-fade-in {
  opacity: 0;
  animation: smoothFadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.scroll-slide-in {
  opacity: 0;
  animation: smoothSlideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.scroll-scale-in {
  opacity: 0;
  animation: smoothScale 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Parallax scroll effect */
.parallax-slow {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.parallax-medium {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.parallax-fast {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
