/* ================================================
   POOLBUILDER MARKETERS — Animations & 3D Effects
   ================================================ */

/* --- Keyframe Animations --- */

/* Water caustic light effect */
@keyframes causticShift {
  0% { transform: scale(1) translate(0, 0); opacity: 0.7; }
  33% { transform: scale(1.1) translate(-2%, 3%); opacity: 0.9; }
  66% { transform: scale(0.95) translate(3%, -2%); opacity: 0.8; }
  100% { transform: scale(1.05) translate(-1%, 1%); opacity: 1; }
}

/* Floating / Levitating */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-15px) rotate(1deg); }
  75% { transform: translateY(-8px) rotate(-1deg); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(0.5deg); }
}

/* Kinetic letter reveal */
@keyframes letterReveal {
  from {
    opacity: 0;
    transform: translateY(30px) rotateX(-10deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
}

/* Fade + slide up (section reveals) */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Slide in from left */
@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(-60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from right */
@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale up */
@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Stat pulse glow */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(14, 165, 233, 0.1); }
  50% { box-shadow: 0 0 40px rgba(14, 165, 233, 0.25); }
}

/* Shimmer effect */
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Gradient shift for hero background */
@keyframes waterShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Bubble rise */
@keyframes bubbleRise {
  0% {
    transform: translateY(100%) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) scale(1);
    opacity: 0;
  }
}

/* Icon bounce */
@keyframes iconBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Aquarium bubble rise with wobble */
@keyframes aqBubbleRise {
  0% {
    transform: translateY(0) translateX(0) scale(0.4);
    opacity: 0;
  }
  5% {
    opacity: 0.7;
  }
  25% {
    transform: translateY(-25vh) translateX(12px) scale(0.7);
  }
  50% {
    transform: translateY(-50vh) translateX(-8px) scale(0.85);
    opacity: 0.5;
  }
  75% {
    transform: translateY(-75vh) translateX(10px) scale(0.95);
    opacity: 0.3;
  }
  100% {
    transform: translateY(-110vh) translateX(-5px) scale(1);
    opacity: 0;
  }
}

@keyframes aqBubbleRise2 {
  0% {
    transform: translateY(0) translateX(0) scale(0.3);
    opacity: 0;
  }
  5% {
    opacity: 0.6;
  }
  25% {
    transform: translateY(-25vh) translateX(-10px) scale(0.6);
  }
  50% {
    transform: translateY(-50vh) translateX(14px) scale(0.8);
    opacity: 0.4;
  }
  75% {
    transform: translateY(-75vh) translateX(-6px) scale(0.9);
    opacity: 0.2;
  }
  100% {
    transform: translateY(-110vh) translateX(8px) scale(1);
    opacity: 0;
  }
}

/* --- Global Aquarium Bubbles --- */
.aquarium-bubbles {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.aq-bubble {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%,
    rgba(56, 189, 248, 0.35),
    rgba(45, 212, 191, 0.12) 60%,
    transparent 70%);
  border: 1px solid rgba(56, 189, 248, 0.22);
  box-shadow: inset 0 -2px 6px rgba(56, 189, 248, 0.15),
              0 0 8px rgba(56, 189, 248, 0.08);
  animation: aqBubbleRise linear infinite;
}

/* 15 bubbles with varied positions, sizes, speeds, delays */
.aq-bubble:nth-child(1)  { left: 3%;  width: 8px;  height: 8px;  animation-duration: 22s; animation-delay: 0s; }
.aq-bubble:nth-child(2)  { left: 12%; width: 14px; height: 14px; animation-duration: 28s; animation-delay: -4s; animation-name: aqBubbleRise2; }
.aq-bubble:nth-child(3)  { left: 20%; width: 6px;  height: 6px;  animation-duration: 19s; animation-delay: -8s; }
.aq-bubble:nth-child(4)  { left: 30%; width: 18px; height: 18px; animation-duration: 32s; animation-delay: -2s; animation-name: aqBubbleRise2; }
.aq-bubble:nth-child(5)  { left: 38%; width: 10px; height: 10px; animation-duration: 24s; animation-delay: -12s; }
.aq-bubble:nth-child(6)  { left: 48%; width: 7px;  height: 7px;  animation-duration: 20s; animation-delay: -6s; animation-name: aqBubbleRise2; }
.aq-bubble:nth-child(7)  { left: 55%; width: 22px; height: 22px; animation-duration: 35s; animation-delay: -1s; }
.aq-bubble:nth-child(8)  { left: 65%; width: 9px;  height: 9px;  animation-duration: 21s; animation-delay: -10s; animation-name: aqBubbleRise2; }
.aq-bubble:nth-child(9)  { left: 72%; width: 12px; height: 12px; animation-duration: 26s; animation-delay: -7s; }
.aq-bubble:nth-child(10) { left: 80%; width: 6px;  height: 6px;  animation-duration: 18s; animation-delay: -14s; animation-name: aqBubbleRise2; }
.aq-bubble:nth-child(11) { left: 88%; width: 16px; height: 16px; animation-duration: 30s; animation-delay: -3s; }
.aq-bubble:nth-child(12) { left: 94%; width: 8px;  height: 8px;  animation-duration: 23s; animation-delay: -9s; animation-name: aqBubbleRise2; }
.aq-bubble:nth-child(13) { left: 7%;  width: 5px;  height: 5px;  animation-duration: 17s; animation-delay: -15s; }
.aq-bubble:nth-child(14) { left: 42%; width: 11px; height: 11px; animation-duration: 27s; animation-delay: -5s; animation-name: aqBubbleRise2; }
.aq-bubble:nth-child(15) { left: 62%; width: 7px;  height: 7px;  animation-duration: 20s; animation-delay: -11s; }

