/* Animations for 4Square.us - Shared across pages */

/* Hero Background Animation */
@keyframes heroBackgroundAnimation {
    0% {
        transform: scale(1.0) translate(0px, 0px) rotate(0deg);
    }
    25% {
        transform: scale(1.12) translate(-25px, 20px) rotate(0.5deg);
    }
    50% {
        transform: scale(1.08) translate(-35px, -15px) rotate(-0.5deg);
    }
    75% {
        transform: scale(1.15) translate(30px, -25px) rotate(0.2deg);
    }
    100% {
        transform: scale(1.0) translate(0px, 0px) rotate(0deg);
    }
}

/* Shared hero animation styles - Used by all hero sections */
.hero, .hiw-hero, .about-hero, .consumer-hero, .merchant-hero {
    position: relative;
    overflow: hidden;
    background: none !important; /* Remove the original background */
}

/* How It Works hero background */
.hiw-hero::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: url('../assets/images/how-it-works/hero-how-it-works-bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1; /* Ensure it's behind the overlay */
    animation: heroBackgroundAnimation 25s ease-in-out infinite;
}

/* Consumer hero background */
.consumer-hero::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: url('../assets/images/for-consumers/hero-consumers-bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1; /* Ensure it's behind the overlay */
    animation: heroBackgroundAnimation 25s ease-in-out infinite;
}

/* Homepage hero background */
.hero::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: url('../img/1.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1; /* Ensure it's behind the overlay */
    animation: heroBackgroundAnimation 25s ease-in-out infinite;
}

/* About Us hero background */
.about-hero::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: url('../img/about-us/hero-about-us-bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1; /* Ensure it's behind the overlay */
    animation: heroBackgroundAnimation 25s ease-in-out infinite;
}

/* Merchant hero background */
.merchant-hero::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: url('../assets/images/for-merchants/hero-merchants-bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1; /* Ensure it's behind the overlay */
    animation: heroBackgroundAnimation 25s ease-in-out infinite;
}

/* Make the overlay have a higher z-index - Shared by all hero sections */
.hiw-hero-overlay, .about-hero-overlay, .consumer-hero-overlay, .merchant-hero-overlay {
    position: relative;
    z-index: 1;
}

/* Base animation states */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Staggered animations for children elements */
.staggered-parent .staggered-child {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.staggered-parent .staggered-child.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Fade-in animation for sections */
.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in-left.animated, .fade-in-right.animated {
    opacity: 1;
    transform: translateX(0);
}

/* Timeline step animations */
.journey-step {
    transition: transform 0.4s ease;
}

.journey-step:hover {
    transform: translateY(-5px);
}

/* Card hover animations */
.scale-animation {
    transform: scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.benefit-card, .policy-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* CTA button animations */
.pulse-animation {
    animation: pulse 1s 1;
}

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

/* Compliance note subtle emphasis */
.compliance-emphasis {
    animation: emphasizeCompliance 3s ease-in-out;
}

@keyframes emphasizeCompliance {
    0% {
        background-color: transparent;
    }
    30% {
        background-color: rgba(0, 123, 255, 0.05);
    }
    100% {
        background-color: transparent;
    }
}

/* FAQ animations */
.faq-item .toggle-btn {
    transition: transform 0.3s ease;
}

.faq-item .toggle-btn.active {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.faq-answer.active {
    max-height: 500px;
}

/* Trust badge animations */
.trust-badge {
    transition: transform 0.3s ease;
}

.trust-badge:hover {
    transform: translateY(-5px);
}

.trust-badge i {
    transition: transform 0.3s ease;
}

.trust-badge:hover i {
    transform: scale(1.15);
}

/* Merchant logo animations */
.logo-placeholder {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.logo-placeholder:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

/* About Us page specific animations */

/* Feature highlight animation */
.feature-highlight {
    transform: translateX(5px);
    transition: transform 0.3s ease;
}

/* Pulse animation for loyalty icon */
.pulse-animation {
    animation: pulse 1.5s ease infinite;
}

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

/* Guarantee box hover effect */
.guarantee-hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(52, 152, 219, 0.15);
    transition: all 0.3s ease;
}

/* Subtle pulse for guarantee icon */
.subtle-pulse {
    animation: subtlePulse 1s ease;
}

@keyframes subtlePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive animations - disable on mobile for performance */
@media (max-width: 768px) {
    .animate-on-scroll, 
    .animate-on-scroll.animated,
    .staggered-parent .staggered-child, 
    .staggered-parent .staggered-child.animated {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
