/* ===================================
   Mindfulness AI - Animations
   =================================== */

/* 3D Perspective Setup */
.scene {
  perspective: 1000px;
  transform-style: preserve-3d;
}

/* 3D Card Effects */
@keyframes tilt3D {
  0% {
    transform: rotateX(0deg) rotateY(0deg) scale(1);
  }
  25% {
    transform: rotateX(5deg) rotateY(-5deg) scale(1.02);
  }
  50% {
    transform: rotateX(-5deg) rotateY(5deg) scale(1.02);
  }
  75% {
    transform: rotateX(3deg) rotateY(-3deg) scale(1.02);
  }
  100% {
    transform: rotateX(0deg) rotateY(0deg) scale(1);
  }
}

.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-3d:hover {
  transform: rotateX(-10deg) rotateY(10deg) translateZ(50px);
}

/* 3D Floating Orbs */
@keyframes float3D {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg);
  }
  25% {
    transform: translate3d(12px, -18px, 10px) rotateX(22deg) rotateY(15deg);
  }
  50% {
    transform: translate3d(-10px, -28px, 18px) rotateX(30deg) rotateY(25deg);
  }
  75% {
    transform: translate3d(8px, -20px, 22px) rotateX(22deg) rotateY(15deg);
  }
}

.orb-3d {
  animation: float3D 14s ease-in-out infinite;
  transform-style: preserve-3d;
}

/* Storytelling Animation Sequence */
@keyframes storyReveal {
  0% {
    opacity: 0;
    transform: translate3d(0, 40px, -60px) rotateX(10deg);
  }
  60% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0deg);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0deg);
  }
}

.story-element {
  animation: storyReveal 1s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  transform-origin: center bottom;
}

/* 3D Depth Layers */
.depth-1 { transform: translateZ(10px); }
.depth-2 { transform: translateZ(20px); }
.depth-3 { transform: translateZ(30px); }
.depth-4 { transform: translateZ(40px); }
.depth-5 { transform: translateZ(50px); }

/* Enhanced Lighting Effects */
@keyframes lightPulse {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(42, 168, 151, 0.3),
      0 0 40px rgba(42, 168, 151, 0.2),
      0 0 60px rgba(42, 168, 151, 0.1);
  }
  50% {
    box-shadow:
      0 0 30px rgba(42, 168, 151, 0.5),
      0 0 60px rgba(42, 168, 151, 0.3),
      0 0 90px rgba(42, 168, 151, 0.2);
  }
}

.light-glow {
  animation: lightPulse 3s ease-in-out infinite;
}

/* 3D Transform Hover Effects */
.hover-3d {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.hover-3d:hover {
  transform: rotateX(-8deg) rotateY(8deg) translateZ(12px);
}

/* Narrative Flow Animation */
@keyframes narrativeFlow {
  0% {
    transform: translate3d(-100vw, 0, 0);
    opacity: 0;
  }
  10%, 90% {
    opacity: 1;
  }
  100% {
    transform: translate3d(100vw, 0, 0);
    opacity: 0;
  }
}

.narrative-element {
  animation: narrativeFlow 4s linear infinite;
}

/* 3D Card Flip Animation */
@keyframes cardFlip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

.card-flip {
  transform-style: preserve-3d;
  animation: cardFlip 3s ease-in-out infinite;
}

/* Parallax 3D Effect */
@keyframes parallax3D {
  0% {
    transform: translateZ(0px) scale(1);
  }
  50% {
    transform: translateZ(-50px) scale(1.05);
  }
  100% {
    transform: translateZ(0px) scale(1);
  }
}

.parallax-3d {
  animation: parallax3D 6s ease-in-out infinite;
}

/* Enhanced Gradient Morphing */
@keyframes gradientMorph {
  0%, 100% {
    background-position: 0% 50%;
    filter: hue-rotate(0deg) brightness(1);
  }
  25% {
    background-position: 100% 50%;
    filter: hue-rotate(10deg) brightness(1.1);
  }
  50% {
    background-position: 100% 100%;
    filter: hue-rotate(20deg) brightness(1.2);
  }
  75% {
    background-position: 0% 100%;
    filter: hue-rotate(10deg) brightness(1.1);
  }
}

.gradient-morph {
  animation: gradientMorph 8s ease-in-out infinite;
  background-size: 200% 200%;
}

/* 3D Depth Shadows */
.shadow-3d {
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.1),
    0 20px 40px rgba(0, 0, 0, 0.08),
    0 30px 60px rgba(0, 0, 0, 0.06);
}

