/**
 * Water Animations & Effects
 * ===========================
 * Reusable water-themed animations and effects
 * Includes ripples, waves, flowing, and fade animations
 */

/* ====================
   RIPPLE ANIMATIONS
   ==================== */

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Water ripple on hover */
.water-ripple {
  position: relative;
  overflow: visible;
}

/* Ensure button itself handles overflow for ripple effect */
.water-ripple .wp-block-button__link,
.water-ripple.wp-block-button__link {
  overflow: hidden;
}

.water-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  background: rgba(0, 119, 190, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
}

.water-ripple:hover::after {
  animation: ripple 1.5s ease-out;
}

/* ====================
   WAVE ANIMATIONS
   ==================== */

@keyframes gentle-wave {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Gentle floating animation */
.floating {
  animation: gentle-wave 3s ease-in-out infinite;
}

/* ====================
   FLOW ANIMATIONS
   ==================== */

@keyframes flow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ====================
   FADE ANIMATIONS
   ==================== */

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

.entry-content > * {
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

/* Staggered fade-in delays */
.entry-content > *:nth-child(1) { animation-delay: 0.1s; }
.entry-content > *:nth-child(2) { animation-delay: 0.2s; }
.entry-content > *:nth-child(3) { animation-delay: 0.3s; }
.entry-content > *:nth-child(4) { animation-delay: 0.4s; }
.entry-content > *:nth-child(5) { animation-delay: 0.5s; }

/* ====================
   FLOATING ELEMENTS
   ==================== */

.author-card,
.book-preview-section .book-cover,
.water-viz-container,
.testimonial-card {
  animation: float 6s ease-in-out infinite;
}

.author-card:nth-child(2n),
.book-preview-section .book-cover:nth-child(2n),
.testimonial-card:nth-child(2n) {
  animation-delay: -3s;
  animation-duration: 7s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  33% {
    transform: translateY(-8px) rotate(0.5deg);
  }
  66% {
    transform: translateY(4px) rotate(-0.5deg);
  }
}

/* ====================
   SHIMMER EFFECTS
   ==================== */

@keyframes shimmer {
  0%, 90% {
    transform: rotate(45deg) translateX(-100%);
  }
  100% {
    transform: rotate(45deg) translateX(100%);
  }
}

/* Subtle shimmer effect on important CTAs */
.btn-primary::after,
.purchase-button::after,
.newsletter-section button[type="submit"]::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: rotate(45deg) translateX(-100%);
  animation: shimmer 6s ease-in-out infinite;
  pointer-events: none;
}

/* ====================
   TEXT RIPPLE EFFECTS
   ==================== */

@keyframes textRipple {
  0%, 100% {
    transform: scale(1) translateY(0);
    filter: blur(0px);
    text-shadow: 0 0 0 transparent;
  }
  30% {
    transform: scale(1.005) translateY(-0.5px);
    filter: blur(0.2px);
  }
  50% {
    transform: scale(1.01) translateY(-1px);
    filter: blur(0.3px);
    text-shadow: 0 6px 12px rgba(0, 119, 190, 0.25);
  }
  70% {
    transform: scale(1.005) translateY(-0.5px);
    filter: blur(0.2px);
  }
}

/* Liquid text hover effect on headings */
.entry-content h1:hover,
.entry-content h2:hover {
  animation: textRipple 0.6s ease-out;
  cursor: default;
}

/* ====================
   PULSE ANIMATIONS
   ==================== */

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

/* ====================
   PARTICLE EFFECTS
   ==================== */

@keyframes particleFloat {
  0% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-100vh) translateX(20px) scale(0.8);
    opacity: 0;
  }
}

/* ====================
   ENHANCED WATER FLOW
   ==================== */

