/* ================================================================
   Rainbow Kids Zone — Animations CSS
   animations.css
   ================================================================ */

/* ================================================================
   Keyframe Definitions
   ================================================================ */

/* Float animations (hero shapes) */
@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%       { transform: translateY(-20px) rotate(5deg); }
  66%       { transform: translateY(10px) rotate(-3deg); }
}

/* Scroll indicator bounce */
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50%       { transform: translateY(8px); opacity: 0.4; }
}

/* WhatsApp pulse */
@keyframes pulseWhatsApp {
  0%, 100% { box-shadow: 0 4px 20px rgba(37,211,102,0.50); }
  50%       { box-shadow: 0 4px 30px rgba(37,211,102,0.75), 0 0 0 12px rgba(37,211,102,0.08); }
}

/* Blinking dot */
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: 0.6; }
}

/* Ticker */
@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Alert slide */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Success check */
@keyframes checkBounce {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Spin */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Shimmer loading */
@keyframes shimmer {
  0%   { background-position: -468px 0; }
  100% { background-position: 468px 0; }
}

/* Number counter pop */
@keyframes counterPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Reveal from bottom */
@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reveal from left */
@keyframes revealLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Reveal from right */
@keyframes revealRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Zoom in */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Hero text stagger */
@keyframes heroSlideUp {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Wave */
@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%, 100% { transform: rotate(0deg); }
}

/* ================================================================
   AOS-like Scroll Reveal Classes
   Used via data-aos attribute + IntersectionObserver in main.js
   ================================================================ */
[data-aos] {
  opacity: 0;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-aos].aos-animate {
  opacity: 1;
  transform: none !important;
}

[data-aos="fade-up"]    { transform: translateY(40px); }
[data-aos="fade-down"]  { transform: translateY(-40px); }
[data-aos="fade-left"]  { transform: translateX(40px); }
[data-aos="fade-right"] { transform: translateX(-40px); }
[data-aos="zoom-in"]    { transform: scale(0.85); }
[data-aos="flip-left"]  { transform: perspective(400px) rotateY(90deg); }
[data-aos="flip-up"]    { transform: perspective(400px) rotateX(90deg); }

/* Delay utilities */
[data-aos-delay="100"] { transition-delay: 100ms; }
[data-aos-delay="200"] { transition-delay: 200ms; }
[data-aos-delay="300"] { transition-delay: 300ms; }
[data-aos-delay="400"] { transition-delay: 400ms; }
[data-aos-delay="500"] { transition-delay: 500ms; }
[data-aos-delay="600"] { transition-delay: 600ms; }
[data-aos-delay="700"] { transition-delay: 700ms; }
[data-aos-delay="800"] { transition-delay: 800ms; }

/* ================================================================
   Hero Entrance Animations
   ================================================================ */
.hero-label {
  animation: heroSlideUp 0.8s ease 0.2s both;
}

.hero-title {
  animation: heroSlideUp 0.8s ease 0.4s both;
}

.hero-description {
  animation: heroSlideUp 0.8s ease 0.6s both;
}

.hero-actions {
  animation: heroSlideUp 0.8s ease 0.8s both;
}

.hero-stats {
  animation: heroSlideUp 0.8s ease 1.0s both;
}

.hero-scroll {
  animation: fadeIn 1s ease 1.5s both;
}

/* ================================================================
   Page Hero Entrance
   ================================================================ */
.page-hero h1 {
  animation: heroSlideUp 0.7s ease 0.1s both;
}

.page-hero p {
  animation: heroSlideUp 0.7s ease 0.25s both;
}

.page-hero .breadcrumb {
  animation: heroSlideUp 0.7s ease 0.4s both;
}

/* ================================================================
   Hover Micro-Animations
   ================================================================ */

/* Bounce on hover */
.hover-bounce:hover {
  animation: counterPop 0.4s ease;
}

/* Wave emoji */
.wave-hand {
  display: inline-block;
  animation: wave 2.5s ease-in-out infinite;
  transform-origin: 70% 70%;
}

/* Spin on hover */
.hover-spin:hover {
  animation: spin 0.5s linear;
}

/* ================================================================
   Loading Spinner
   ================================================================ */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* ================================================================
   Progress Bar
   ================================================================ */
.progress-bar-wrap {
  background: var(--border);
  border-radius: var(--r-full);
  height: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--r-full);
  width: 0;
  transition: width 1.5s ease 0.3s;
}

