/* ==========================================================================
   Motion Styles - Any Brew Goonies-Inspired Landing Page
   ========================================================================== */

/* Keyframe Animations */
@keyframes treasureGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
  }
}

@keyframes cavePulse {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

@keyframes portalSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes floatUp {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  0% {
    transform: translateX(-50px);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

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

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

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

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

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

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

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

@keyframes wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(5deg);
  }
  75% {
    transform: rotate(-5deg);
  }
}

/* Scroll-triggered animations */
.animate-on-scroll {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.6s ease-out;
}

.animate-on-scroll.animate {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll.animate-left {
  transform: translateX(0);
}

.animate-on-scroll.animate-left.animate {
  transform: translateX(0);
}

.animate-on-scroll.animate-right {
  transform: translateX(0);
}

.animate-on-scroll.animate-right.animate {
  transform: translateX(0);
}

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

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

/* Hover animations */
.hover-lift {
  transition: all 0.3s ease;
}

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

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

.hover-glow:hover {
  /* Glow effect removed */
}

.hover-scale {
  transition: all 0.3s ease;
}

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

.hover-rotate {
  transition: all 0.3s ease;
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

/* Loading animations */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 215, 0, 0.3);
  border-top: 4px solid var(--treasure-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}

/* Parallax effects */
.parallax-slow {
  transform: translateY(var(--parallax-offset, 0));
  transition: transform 0.1s ease-out;
}

.parallax-fast {
  transform: translateY(calc(var(--parallax-offset, 0) * 0.5));
  transition: transform 0.1s ease-out;
}

/* Stagger animations */
.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; }
.stagger-6 { animation-delay: 0.6s; }

/* Hero scroll zoom/blur image effect (inspired by scroll-driven image effects) */
.hero-scroll-zoom {
  transition: transform 0.4s ease-out, filter 0.4s ease-out;
  transform: translateY(var(--hero-translate, 0)) scale(var(--hero-scale, 1));
  filter: blur(var(--hero-blur, 0)) brightness(1);
}

/* Hero text slide off animation */
.hero__text {
  transition: transform 0.8s ease-out;
  will-change: transform;
}

.hero__text.slide-off {
  transform: translateX(-100vw);
}

.hero__text.slide-off-right {
  transform: translateX(100vw);
}

/* Bold text animation */
:root {
  --background: #f8f9fa;
  --base: #2c3e50;
  --accent: #5a6c7d;
  --shadow: #34495e;
}

.bold-animation {
  font: bold 1.2rem/1.6 sans-serif;
  max-width: 100%;
  position: relative;
  margin: 0 auto var(--space-xl);
  background: rgba(255, 255, 255, 0.95);
  padding: var(--space-2xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.bold-animation span {
  color: var(--shadow);
  display: inline-block;
  position: relative;
}

.bold-animation span:nth-child(1) { animation-delay: 0s; }
.bold-animation span:nth-child(2) { animation-delay: 0.1s; }
.bold-animation span:nth-child(3) { animation-delay: 0.2s; }
.bold-animation span:nth-child(4) { animation-delay: 0.3s; }
.bold-animation span:nth-child(5) { animation-delay: 0.4s; }
.bold-animation span:nth-child(6) { animation-delay: 0.5s; }
.bold-animation span:nth-child(7) { animation-delay: 0.6s; }
.bold-animation span:nth-child(8) { animation-delay: 0.7s; }
.bold-animation span:nth-child(9) { animation-delay: 0.8s; }
.bold-animation span:nth-child(10) { animation-delay: 0.9s; }
.bold-animation span:nth-child(11) { animation-delay: 1.0s; }
.bold-animation span:nth-child(12) { animation-delay: 1.1s; }
.bold-animation span:nth-child(13) { animation-delay: 1.2s; }
.bold-animation span:nth-child(14) { animation-delay: 1.3s; }
.bold-animation span:nth-child(15) { animation-delay: 1.4s; }

@media (prefers-reduced-motion) {
  .bold-animation span {
    color: var(--base);
  }
}

.bold-animation span::before {
  animation: max-height 0.4s cubic-bezier(0.61, 1, 0.88, 1) 1 normal both;
  color: var(--accent);
}

.bold-animation span::after {
  animation: max-width 0.7s cubic-bezier(0.61, 1, 0.88, 1) 1 normal both;
  color: var(--base);
}

.bold-animation span::before,
.bold-animation span::after {
  content: attr(data-text);
  left: 0;
  overflow: hidden;
  position: absolute;
  speak: none;
}

@media (prefers-reduced-motion) {
  .bold-animation span::before,
  .bold-animation span::after {
    animation: none;
    content: "";
  }
}

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

@keyframes max-height {
  from {
    max-height: 0;
  }
  to {
    max-height: 100%;
  }
}

/* Testimonial scroll animations */
.testimonial-card {
  opacity: 0;
  transform: translateX(-100px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.testimonial-card:nth-child(2) {
  transform: translateX(100px);
}

.testimonial-card:nth-child(3) {
  transform: translateY(50px);
}

.testimonial-card:nth-child(4) {
  transform: translateX(-100px) rotate(-5deg);
}

.testimonial-card.animate-in {
  opacity: 1;
  transform: translateX(0) translateY(0) rotate(0);
}

.testimonial-card.animate-in:nth-child(1) {
  animation: slideInLeft 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.testimonial-card.animate-in:nth-child(2) {
  animation: slideInRight 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.testimonial-card.animate-in:nth-child(3) {
  animation: slideInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.testimonial-card.animate-in:nth-child(4) {
  animation: slideInRotate 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

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

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

@keyframes slideInRotate {
  from {
    opacity: 0;
    transform: translateX(-100px) rotate(-5deg);
  }
  to {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

/* Increase overlay opacity slightly when scrolling */
body.scrolling .hero__overlay {
  background: rgba(0, 0, 0, 0.18);
}

/* Section transitions - smooth reveals */
.snap-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  background: #ffffff;
  will-change: opacity, transform;
}

.snap-section.section-active {
  opacity: 1;
  transform: translateY(0);
}

/* Hero to first section transition */
.make-any-drink {
  transform: translateY(0) scale(1);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.make-any-drink.section-active {
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .snap-section,
  .snap-section::before {
    transition: none !important;
  }
}

/* Text animations */
.text-reveal {
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  transform: translateY(100%);
  animation: textReveal 0.6s ease forwards;
}

@keyframes textReveal {
  to {
    transform: translateY(0);
  }
}

.text-shimmer {
  color: #2c3e50;
  font-weight: bold;
}

/* Button animations */
.btn-bounce {
  animation: bounce 2s infinite;
}

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

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

/* Elevator hero headline effect (scroll scrub) */
.elevator {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-row-gap: var(--space-sm);
}

.elevatorL,
.elevatorR {
  will-change: transform, filter;
}

.elevator-transition {
  animation: repeat 1s forwards;
  animation-delay: 1s;
}

.elevatorL {
  text-align: right;
  animation-play-state: paused;
  animation-delay: calc(var(--scroll) * -1s);
  animation: moveLeft .7s forwards;
}

.elevatorR {
  animation-play-state: paused;
  animation-delay: calc(var(--scroll) * -1s);
  animation: moveRight .7s forwards;
}

@keyframes repeat {
  100% {
    filter: drop-shadow(0 1em 0 #fff) drop-shadow(0 1em 0 #fff) drop-shadow(0 1em 0 #fff) drop-shadow(0 1em 0 #fff) drop-shadow(0 1em 0 #fff) drop-shadow(0 1em 0 #fff);
  }
}

@keyframes moveLeft {
  0% {
    transform: translateX(0px) rotate(0);
  }
  100% {
    transform: translateX(-10em);
  } 
}

@keyframes moveRight {
  0% {
    transform: translateX(0px) rotate(0);
  }
  100% {
    transform: translateX(10em);
  } 
}

/* Card animations */
.card-float {
  animation: floatUp 0.6s ease-out;
}

.card-scale {
  animation: scaleIn 0.6s ease-out;
}

/* Portal animations */
.portal-glow {
  animation: treasureGlow 2s ease-in-out infinite;
}

.portal-spin {
  animation: portalSpin 10s linear infinite;
}

.portal-spin-reverse {
  animation: portalSpin 12s linear infinite reverse;
}

/* Particle effects */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--treasure-gold);
  border-radius: 50%;
  animation: particleFloat 3s ease-in-out infinite;
}

@keyframes particleFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 1;
  }
}

/* Scroll indicator */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 215, 0, 0.2);
  z-index: 1001;
}

.scroll-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--treasure-gold), #FFA500);
  width: 0%;
  transition: width 0.1s ease;
}

/* 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;
  }
  
  .parallax-slow,
  .parallax-fast {
    transform: none !important;
  }
  
  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }
}

/* Performance optimizations */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Interactive states */
.interactive {
  cursor: pointer;
  user-select: none;
}

.interactive:active {
  transform: scale(0.98);
}

/* Focus animations */
.focus-ring {
  position: relative;
}

.focus-ring::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid var(--treasure-gold);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.focus-ring:focus-visible::after {
  opacity: 1;
}
