/* ==================================================
   HOMEPAGE ANIMATIONS FOR LAW FIRM
   ================================================== */

/* Animation base classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Hero section animations */
.hero-fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeIn 0.8s ease-out forwards;
}

.hero-fade-in-1 { animation-delay: 0.2s; }
.hero-fade-in-2 { animation-delay: 0.4s; }
.hero-fade-in-3 { animation-delay: 0.6s; }
.hero-fade-in-4 { animation-delay: 0.8s; }
.hero-fade-in-5 { animation-delay: 1.0s; }
.hero-fade-in-6 { animation-delay: 1.2s; }

@keyframes heroFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Firm name split animation */
.firm-name-animate {
    opacity: 0;
    transform: translateX(-50px);
    animation: firmNameSlide 1s ease-out forwards;
}

.firm-name-line-1 { animation-delay: 0.3s; }
.firm-name-line-2 { animation-delay: 0.5s; }

@keyframes firmNameSlide {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Benefits checkmark animation */
.benefit-item {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.6s ease-out;
}

.benefit-item.in-view {
    opacity: 1;
    transform: translateX(0);
}

.benefit-item:nth-child(1) { transition-delay: 1.0s; }
.benefit-item:nth-child(2) { transition-delay: 1.1s; }
.benefit-item:nth-child(3) { transition-delay: 1.2s; }
.benefit-item:nth-child(4) { transition-delay: 1.3s; }

.benefit-checkmark {
    transform: scale(0);
    animation: checkmarkPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.benefit-item.in-view .benefit-checkmark {
    animation-delay: inherit;
}

@keyframes checkmarkPop {
    to {
        transform: scale(1);
    }
}

/* Hero image parallax and zoom */
.hero-image {
    transform: scale(1.1);
    animation: heroImageReveal 1.5s ease-out forwards;
    animation-delay: 0.8s;
}

@keyframes heroImageReveal {
    to {
        transform: scale(1);
    }
}

/* Process cards staggered animation */
.process-card {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.process-card.in-view {
    opacity: 1;
    transform: translateY(0);
}

.process-card:nth-child(1) { transition-delay: 0.1s; }
.process-card:nth-child(2) { transition-delay: 0.2s; }
.process-card:nth-child(3) { transition-delay: 0.3s; }

/* Process card hover enhancements */
.process-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.process-number {
    transition: all 0.3s ease;
}

.process-card:hover .process-number {
    transform: scale(1.1) rotate(5deg);
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
}

/* Practice areas grid animation */
.practice-area-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.practice-area-card.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger by rows (3 cards per row) */
.practice-area-card:nth-child(1),
.practice-area-card:nth-child(2),
.practice-area-card:nth-child(3) {
    transition-delay: 0.1s;
}

.practice-area-card:nth-child(4),
.practice-area-card:nth-child(5),
.practice-area-card:nth-child(6) {
    transition-delay: 0.2s;
}

/* Practice area hover effects */
.practice-area-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.12);
}

.practice-area-icon {
    transition: all 0.3s ease;
}

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

.practice-area-card:hover .practice-area-icon svg {
    filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.3));
}

/* Why choose us alternating animation */
.reason-card {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reason-card:nth-child(odd) {
    transform: translateX(-40px);
}

.reason-card:nth-child(even) {
    transform: translateX(40px);
}

.reason-card.in-view {
    opacity: 1;
    transform: translateX(0);
}

.reason-card:nth-child(1) { transition-delay: 0.1s; }
.reason-card:nth-child(2) { transition-delay: 0.2s; }
.reason-card:nth-child(3) { transition-delay: 0.3s; }
.reason-card:nth-child(4) { transition-delay: 0.4s; }
.reason-card:nth-child(5) { transition-delay: 0.5s; }
.reason-card:nth-child(6) { transition-delay: 0.6s; }

/* Reason card icon animation */
.reason-icon {
    transition: all 0.4s ease;
}

.reason-card:hover .reason-icon {
    transform: scale(1.15) rotate(10deg);
    filter: drop-shadow(0 6px 12px rgba(59, 130, 246, 0.4));
}

/* Testimonials staggered grid */
.testimonial-card {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.testimonial-card.in-view {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.testimonial-card:nth-child(1) { transition-delay: 0.1s; }
.testimonial-card:nth-child(2) { transition-delay: 0.2s; }
.testimonial-card:nth-child(3) { transition-delay: 0.3s; }

/* Testimonial star animation */
.star-rating {
    opacity: 0;
    animation: starFadeIn 0.8s ease-out forwards;
    animation-delay: 0.5s;
}

@keyframes starFadeIn {
    to {
        opacity: 1;
    }
}

.star-icon {
    transform: scale(0);
    animation: starPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.star-icon:nth-child(1) { animation-delay: 0.6s; }
.star-icon:nth-child(2) { animation-delay: 0.7s; }
.star-icon:nth-child(3) { animation-delay: 0.8s; }
.star-icon:nth-child(4) { animation-delay: 0.9s; }
.star-icon:nth-child(5) { animation-delay: 1.0s; }

@keyframes starPop {
    to {
        transform: scale(1);
    }
}

/* Attorneys section */
.attorney-card {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.attorney-card.in-view {
    opacity: 1;
    transform: translateY(0);
}

.attorney-card:nth-child(1) { transition-delay: 0.1s; }
.attorney-card:nth-child(2) { transition-delay: 0.2s; }

.attorney-image {
    transition: all 0.4s ease;
    overflow: hidden;
}

.attorney-card:hover .attorney-image img {
    transform: scale(1.05);
}

/* Social icons slide up */
.social-icons {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    transition-delay: 0.2s;
}

.attorney-card:hover .social-icons {
    opacity: 1;
    transform: translateY(0);
}

/* CTA button enhancements */
.cta-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.cta-button:hover::before {
    left: 100%;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Section headers fade in */
.section-header {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-header.in-view {
    opacity: 1;
    transform: translateY(0);
}

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

    .animate-on-scroll,
    .hero-fade-in,
    .firm-name-animate,
    .benefit-item,
    .process-card,
    .practice-area-card,
    .reason-card,
    .testimonial-card,
    .attorney-card {
        opacity: 1;
        transform: none;
    }
}

/* Performance optimization for mobile */
@media (max-width: 768px) {
    .hero-image,
    .practice-area-card,
    .attorney-image img {
        will-change: auto;
    }

    .process-card:hover,
    .practice-area-card:hover,
    .cta-button:hover {
        transform: none;
    }
}