/* ================================================================
   Success Animation
   ================================================================ */
.success-animation {
  width: 80px;
  height: 80px;
  background: var(--mint-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px;
  animation: checkBounce 0.5s ease;
}

/* ================================================================
   Floating Elements (decorative)
   ================================================================ */
.float-1 { animation: floatSlow 6s ease-in-out infinite; }
.float-2 { animation: floatSlow 8s ease-in-out infinite 1s; }
.float-3 { animation: floatSlow 7s ease-in-out infinite 2s; }

/* ================================================================
   Gradient Text
   ================================================================ */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--mint-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ================================================================
   Shimmer Skeleton (loading placeholder)
   ================================================================ */
.skeleton {
  background: linear-gradient(
    to right,
    var(--border-light) 0%,
    var(--border) 20%,
    var(--border-light) 40%,
    var(--border-light) 100%
  );
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--r-md);
}

/* ================================================================
   Sticky Navbar Transition
   ================================================================ */
.navbar {
  transition: background 0.4s ease, box-shadow 0.4s ease, padding 0.3s ease;
}

/* ================================================================
   Timeline (About Page)
   ================================================================ */
.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary) 0%, var(--mint) 100%);
  transform: translateX(-50%);
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: 0;
  margin-bottom: 48px;
  align-items: center;
}

.timeline-item:nth-child(even) .timeline-content-left {
  order: 3;
  text-align: left;
}

.timeline-item:nth-child(even) .timeline-content-right {
  order: 1;
  text-align: right;
}

.timeline-content {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.timeline-content:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.timeline-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  border: 4px solid var(--white);
  box-shadow: 0 0 0 3px var(--primary-light);
  margin: 0 auto;
  z-index: 2;
  position: relative;
  transition: var(--transition);
}

.timeline-item:hover .timeline-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  transform: scale(1.3);
}

