/* Enhanced Animations for Prevision Research Website */
/* Add this to your existing styles.css or include as a separate file */

/* ============================================
   SCROLL ANIMATIONS - Balanced & Clean
   ============================================ */

/* Base animation states - minimal fade, noticeable movement */
.animate-on-scroll {
    opacity: 0.85; /* Just slightly faded, not ghosted */
    transform: translateY(50px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

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

/* Fade in with subtle effect */
.fade-in {
    opacity: 0.9;
    transition: opacity 0.8s ease-out;
}

.fade-in.animated {
    opacity: 1 !important;
}

/* Slide from left */
.slide-in-left {
    opacity: 0.85;
    transform: translateX(-60px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.slide-in-left.animated {
    opacity: 1 !important;
    transform: translateX(0) !important;
}

/* Slide from right */
.slide-in-right {
    opacity: 0.85;
    transform: translateX(60px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.slide-in-right.animated {
    opacity: 1 !important;
    transform: translateX(0) !important;
}

/* Scale up effect */
.scale-in {
    opacity: 0.85;
    transform: scale(0.9);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.scale-in.animated {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* ============================================
   STAGGER ANIMATIONS - Clean & Noticeable
   ============================================ */

/* Global stagger behaviour – slower + clearer spacing */
.stagger-item {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.1s ease-out, transform 1.1s ease-out;
}

.stagger-item.animated {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* One-by-one timing */
.stagger-item:nth-child(1).animated { transition-delay: 0.2s; }
.stagger-item:nth-child(2).animated { transition-delay: 0.6s; }
.stagger-item:nth-child(3).animated { transition-delay: 1.0s; }
.stagger-item:nth-child(4).animated { transition-delay: 1.4s; }
.stagger-item:nth-child(5).animated { transition-delay: 1.8s; }
.stagger-item:nth-child(6).animated { transition-delay: 2.2s; }

/* ============================================
   HERO ANIMATIONS - Elegant Sequential Entrance
   ============================================ */

.hero-content > * {
    opacity: 0.7; /* Visible but noticeably animating */
    transform: translateY(30px);
}

.hero-content.loaded .award-badge {
    animation: slideInUpFade 0.7s ease-out 0.2s forwards;
}

.hero-content.loaded h1 {
    animation: slideInUpFade 0.7s ease-out 0.4s forwards;
}

.hero-content.loaded .hero-subtitle {
    animation: slideInUpFade 0.7s ease-out 0.6s forwards;
}

.hero-content.loaded .hero-cta {
    animation: slideInUpFade 0.7s ease-out 0.8s forwards;
}

.hero-content.loaded .hero-contact {
    animation: slideInUpFade 0.7s ease-out 1s forwards;
}

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

/* ============================================
   HOVER ANIMATIONS - Enhanced Interactions
   ============================================ */

/* Service Cards - Lift and glow */
.service-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(34, 41, 88, 0.05) 0%, rgba(62, 135, 199, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 12px;
    pointer-events: none;
}

.service-card:hover::before {
    opacity: 1;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* Why Cards - Bounce effect */
.why-card {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.why-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.why-icon {
    transition: transform 0.3s ease;
}

.why-card:hover .why-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Testimonial Cards - Subtle lift */
.testimonial-card {
    transition: all 0.4s ease;
}

.testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

/* Buttons - Enhanced interaction */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.6s ease;
}

.btn:hover::before {
    transform: translate(-50%, -50%) scale(100);
}
.btn:active {
    transform: scale(0.98);
}

/* Links - Smooth underline effect */
.link-arrow {
    position: relative;
    display: inline-block;
    transition: all 0.3s ease;
}

.link-arrow::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.link-arrow:hover::after {
    width: 100%;
}

/* ============================================
   SECTION REVEAL ANIMATIONS - Clean
   ============================================ */

.section-reveal {
    opacity: 0.9; /* Very subtle fade */
    transform: translateY(60px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section-reveal.animated {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Section header animations */
.section-header {
    opacity: 0.85;
    transform: translateY(40px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.section-header.animated {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* ============================================
   NUMBER COUNTER ANIMATION
   ============================================ */

.counter {
    transition: all 0.3s ease;
}

.counter.counting {
    animation: pulse 0.5s ease;
}

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

/* ============================================
   PARALLAX EFFECT (Subtle)
   ============================================ */

.parallax-section {
    transition: transform 0.5s ease-out;
}

/* ============================================
   LOADING ANIMATION FOR IMAGES
   ============================================ */

.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

.image-loaded {
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   PROGRESS INDICATORS
   ============================================ */

.progress-bar {
    width: 0;
    transition: width 1s ease-out;
}

.progress-bar.animate {
    width: 100%;
}

/* ============================================
   FLOATING ANIMATION (Subtle)
   ============================================ */

.float {
    animation: float 3s ease-in-out infinite;
}

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

/* ============================================
   SCROLL INDICATOR
   ============================================ */

.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.1s ease;
    z-index: 9999;
}

/* ============================================
   AWARD BADGE ANIMATION
   ============================================ */

.award-badge {
    animation: badgePulse 2s ease-in-out infinite;
}

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

/* ============================================
   CTA SECTION ANIMATIONS - Always Visible
   ============================================ */

.cta-section .cta-content {
    opacity: 1; /* ALWAYS VISIBLE */
    transform: scale(0.98);
    transition: transform 0.8s ease-out;
}

.cta-section .cta-content.animated {
    transform: scale(1);
}

/* ============================================
   FORM FIELD ANIMATIONS
   ============================================ */

.form-group input,
.form-group select,
.form-group textarea {
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 41, 88, 0.15);
}

/* Label animation on focus */
.form-group label {
    transition: all 0.3s ease;
}

.form-group input:focus + label,
.form-group select:focus + label,
.form-group textarea:focus + label {
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* ============================================
   FOOTER ANIMATIONS - Always Visible
   ============================================ */

.footer-column {
    opacity: 1; /* ALWAYS VISIBLE */
    transform: translateY(20px);
    transition: transform 0.6s ease-out;
}

.footer-column.animated {
    transform: translateY(0);
}

.footer-column:nth-child(1).animated { transition-delay: 0.1s; }
.footer-column:nth-child(2).animated { transition-delay: 0.2s; }
.footer-column:nth-child(3).animated { transition-delay: 0.3s; }
.footer-column:nth-child(4).animated { transition-delay: 0.4s; }

/* Footer link hover effect */
.footer-column a {
    position: relative;
    display: inline-block;
}

.footer-column a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: white;
    transition: width 0.3s ease;
}

.footer-column a:hover::after {
    width: 100%;
}

/* ============================================
   MOBILE MENU ANIMATIONS
   ============================================ */

.nav-mobile {
    transform: translateX(-100%);
    transition: transform 0.3s ease-out;
}

.nav-mobile.active {
    transform: translateX(0);
}

.nav-mobile li {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.nav-mobile.active li {
    opacity: 1;
    transform: translateX(0);
}

.nav-mobile.active li:nth-child(1) { transition-delay: 0.1s; }
.nav-mobile.active li:nth-child(2) { transition-delay: 0.15s; }
.nav-mobile.active li:nth-child(3) { transition-delay: 0.2s; }
.nav-mobile.active li:nth-child(4) { transition-delay: 0.25s; }
.nav-mobile.active li:nth-child(5) { transition-delay: 0.3s; }
.nav-mobile.active li:nth-child(6) { transition-delay: 0.35s; }
.nav-mobile.active li:nth-child(7) { transition-delay: 0.4s; }
.nav-mobile.active li:nth-child(8) { transition-delay: 0.45s; }
.nav-mobile.active li:nth-child(9) { transition-delay: 0.5s; }
.nav-mobile.active li:nth-child(10) { transition-delay: 0.55s; }

/* Mobile menu toggle animation */
.mobile-menu-toggle span {
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   REDUCED MOTION - Accessibility
   ============================================ */

@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;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Will-change for smoother animations */
.service-card,
.why-card,
.testimonial-card,
.btn {
    will-change: transform;
}

/* GPU acceleration */
.animate-on-scroll,
.slide-in-left,
.slide-in-right,
.scale-in {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ============================================
   CRITICAL: FORCE VISIBILITY FOR ALL ANIMATED ELEMENTS
   ============================================ */

/* This is the nuclear option to ensure elements NEVER disappear */
*[class*="animate"].animated,
*[class*="fade"].animated,
*[class*="slide"].animated,
*[class*="scale"].animated,
*[class*="stagger"].animated,
*[class*="reveal"].animated {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Specific overrides for common animation classes */
.animate-on-scroll.animated,
.fade-in.animated,
.slide-in-left.animated,
.slide-in-right.animated,
.scale-in.animated,
.stagger-item.animated,
.section-reveal.animated,
.section-header.animated {
    opacity: 1 !important;
    visibility: visible !important;    
}

/* For grid items specifically */
.service-card.animated,
.why-card.animated,
.testimonial-card.animated,
.client-type.animated,
.feature-item.animated,
.process-step.animated {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Timeline-specific scroll animations */
.why-prevision .stagger-item {
    transform: translateX(-40px);
}

.why-prevision .stagger-item.animated {
    transform: translateX(0) !important;
}



/* Services support rows: slide in horizontally similar to Why Prevision */
.services-support .stagger-item {
    transform: translateX(-40px);
}

.services-support .stagger-item.animated {
    transform: translateX(0) !important;
}
/* Image column fade/slide */
.why-prevision .why-right.animate-on-scroll {
    transform: translateY(30px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.why-prevision .why-right.animate-on-scroll.animated {
    transform: translateY(0) !important;
}

/* Services grid - staggered slide-up */
.services-grid .stagger-item {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.services-grid .stagger-item.animated {
    opacity: 1;
    transform: translateY(0);
}



/* Draw the vertical line as the cards appear */
.why-timeline .why-line {
    transform: translateX(-50%) scaleY(0);
    transform-origin: top;
    transition: transform 0.6s ease-out;
}

.why-timeline .stagger-item.animated .why-line {
    transform: translateX(-50%) scaleY(1);
}

/* Icon pop effect */
.why-timeline .why-icon {
    transform: scale(0.7) translateY(8px);
    box-shadow: 0 10px 25px rgba(34,41,88,0.16);
    transition:
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.5s ease-out;
}

.why-timeline .stagger-item.animated .why-icon {
    transform: scale(1) translateY(0);
    box-shadow: 0 18px 40px rgba(34,41,88,0.25);
}


/* === Why Prevision - distinct timeline animation === */
.why-timeline .stagger-item {
    opacity: 0;
    transform: translateX(60px) scale(0.98);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.why-timeline .stagger-item.animated {
    opacity: 1 !important;
    transform: translateX(0) scale(1) !important;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Draw the vertical line as the cards appear */
.why-timeline .why-line {
    transform: translateX(-50%) scaleY(0);
    transform-origin: top;
    transition: transform 0.6s ease-out;
}

.why-timeline .stagger-item.animated .why-line {
    transform: translateX(-50%) scaleY(1);
}

/* Icon pop effect */
.why-timeline .why-icon {
    transform: scale(0.7) translateY(8px);
    box-shadow: 0 10px 25px rgba(34,41,88,0.16);
    transition:
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.5s ease-out;
}

.why-timeline .stagger-item.animated .why-icon {
    transform: scale(1) translateY(0);
    box-shadow: 0 18px 40px rgba(34,41,88,0.25);
}


/* Why Prevision – stronger slide-in from further right */
.why-prevision .stagger-item {
    opacity: 0;
    transform: translateX(300px); /* Increased from 90px → 180px */
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

.why-prevision .stagger-item.animated {
    opacity: 1 !important;
    transform: translateX(0) !important;
}
/* --- Why Prevision: keep first row laid out, only animate its contents --- */

/* 1. First row itself: always present, no slide on the container */
.why-prevision .why-rows .why-row:first-child.stagger-item {
    opacity: 1;
    transform: none;
    transition: none;
}

/* 2. Animate the inner columns of the first row from the right */
.why-prevision .why-rows .why-row:first-child .why-col-icon,
.why-prevision .why-rows .why-row:first-child .why-col-text,
.why-prevision .why-rows .why-row:first-child .why-col-image {
    opacity: 0;
    transform: translateX(180px); /* slide further from the right */
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

/* 3. When the first row is marked .animated, bring its columns into place */
.why-prevision .why-rows .why-row:first-child.stagger-item.animated .why-col-icon,
.why-prevision .why-rows .why-row:first-child.stagger-item.animated .why-col-text,
.why-prevision .why-rows .why-row:first-child.stagger-item.animated .why-col-image {
    opacity: 1 !important;
    transform: translateX(0) !important;
}

/* Staggered slide-in for CATI process cards */
.process-steps .process-step.slide-in-right:nth-child(1).animated { transition-delay: 0.15s; }
.process-steps .process-step.slide-in-right:nth-child(2).animated { transition-delay: 0.35s; }
.process-steps .process-step.slide-in-right:nth-child(3).animated { transition-delay: 0.55s; }

