/* ==========================================================================
   Ratnavi Foundation - Animation Definitions
   ========================================================================== */

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

@keyframes scaleIn {
  from { 
    opacity: 0; 
    transform: scale(0.9); 
  }
  to { 
    opacity: 1; 
    transform: scale(1); 
  }
}

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

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 107, 0, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 0, 0); }
}

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

/* --------------------------------------------------------------------------
   Utility Classes (for non-GSAP quick animations & hardware acceleration)
   -------------------------------------------------------------------------- */
.animate-fade-in { animation: fadeIn 0.8s ease forwards; }
.animate-fade-up { animation: fadeUp 0.8s ease forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse-btn { animation: pulse 2s infinite; }
.animate-spin { animation: spin 2s linear infinite; }

/* Viewport Animation Accelerators */
.site-header,
.site-footer,
.footer-widget,
.section-title,
.section-subtitle,
.stagger-grid .card,
.stagger-grid .stagger-item,
.partner-card,
.cta-section {
  will-change: transform, opacity;
  backface-visibility: hidden;
}


/* --------------------------------------------------------------------------
   Hover Effects (Micro-interactions)
   -------------------------------------------------------------------------- */
.hover-lift {
  transition: transform var(--transition-normal);
}
.hover-lift:hover {
  transform: translateY(-5px);
}

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

.underline-anim {
  position: relative;
  text-decoration: none;
}
.underline-anim::after {
  content: '';
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: var(--color-primary);
  transform-origin: bottom right;
  transition: transform 0.25s ease-out;
}
.underline-anim:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* --------------------------------------------------------------------------
   Flip Card (For Team Members)
   -------------------------------------------------------------------------- */
.flip-card {
  background-color: transparent;
  perspective: 1000px;
  height: 400px;
  width: 100%;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
  box-shadow: var(--shadow-lg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.flip-card-front {
  background-color: var(--color-white);
  color: var(--color-text-primary);
}

.flip-card-front img {
  width: 100%;
  height: 70%;
  object-fit: cover;
  object-position: top;
}

.flip-card-info {
  height: 30%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-4);
  background: var(--color-white);
}

.flip-card-title {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.flip-card-role {
  color: var(--color-primary);
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
}

.flip-card-back {
  background: var(--gradient-primary);
  color: white;
  transform: rotateY(180deg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.flip-card-back h3 {
  color: white;
  margin-bottom: var(--space-4);
}

.flip-card-back p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Liquid Wave Fill Preloader (Transparent Backdrop, Frameless)
   -------------------------------------------------------------------------- */
html.preloader-hidden #preloader {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 999999;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s ease, visibility 0.5s;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#preloader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.03);
}

.loader-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  max-width: 90%;
  width: 320px;
}

/* Circular Liquid Wave Mask Box */
.loader-wave-box {
  position: relative;
  width: 145px;
  height: 145px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid rgba(255, 87, 34, 0.25);
  box-shadow: 0 15px 35px rgba(255, 87, 34, 0.15),
              0 0 25px rgba(255, 255, 255, 0.9);
  overflow: hidden;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Rising Liquid Wave Layer */
.loader-wave-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, rgba(255, 87, 34, 0.45) 0%, rgba(233, 30, 99, 0.75) 100%);
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

/* Animated Wavy Top Edge */
.loader-wave-fill::before,
.loader-wave-fill::after {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  top: -265px;
  left: 50%;
  transform: translate(-50%, 0);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 40%;
  animation: wave-flow 6s linear infinite;
}

.loader-wave-fill::after {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 38%;
  animation: wave-flow 10s linear infinite;
}

@keyframes wave-flow {
  0% { transform: translate(-50%, 0) rotate(0deg); }
  100% { transform: translate(-50%, 0) rotate(360deg); }
}

/* Centered Unclipped Logo Box */
.loader-logo-box {
  position: relative;
  z-index: 2;
  width: 95px;
  height: 95px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-logo-box img.loader-logo,
#preloader img.loader-logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.2));
}

/* Clean Typography & Counter */
.loader-brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #0f172a;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.loader-status-text {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 18px;
  font-weight: 500;
  min-height: 20px;
  letter-spacing: 0.3px;
  transition: opacity 0.3s ease;
}

/* Progress Percentage Badge */
.loader-percentage {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ff5722;
  letter-spacing: 1px;
  background: rgba(255, 87, 34, 0.08);
  padding: 5px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 87, 34, 0.2);
}