.timeline-year {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.timeline-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.timeline-desc {
  font-size: 0.87rem;
  color: var(--text-light);
  line-height: 1.7;
}

@media (max-width: 768px) {
  .timeline::before {
    left: 20px;
  }

  .timeline-item {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto;
    gap: 16px;
  }

  .timeline-item:nth-child(even) .timeline-content-left,
  .timeline-item:nth-child(even) .timeline-content-right {
    order: unset;
    text-align: left;
  }

  .timeline-content-right { display: none; }
  .timeline-content-left { display: none; }
  .timeline-content { grid-column: 2; }

  .timeline-dot {
    grid-column: 1;
    margin: 0;
  }
}

/* ================================================================
   Value Cards (About)
   ================================================================ */
.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

.value-card {
  text-align: center;
  padding: 32px 24px;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.value-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.value-emoji {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 16px;
  animation: wave 3s ease-in-out infinite;
  animation-play-state: paused;
}

.value-card:hover .value-emoji {
  animation-play-state: running;
}

.value-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.value-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.7;
}

/* ================================================================
   Page Entrance & Opening Animations
   ================================================================ */
@keyframes pageEntrance {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes pageExit {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Page entrance animation disabled on body to maintain fixed navbar viewport stability */
body {
  /* No animation on body to prevent fixed header rendering glitches on refresh */
}

body.page-exit {
  animation: pageExit 0.3s ease forwards;
}

/* Page Header Entrance (Inner Pages) */
@keyframes headerBannerPop {
  0% {
    opacity: 0;
    transform: translateY(-24px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.page-header {
  animation: headerBannerPop 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.page-header-title {
  animation: revealUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.page-header-subtitle {
  animation: revealUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

.breadcrumb {
  animation: fadeIn 0.8s ease 0.5s both;
}

/* Smooth Card Entrance Staggers */
@keyframes softCardPop {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.program-card,
.facility-card,
.event-card,
.value-card,
.feature-badge-card {
  animation: softCardPop 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ================================================================
   Page Animal Mascots & Opening Animations (George Kids Style)
   ================================================================ */
.mascot-container {
  position: absolute;
  right: 40px;
  bottom: 20px;
  z-index: 15;
  pointer-events: none;
}
@media (max-width: 992px) {
  .mascot-container {
    right: 20px;
    bottom: 12px;
  }
}
@media (max-width: 768px) {
  .mascot-container {
    right: 15px;
    bottom: 10px;
    transform: scale(0.78);
    transform-origin: bottom right;
  }
}

.mascot-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  padding: 10px 20px;
  border-radius: 60px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.8);
}
.mascot-icon {
  font-size: 3.2rem;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}
.mascot-text-wrap {
  display: flex;
  flex-direction: column;
}
.mascot-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary-dark);
}
.mascot-speech {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Elephant Walk Entrance (Home Page) */
@keyframes elephantWalk {
  0% {
    opacity: 0;
    transform: translateX(120px) scale(0.6) rotate(15deg);
  }
  60% {
    transform: translateX(-10px) scale(1.08) rotate(-5deg);
  }
  80% {
    transform: translateX(5px) scale(0.98) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1) rotate(0deg);
  }
}

.mascot-elephant .mascot-icon {
  animation: elephantWalk 1.2s cubic-bezier(0.25, 1.2, 0.5, 1) 0.3s both, floatSlow 4s ease-in-out 1.5s infinite;
}

/* Giraffe Stretch Entrance (About Page) */
@keyframes giraffeStretch {
  0% {
    opacity: 0;
    transform: translateY(-100px) rotate(-20deg);
  }
  70% {
    transform: translateY(12px) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

.mascot-giraffe .mascot-icon {
  animation: giraffeStretch 1.1s cubic-bezier(0.25, 1.3, 0.5, 1) 0.2s both, floatSlow 4.5s ease-in-out 1.3s infinite;
}

/* Panda Roll Entrance (Programs Page) */
@keyframes pandaRoll {
  0% {
    opacity: 0;
    transform: translateX(100px) rotate(180deg) scale(0.5);
  }
  70% {
    transform: translateX(-8px) rotate(-10deg) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(0deg) scale(1);
  }
}

.mascot-panda .mascot-icon {
  animation: pandaRoll 1.1s cubic-bezier(0.25, 1.3, 0.5, 1) 0.2s both, floatSlow 3.8s ease-in-out 1.3s infinite;
}

/* Lion Pop Entrance (Facilities Page) */
@keyframes lionPop {
  0% {
    opacity: 0;
    transform: scale(0.2) translateY(50px);
  }
  65% {
    transform: scale(1.25) translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.mascot-lion .mascot-icon {
  animation: lionPop 1.0s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both, floatSlow 4s ease-in-out 1.2s infinite;
}

/* Monkey Swing Entrance (Gallery Page) */
@keyframes monkeySwing {
  0% {
    opacity: 0;
    transform: translateY(-120px) rotate(-35deg);
  }
  60% {
    transform: translateY(15px) rotate(15deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

.mascot-monkey .mascot-icon {
  animation: monkeySwing 1.2s cubic-bezier(0.25, 1.2, 0.5, 1) 0.2s both, floatSlow 3.5s ease-in-out 1.4s infinite;
}

/* Bunny Hop Entrance (Events Page) */
@keyframes bunnyHop {
  0% {
    opacity: 0;
    transform: translateY(80px) scale(0.4);
  }
  40% {
    transform: translateY(-30px) scale(1.15);
  }
  70% {
    transform: translateY(10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.mascot-bunny .mascot-icon {
  animation: bunnyHop 1.1s cubic-bezier(0.25, 1.3, 0.5, 1) 0.2s both, floatSlow 4s ease-in-out 1.3s infinite;
}

/* Koala Wave Entrance (Contact Page) */
@keyframes koalaWave {
  0% {
    opacity: 0;
    transform: translateX(90px) rotate(30deg);
  }
  70% {
    transform: translateX(-5px) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
  }
}

.mascot-koala .mascot-icon {
  animation: koalaWave 1.1s cubic-bezier(0.25, 1.3, 0.5, 1) 0.2s both, floatSlow 4.2s ease-in-out 1.3s infinite;
}

/* Owl Fly Entrance (Admissions Page) */
@keyframes owlFly {
  0% {
    opacity: 0;
    transform: translateY(-100px) translateX(80px) scale(0.5);
  }
  70% {
    transform: translateY(10px) translateX(-5px) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
  }
}

.mascot-owl .mascot-icon {
  animation: owlFly 1.2s cubic-bezier(0.25, 1.2, 0.5, 1) 0.2s both, floatSlow 3.8s ease-in-out 1.4s infinite;
}

/* ================================================================
   George Kids Side Mascots Header Framing (Left & Right Animals)
   ================================================================ */
.header-mascot-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  width: 100%;
}

.mascot-side {
  flex: 0 0 180px;
  max-width: 180px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  will-change: transform;
  transform: translateZ(0);
}

.mascot-side-img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.15));
  will-change: transform;
  transition: transform 0.3s ease;
}

.mascot-side:hover .mascot-side-img {
  transform: scale(1.14) rotate(4deg);
}

/* Left Mascot — Entrance from LEFT SIDE */
@keyframes mascotSlideFromLeft {
  0% {
    opacity: 0;
    transform: translate3d(-140px, 0, 0) scale(0.6) rotate(-15deg);
  }
  60% {
    transform: translate3d(10px, 0, 0) scale(1.08) rotate(4deg);
  }
  80% {
    transform: translate3d(-4px, 0, 0) scale(0.98) rotate(-2deg);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
}

/* Right Mascot — Entrance from RIGHT SIDE */
@keyframes mascotSlideFromRight {
  0% {
    opacity: 0;
    transform: translate3d(140px, 0, 0) scale(0.6) rotate(15deg);
  }
  60% {
    transform: translate3d(-10px, 0, 0) scale(1.08) rotate(-4deg);
  }
  80% {
    transform: translate3d(4px, 0, 0) scale(0.98) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
}

.mascot-left-anim {
  will-change: transform, opacity;
  animation: mascotSlideFromLeft 0.9s cubic-bezier(0.25, 1.2, 0.5, 1) 0.1s both, floatMascotLeft 4s ease-in-out 1s infinite alternate;
}

.mascot-right-anim {
  will-change: transform, opacity;
  animation: mascotSlideFromRight 0.9s cubic-bezier(0.25, 1.2, 0.5, 1) 0.2s both, floatMascotRight 4.2s ease-in-out 1.1s infinite alternate;
}

@keyframes floatMascotLeft {
  0%   { transform: translate3d(0, 0, 0) rotate(-2deg); }
  50%  { transform: translate3d(0, -12px, 0) rotate(3deg); }
  100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
}

@keyframes floatMascotRight {
  0%   { transform: translate3d(0, 0, 0) rotate(2deg); }
  50%  { transform: translate3d(0, -14px, 0) rotate(-3deg); }
  100% { transform: translate3d(0, 0, 0) rotate(2deg); }
}

.header-frame-content {
  flex: 1;
  text-align: center;
}

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

  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
  }
}