/* Larger bubbles get extra glow */
.aq-bubble:nth-child(4),
.aq-bubble:nth-child(7),
.aq-bubble:nth-child(11) {
  box-shadow: inset 0 -3px 6px rgba(56, 189, 248, 0.15),
              0 0 12px rgba(56, 189, 248, 0.1),
              0 0 24px rgba(45, 212, 191, 0.05);
  border-color: rgba(56, 189, 248, 0.2);
}

/* --- Scroll-Triggered Reveal Classes --- */

.reveal {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children */
.stagger-child {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger-child.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* --- Floating Elements --- */
.floating {
  animation: float 6s ease-in-out infinite;
}

.floating-slow {
  animation: floatSlow 8s ease-in-out infinite;
}

.floating-delay-1 {
  animation-delay: -1s;
}

.floating-delay-2 {
  animation-delay: -2s;
}

.floating-delay-3 {
  animation-delay: -3s;
}

.float-duration-5 {
  animation-duration: 5s;
}

.float-duration-7 {
  animation-duration: 7s;
}

/* --- Kinetic Typography --- */
.kinetic-text span {
  display: inline-block;
  opacity: 0;
  transform: translateY(30px);
  animation: letterReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.kinetic-text.no-animate span {
  opacity: 1;
  transform: none;
  animation: none;
}

/* --- Hero Bubble Particles (CSS Only) --- */
.hero-bubbles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.hero-bubbles .bubble {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.05));
  border: 1px solid rgba(14, 165, 233, 0.1);
  animation: bubbleRise linear infinite;
}

.hero-bubbles .bubble:nth-child(1) {
  left: 10%;
  width: 20px;
  height: 20px;
  animation-duration: 18s;
  animation-delay: 0s;
}

.hero-bubbles .bubble:nth-child(2) {
  left: 25%;
  width: 12px;
  height: 12px;
  animation-duration: 22s;
  animation-delay: -3s;
}

.hero-bubbles .bubble:nth-child(3) {
  left: 45%;
  width: 16px;
  height: 16px;
  animation-duration: 20s;
  animation-delay: -6s;
}

.hero-bubbles .bubble:nth-child(4) {
  left: 60%;
  width: 24px;
  height: 24px;
  animation-duration: 25s;
  animation-delay: -2s;
}

.hero-bubbles .bubble:nth-child(5) {
  left: 75%;
  width: 10px;
  height: 10px;
  animation-duration: 16s;
  animation-delay: -8s;
}

.hero-bubbles .bubble:nth-child(6) {
  left: 88%;
  width: 18px;
  height: 18px;
  animation-duration: 21s;
  animation-delay: -4s;
}

.hero-bubbles .bubble:nth-child(7) {
  left: 35%;
  width: 8px;
  height: 8px;
  animation-duration: 19s;
  animation-delay: -10s;
}

.hero-bubbles .bubble:nth-child(8) {
  left: 55%;
  width: 14px;
  height: 14px;
  animation-duration: 23s;
  animation-delay: -5s;
}

/* --- Stat Pulse Glow --- */
.stat-glow {
  animation: pulseGlow 3s ease-in-out infinite;
}

/* --- Card Hover Light Reflection --- */
.light-reflect {
  position: relative;
  overflow: hidden;
}

.light-reflect::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05), transparent 60%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.light-reflect:hover::after {
  opacity: 1;
}

/* --- 3D Card Tilt Container --- */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
}

.tilt-card .tilt-content {
  transform: translateZ(30px);
}

/* --- Water Surface Effect --- */
.water-surface {
  position: relative;
  overflow: hidden;
}

.water-surface::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 300%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(14, 165, 233, 0.04) 25%,
    rgba(20, 184, 166, 0.06) 50%,
    rgba(14, 165, 233, 0.04) 75%,
    transparent 100%
  );
  animation: waterShift 8s linear infinite;
}

/* --- Icon Hover Animation --- */
.icon-hover:hover .card-icon {
  animation: iconBounce 0.5s ease;
  border-color: var(--accent-blue);
  background: rgba(14, 165, 233, 0.15);
}

/* --- Gradient Text Shimmer --- */
.text-shimmer {
  background: linear-gradient(
    90deg,
    var(--accent-blue),
    var(--accent-teal),
    var(--accent-blue)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* --- Accessibility: Reduced Motion --- */
@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;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .stagger-child {
    opacity: 1;
    transform: none;
  }

  .kinetic-text span {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
