/* ===== EZMUSCLE ADVANCED ANIMATIONS & EFFECTS ===== */
/* CSS-first approach: Sophisticated animations without JS dependency */

:root {
    --anim-fast: 200ms;
    --anim-normal: 350ms;
    --anim-slow: 500ms;
    --anim-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --anim-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --anim-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Colors for effects */
    --glow-primary: rgba(241, 88, 34, 0.4);
    --glow-accent: rgba(59, 130, 246, 0.3);
    --shimmer: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* ===== GLOBAL ANIMATIONS ===== */

/* Smooth page transitions */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }

    * {
        transition-timing-function: var(--anim-smooth);
    }
}

/* ===== ENTRANCE ANIMATIONS ===== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== HOVER EFFECTS ===== */

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px transparent;
    }
    50% {
        box-shadow: 0 0 20px var(--glow-primary);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-12px);
    }
}

/* ===== GRADIENT ANIMATIONS ===== */

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes gradientFlow {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* ===== BORDER & OUTLINE EFFECTS ===== */

@keyframes borderFlow {
    0% {
        border-color: rgba(241, 88, 34, 0.3);
        box-shadow: inset 0 0 0 2px rgba(241, 88, 34, 0.1);
    }
    50% {
        border-color: rgba(241, 88, 34, 0.8);
        box-shadow: inset 0 0 0 2px rgba(241, 88, 34, 0.3);
    }
    100% {
        border-color: rgba(241, 88, 34, 0.3);
        box-shadow: inset 0 0 0 2px rgba(241, 88, 34, 0.1);
    }
}

@keyframes blinkBorder {
    0%, 100% {
        border-color: transparent;
    }
    50% {
        border-color: var(--glow-primary);
    }
}

/* ===== CONTENT ANIMATIONS ===== */

@keyframes slideContent {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes revealMask {
    0% {
        clip-path: polygon(0 0, 0 0, 0 100%, 0% 100%);
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

/* ===== INTERACTION CLASSES ===== */

/* Default animations for content */
.animate-in {
    animation: fadeInUp var(--anim-normal) var(--anim-bounce) both;
}

.animate-slide-in {
    animation: slideInLeft var(--anim-normal) var(--anim-bounce) both;
}

.animate-fade {
    animation: fadeInUp var(--anim-slow) var(--anim-ease) both;
}

/* Hover animations */
@media (hover: hover) {
    .hover-lift {
        transition: transform var(--anim-fast) var(--anim-ease), box-shadow var(--anim-fast) var(--anim-ease);
    }
    
    .hover-lift:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    }
    
    .hover-scale {
        transition: transform var(--anim-fast) var(--anim-ease);
    }
    
    .hover-scale:hover {
        transform: scale(1.05);
    }
    
    .hover-glow {
        transition: all var(--anim-fast) var(--anim-ease);
    }
    
    .hover-glow:hover {
        box-shadow: 0 0 20px var(--glow-primary);
    }
    
    .hover-shimmer {
        background-size: 200% 100%;
        background-image: var(--shimmer);
        transition: all var(--anim-fast);
    }
    
    .hover-shimmer:hover {
        animation: shimmer 0.8s linear;
    }
}

/* ===== TEXT EFFECTS ===== */

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(241, 88, 34, 0);
    }
    50% {
        text-shadow: 0 0 20px rgba(241, 88, 34, 0.5);
    }
}

.text-glow {
    animation: textGlow 3s ease-in-out infinite;
}

@keyframes underlineReveal {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.link-underline {
    position: relative;
    text-decoration: none;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent, #f15822);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--anim-fast) var(--anim-ease);
}

@media (hover: hover) {
    .link-underline:hover::after {
        transform: scaleX(1);
    }
}

/* ===== COMPONENT ANIMATIONS ===== */

/* Hero section animations */
.hero {
    position: relative;
    overflow: hidden;
}

.hero h1 {
    animation: fadeInUp var(--anim-slow) var(--anim-ease) both;
}

.hero p {
    animation: fadeInUp calc(var(--anim-slow) + 100ms) var(--anim-ease) both;
}

.hero .cta-button,
.hero-cta,
.btn {
    animation: fadeInUp calc(var(--anim-slow) + 200ms) var(--anim-ease) both;
    transition: all var(--anim-fast) var(--anim-ease);
}

@media (hover: hover) {
    .hero-cta:hover,
    .cta-button:hover,
    .btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px var(--glow-primary);
    }
}

/* Card animations */
.card,
.service-card,
.testimonial-card,
.location-card,
.ez-card {
    transition: all var(--anim-fast) var(--anim-ease);
}

@media (hover: hover) {
    .card:hover,
    .service-card:hover,
    .testimonial-card:hover,
    .location-card:hover,
    .ez-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
    }
}