.shadow-3d:hover {
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 40px 80px rgba(0, 0, 0, 0.12),
    0 60px 120px rgba(0, 0, 0, 0.09);
}

/* Storytelling Sequence Classes */
.story-step-1 { animation-delay: 0.5s; }
.story-step-2 { animation-delay: 1.0s; }
.story-step-3 { animation-delay: 1.5s; }
.story-step-4 { animation-delay: 2.0s; }
.story-step-5 { animation-delay: 2.5s; }

/* 3D Transform Utilities */
.transform-3d {
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

/* Enhanced Breathing with 3D */
@keyframes breathe3D {
  0%, 100% {
    transform: scale3d(1, 1, 1);
    opacity: 0.8;
  }
  50% {
    transform: scale3d(1.1, 1.1, 1.2);
    opacity: 1;
  }
}

.breathe-3d {
  animation: breathe3D 4s ease-in-out infinite;
}

/* 3D Particle System */
@keyframes particleFloat {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg);
    opacity: 0.7;
  }
  25% {
    transform: translate3d(30px, -40px, 20px) rotateX(120deg) rotateY(60deg);
    opacity: 1;
  }
  50% {
    transform: translate3d(-25px, -80px, 40px) rotateX(240deg) rotateY(120deg);
    opacity: 0.8;
  }
  75% {
    transform: translate3d(15px, -60px, 60px) rotateX(360deg) rotateY(180deg);
    opacity: 0.9;
  }
}

.particle-3d {
  animation: particleFloat 10s ease-in-out infinite;
}

/* Meditation Scene Animations */
@keyframes breathe-circle {
  0%, 100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

@keyframes gentle-float {
  0%, 100% {
    transform: translateY(0);
    filter: drop-shadow(0 5px 15px rgba(61, 191, 175, 0.3));
  }
  50% {
    transform: translateY(-8px);
    filter: drop-shadow(0 15px 25px rgba(61, 191, 175, 0.5));
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(0.95) translateY(0);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05) translateY(-10px);
  }
}

/* 3D Card Stack Effect */
@keyframes stackReveal {
  0% {
    transform: translate3d(0, 50px, -100px) rotateX(20deg);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0) rotateX(0deg);
    opacity: 1;
  }
}

.stack-card-1 { animation: stackReveal 0.8s ease-out forwards; }
.stack-card-2 { animation: stackReveal 0.8s ease-out 0.2s forwards; opacity: 0; }
.stack-card-3 { animation: stackReveal 0.8s ease-out 0.4s forwards; opacity: 0; }

/* Enhanced Visual Effects */
.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.depth-map {
  background:
    radial-gradient(circle at 20% 80%, rgba(42, 168, 151, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 107, 82, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(106, 168, 79, 0.2) 0%, transparent 50%);
}

/* 3D Scene Container */
.scene-container {
  perspective: 1200px;
  perspective-origin: center center;
}

.scene-element {
  transform-style: preserve-3d;
}

/* Fade In Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, -50px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

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

.fade-in-delay-1 {
  animation: fadeIn 0.8s ease-out 0.2s forwards;
  opacity: 0;
}

.fade-in-delay-2 {
  animation: fadeIn 0.8s ease-out 0.4s forwards;
  opacity: 0;
}

.fade-in-delay-3 {
  animation: fadeIn 0.8s ease-out 0.6s forwards;
  opacity: 0;
}

/* Floating Animation */
@keyframes float {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotateX(0deg);
  }
  25% {
    transform: translate3d(0, -12px, 6px) rotateX(3deg);
  }
  50% {
    transform: translate3d(0, -6px, 12px) rotateX(0deg);
  }
  75% {
    transform: translate3d(0, -16px, 16px) rotateX(-3deg);
  }
}

/* Enhanced Bounce */
@keyframes bounce {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -10px, 4px);
  }
}

/* Universe Floating Animation for Feature Particles */
@keyframes floatUniverse {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg);
    opacity: 0.6;
  }
  25% {
    transform: translate3d(40px, -60px, 20px) rotateX(15deg) rotateY(10deg);
    opacity: 0.8;
  }
  50% {
    transform: translate3d(-30px, -80px, 35px) rotateX(25deg) rotateY(20deg);
    opacity: 1;
  }
  75% {
    transform: translate3d(50px, -40px, 25px) rotateX(20deg) rotateY(15deg);
    opacity: 0.7;
  }
}