/* Continuous flowing gradient for borders and accents */
@keyframes water-flow-gradient {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* Subtle current for backgrounds */
@keyframes gentle-current {
  0%, 100% {
    transform: translateX(0) scaleX(1);
  }
  25% {
    transform: translateX(2%) scaleX(1.02);
  }
  50% {
    transform: translateX(0) scaleX(1);
  }
  75% {
    transform: translateX(-2%) scaleX(0.98);
  }
}

/* Water surface shimmer */
@keyframes water-surface {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1) translateY(0);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.02) translateY(-2px);
  }
}

/* Flowing border class */
.water-flow-border {
  position: relative;
}

.water-flow-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--water-400, #81D4FA) 0%,
    var(--water-500, #4FC3F7) 25%,
    var(--water-600, #00B4D8) 50%,
    var(--water-500, #4FC3F7) 75%,
    var(--water-400, #81D4FA) 100%
  );
  background-size: 200% 100%;
  animation: water-flow-gradient 4s linear infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.water-flow-border:hover::before {
  opacity: 1;
}

/* ====================
   CLICK RIPPLE EFFECT
   ==================== */

/* Global ripple on click for interactive elements */
.ripple-on-click {
  position: relative;
  overflow: hidden;
}

.ripple-on-click .ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 180, 216, 0.4) 0%,
    rgba(0, 180, 216, 0.1) 40%,
    transparent 70%
  );
  transform: scale(0);
  animation: click-ripple 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes click-ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* ====================
   WAVE SECTION DIVIDERS
   ==================== */

.wave-divider {
  position: relative;
  height: 60px;
  overflow: hidden;
}

.wave-divider svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 100%;
  animation: wave-scroll 15s linear infinite;
}

@keyframes wave-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ====================
   DROPLET HOVER
   ==================== */

/* Droplet icon animation */
@keyframes droplet-fall {
  0% {
    transform: translateY(-10px);
    opacity: 0;
  }
  50% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(10px);
    opacity: 0;
  }
}

/* Concentric ripples */
@keyframes concentric-ripple {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
    border-color: rgba(0, 180, 216, 0.8);
  }
  100% {
    transform: scale(2);
    opacity: 0;
    border-color: rgba(0, 180, 216, 0);
  }
}

.concentric-ripple {
  position: relative;
}

.concentric-ripple::before,
.concentric-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 100%;
  height: 100%;
  border: 2px solid rgba(0, 180, 216, 0.5);
  border-radius: 50%;
  pointer-events: none;
}

.concentric-ripple:hover::before {
  animation: concentric-ripple 1s ease-out;
}

.concentric-ripple:hover::after {
  animation: concentric-ripple 1s ease-out 0.2s;
}

/* ====================
   LIQUID BUTTON HOVER
   ==================== */

/* Liquid fill effect on buttons */
.liquid-fill {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.liquid-fill::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  background: linear-gradient(180deg,
    rgba(0, 180, 216, 0.2) 0%,
    rgba(0, 119, 190, 0.3) 100%);
  transition: height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: -1;
}

.liquid-fill:hover::before {
  height: 100%;
}

/* ====================
   LINK UNDERLINE FLOW
   ==================== */

/* Flowing underline for links */
.flow-underline {
  position: relative;
  text-decoration: none;
}

.flow-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--water-500, #4FC3F7) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.flow-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
  animation: water-flow-gradient 2s linear infinite;
}

/* ====================
   BREATHING GLOW
   ==================== */

@keyframes breathing-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 180, 216, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 180, 216, 0.25);
  }
}

.water-glow {
  animation: breathing-glow 4s ease-in-out infinite;
}

/* ====================
   SCROLL REVEAL WAVE
   ==================== */

/* Elements rise like bubbles when scrolling into view */
@keyframes bubble-rise {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  60% {
    transform: translateY(-5px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.bubble-rise-enter {
  animation: bubble-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ====================
   ACCESSIBILITY
   ==================== */

@media (prefers-reduced-motion: reduce) {
  .water-flow-border::before,
  .wave-divider svg,
  .water-glow,
  .floating,
  .concentric-ripple::before,
  .concentric-ripple::after {
    animation: none;
  }

  .liquid-fill::before,
  .flow-underline::after {
    transition: none;
  }
}