/* Badge animations */
.badge,
.ez-badge {
    display: inline-block;
    animation: scaleIn var(--anim-normal) var(--anim-bounce) both;
}

/* Stagger animation for multiple items */
.list > li,
.grid > .item,
.testimonials-grid > div {
    animation: fadeInUp var(--anim-normal) var(--anim-ease) both;
}

.list > li:nth-child(1) { animation-delay: 0ms; }
.list > li:nth-child(2) { animation-delay: 100ms; }
.list > li:nth-child(3) { animation-delay: 200ms; }
.list > li:nth-child(4) { animation-delay: 300ms; }
.list > li:nth-child(5) { animation-delay: 400ms; }

.grid > .item:nth-child(1) { animation-delay: 0ms; }
.grid > .item:nth-child(2) { animation-delay: 75ms; }
.grid > .item:nth-child(3) { animation-delay: 150ms; }
.grid > .item:nth-child(4) { animation-delay: 225ms; }
.grid > .item:nth-child(5) { animation-delay: 300ms; }
.grid > .item:nth-child(6) { animation-delay: 375ms; }

/* ===== LOADING & SKELETON ANIMATIONS ===== */

@keyframes skeletonLoading {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(200, 200, 200, 0.2) 0%,
        rgba(200, 200, 200, 0.4) 50%,
        rgba(200, 200, 200, 0.2) 100%
    );
    background-size: 1000px 100%;
    animation: skeletonLoading 1.5s infinite;
}

/* ===== SCROLL ANIMATIONS ===== */

@supports (animation-timeline: view()) {
    .scroll-in {
        animation: fadeInUp var(--anim-normal) var(--anim-ease) both;
        animation-timeline: view();
        animation-range: entry 0% cover 30%;
    }
    
    .scroll-scale {
        animation: scaleIn var(--anim-normal) var(--anim-ease) both;
        animation-timeline: view();
        animation-range: entry 0% cover 30%;
    }
}

/* Fallback for browsers without animation-timeline support */
@media (prefers-reduced-motion: no-preference) {
    .scroll-in,
    .scroll-scale {
        opacity: 0;
        animation: fadeInUp var(--anim-normal) var(--anim-ease) forwards;
        animation-duration: var(--anim-slow);
    }
}

/* ===== REDUCED MOTION SUPPORT ===== */

@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;
    }
}

/* ===== NAVIGATION ANIMATIONS (in sync with _nav.css) ===== */

.ezm-mega {
    transform-origin: top center;
    perspective: 1000px;
}

.ezm-item.open .ezm-mega {
    animation: fadeInDown 300ms ease-out forwards;
}

.ezm-link,
.ezm-toggle {
    position: relative;
}

.ezm-link::after,
.ezm-toggle::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #22d3ee);
    transition: width 200ms var(--anim-ease);
}

@media (hover: hover) {
    .ezm-link:hover::after,
    .ezm-toggle:hover::after {
        width: 100%;
    }
}

/* ===== SPECIAL EFFECTS ===== */

/* Floating animation for floating elements */
.float {
    animation: float 3s ease-in-out infinite;
}

/* Bouncing animation */
.bounce {
    animation: bounce 2s ease-in-out infinite;
}

/* Pulsing animation */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Gradient shift animation */
.gradient-shift {
    background-size: 300% 300%;
    animation: gradientShift 8s ease infinite;
}

/* Gradient flow animation */
.gradient-flow {
    background-size: 200% 200%;
    animation: gradientFlow 3s linear infinite;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Use transforms for animations (GPU-accelerated) */
.animate-in,
.hover-lift,
.hover-scale {
    will-change: auto;
}

.animate-in:hover,
.hover-lift:hover,
.hover-scale:hover {
    will-change: transform;
}

/* Prevent layout thrashing with contain */
.card,
.service-card,
.testimonial-card {
    contain: layout style paint;
}

/* ===== RESPONSIVE ANIMATION ADJUSTMENTS ===== */

@media (max-width: 768px) {
    /* Reduce animation duration on mobile for faster response */
    :root {
        --anim-normal: 250ms;
        --anim-slow: 350ms;
    }
    
    /* Disable some animations on mobile for performance */
    .gradient-shift,
    .gradient-flow {
        animation: none;
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    * {
        animation: none !important;
        transition: none !important;
    }
}
