/* =========================================
   ANIMATIONS — Sharp Flashy Scroll Reveals
   & Micro-Interactions
   ========================================= */

/* ----- Keyframes ----- */

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

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

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

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(0, 218, 230, 0.3); }
    50%      { box-shadow: 0 0 25px rgba(0, 218, 230, 0.6); }
}

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

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

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

@keyframes borderGlow {
    0%, 100% { border-color: var(--primary-color); }
    50%      { border-color: #00f5ff; }
}

@keyframes heroSlideIn {
    from { opacity: 0; transform: translateY(35px); filter: blur(4px); }
    to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ----- Base Reveal System -----
   Hidden starting states are scoped to html.js (set inline in
   partials/head.html) so a page whose JS fails still shows its content. */

.js .reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* Directional variants */
.js .reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.js .reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.js .reveal-scale {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* ----- Stagger Delays ----- */

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }

/* ----- Hero Entrance Animations ----- */

.js .hero-animate {
    opacity: 0;
    animation: heroSlideIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-animate:nth-child(1) { animation-delay: 0.15s; }
.hero-animate:nth-child(2) { animation-delay: 0.35s; }
.hero-animate:nth-child(3) { animation-delay: 0.55s; }
.hero-animate:nth-child(4) { animation-delay: 0.75s; }

/* ----- Micro-Interactions ----- */

/* Icon hover float + color flash */
.card:hover i,
.service-feature-card:hover i,
.benefit-item:hover .benefit-icon {
    animation: floatIcon 1.2s ease-in-out infinite;
}

/* Card glow on hover */
.card:hover,
.service-feature-card:hover,
.area-card:hover {
    box-shadow: 0 0 20px rgba(0, 218, 230, 0.25),
                0 20px 40px rgba(0, 0, 0, 0.1);
}

.testimonial-card:hover {
    box-shadow: 0 0 20px rgba(0, 218, 230, 0.2),
                0 15px 35px rgba(0, 0, 0, 0.15);
}

/* CTA shimmer sweep */
.cta-btn-primary,
.cta-section .cta-btn {
    position: relative;
    overflow: hidden;
}

.cta-btn-primary::after,
.cta-section .cta-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 3s ease-in-out infinite;
}

/* Service feature card border glow on hover */
.service-feature-card:hover {
    border-left-color: #00f5ff;
    border-left-width: 4px;
    transition: border-left-color 0.4s, box-shadow 0.4s, transform 0.3s;
}

/* Partner logo hover zoom */
.partner-logo img:hover {
    transform: scale(1.08);
    filter: drop-shadow(0 4px 12px rgba(0, 218, 230, 0.3));
}

/* Benefit icon pulse ring */
.benefit-item:hover .benefit-icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    animation: glowPulse 1.5s ease-in-out infinite;
}

.benefit-item .benefit-icon {
    position: relative;
}

/* Section title underline grow */
.section-title h2 {
    position: relative;
    display: inline-block;
}

.section-title.revealed h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    animation: fadeInScale 0.6s 0.3s both;
}

/* Testimonial stars cascade */
.testimonial-card.revealed .testimonial-stars i {
    opacity: 0;
    animation: fadeInScale 0.3s forwards;
}
.testimonial-card.revealed .testimonial-stars i:nth-child(1) { animation-delay: 0.1s; }
.testimonial-card.revealed .testimonial-stars i:nth-child(2) { animation-delay: 0.2s; }
.testimonial-card.revealed .testimonial-stars i:nth-child(3) { animation-delay: 0.3s; }
.testimonial-card.revealed .testimonial-stars i:nth-child(4) { animation-delay: 0.4s; }
.testimonial-card.revealed .testimonial-stars i:nth-child(5) { animation-delay: 0.5s; }

/* CTA section entrance */
.cta-section.revealed h2,
.cta-section.revealed p,
.cta-section.revealed .cta-btn {
    animation: heroSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.cta-section.revealed p  { animation-delay: 0.15s; }
.cta-section.revealed .cta-btn { animation-delay: 0.3s; }

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* ----- Reduced Motion ----- */

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .hero-animate,
    .cta-section.revealed h2,
    .cta-section.revealed p,
    .cta-section.revealed .cta-btn {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }

    .cta-btn-primary::after,
    .cta-section .cta-btn::after {
        animation: none !important;
    }

    .testimonial-card.revealed .testimonial-stars i {
        opacity: 1 !important;
        animation: none !important;
    }
}