/* Atmosphere Floating Animation for Screenshot Glows */
@keyframes atmosphereFloat {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.4;
  }
  33% {
    transform: translate3d(30px, -20px, 0) scale(1.1);
    opacity: 0.6;
  }
  66% {
    transform: translate3d(-20px, -35px, 0) scale(0.95);
    opacity: 0.5;
  }
}

/* 3D Parallax */
@keyframes parallax {
  0%, 100% {
    transform: scale3d(1.05, 1.05, 1);
  }
  50% {
    transform: scale3d(1.1, 1.1, 1.05);
  }
}

/* Pulse with 3D */
@keyframes pulse {
  0%, 100% {
    transform: scale3d(1, 1, 1);
    opacity: 1;
  }
  50% {
    transform: scale3d(1.05, 1.05, 1.1);
    opacity: 0.8;
  }
}

/* Shimmer with depth */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
    transform: translateZ(0px);
  }
  100% {
    background-position: 1000px 0;
    transform: translateZ(10px);
  }
}

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

/* Slide In with 3D */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translate3d(-50px, 0, -30px) rotateY(-10deg);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateY(0deg);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translate3d(50px, 0, -30px) rotateY(10deg);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateY(0deg);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 50px, -50px) rotateX(10deg);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0deg);
  }
}

/* Scale In with 3D */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale3d(0.8, 0.8, 0.8) translateZ(-100px);
  }
  to {
    opacity: 1;
    transform: scale3d(1, 1, 1) translateZ(0px);
  }
}

/* Rotate In with 3D */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate3d(0, 0, 1, -10deg) scale3d(0.9, 0.9, 0.9) translateZ(-50px);
  }
  to {
    opacity: 1;
    transform: rotate3d(0, 0, 1, 0deg) scale3d(1, 1, 1) translateZ(0px);
  }
}

/* Scroll-triggered animations with 3D */
.scroll-reveal {
  opacity: 0;
  transform: translate3d(0, 50px, -100px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

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

.scroll-reveal-left.revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

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

.scroll-reveal-right.revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.scroll-reveal-scale {
  opacity: 0;
  transform: scale3d(0.8, 0.8, 0.8) translateZ(-50px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-scale.revealed {
  opacity: 1;
  transform: scale3d(1, 1, 1) translateZ(0px);
}

/* Enhanced hover effects with 3D */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translate3d(0, -8px, 20px);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 0 20px rgba(42, 168, 151, 0.1);
}

.hover-scale:hover {
  transform: scale3d(1.05, 1.05, 1.05);
}

.hover-glow:hover {
  box-shadow:
    0 0 20px rgba(42, 168, 151, 0.5),
    0 0 40px rgba(42, 168, 151, 0.3),
    0 0 60px rgba(42, 168, 151, 0.1);
}

/* 3D Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(42, 168, 151, 0.2);
  border-top-color: #2AA897;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  transform-style: preserve-3d;
}

/* Enhanced gradient animation */
.animated-gradient {
  background-size: 200% 200%;
  animation: gradientShift 6s ease infinite;
  transform-style: preserve-3d;
}

/* 3D Breathing animation */
.breathe {
  animation: breathe 4s ease-in-out infinite;
  transform-origin: center center;
}

/* Ripple effect with 3D */
.ripple-effect {
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0) scale3d(0, 0, 0);
  animation: ripple 0.6s ease-out;
}

/* Text reveal with 3D */
@keyframes textReveal {
  from {
    clip-path: inset(0 100% 0 0);
    transform: translateZ(-50px);
  }
  to {
    clip-path: inset(0 0 0 0);
    transform: translateZ(0px);
  }
}

.text-reveal {
  animation: textReveal 1s ease-out forwards;
}

/* Modal animations with 3D */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translate3d(0, 0, -200px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate3d(0, -50px, -100px) scale3d(0.9, 0.9, 0.9);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
  }
}

.modal.active {
  animation: modalFadeIn 0.3s ease-out;
}

.modal.active .modal-content {
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Attention seekers with 3D */
@keyframes heartbeat {
  0%, 100% {
    transform: scale3d(1, 1, 1);
  }
  10%, 30% {
    transform: scale3d(0.9, 0.9, 0.9);
  }
  20%, 40% {
    transform: scale3d(1.1, 1.1, 1.1);
  }
}

.heartbeat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translate3d(-5px, 0, 0);
  }
  20%, 40%, 60%, 80% {
    transform: translate3d(5px, 0, 0);
  }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

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