/* ============================================
   MR Digital Solutions - Animations
   ============================================ */

/* --- Scroll Reveal Animations --- */
.reveal-up,
.reveal-left,
.reveal-right {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-up {
    transform: translateY(40px);
    transition-delay: var(--delay, 0s);
}

.reveal-left {
    transform: translateX(-40px);
}

.reveal-right {
    transform: translateX(40px);
}

[dir="rtl"] .reveal-left {
    transform: translateX(40px);
}

[dir="rtl"] .reveal-right {
    transform: translateX(-40px);
}

.reveal-up.revealed,
.reveal-left.revealed,
.reveal-right.revealed {
    opacity: 1;
    transform: translate(0, 0);
}

/* --- Magnetic Hover for Cards --- */
.service-card,
.portfolio-card,
.skills-category {
    will-change: transform;
}

/* --- Tilt Effect on Hover --- */
.tilt-effect {
    transition: transform 0.15s ease-out;
}

/* --- Gradient Border Animation --- */
@keyframes gradientBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.about-image-frame {
    background-size: 200% 200%;
    animation: gradientBorder 4s ease infinite;
}

/* --- Shine Effect on Buttons --- */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transition: left 0.6s ease;
}

.btn-primary:hover::after {
    left: 100%;
}

/* --- Stagger Animation for Grid Items --- */
.services-grid .service-card:nth-child(1) { transition-delay: 0.1s; }
.services-grid .service-card:nth-child(2) { transition-delay: 0.2s; }
.services-grid .service-card:nth-child(3) { transition-delay: 0.3s; }
.services-grid .service-card:nth-child(4) { transition-delay: 0.4s; }
.services-grid .service-card:nth-child(5) { transition-delay: 0.5s; }
.services-grid .service-card:nth-child(6) { transition-delay: 0.6s; }

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

/* --- Number Counter Animation --- */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Nav Link Hover Underline --- */
.nav-link::after {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Service Card Icon Ripple --- */
.service-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--brand-gradient);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s, transform 0.3s;
    z-index: -1;
}

.service-card:hover .service-icon::after {
    opacity: 0.15;
    transform: scale(1.4);
}

/* --- Portfolio Card Overlay Stagger --- */
.portfolio-action-btn:nth-child(1) {
    transition-delay: 0.1s;
}

.portfolio-action-btn:nth-child(2) {
    transition-delay: 0.2s;
}

/* --- Skill Bar Glow --- */
.skill-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-cyan);
    box-shadow: 0 0 10px var(--brand-cyan);
    opacity: 0;
    transition: opacity 0.5s ease 1.5s;
}

.skill-fill.animated::after {
    opacity: 1;
}

/* --- Social Link Bounce --- */
.social-link:hover {
    animation: socialBounce 0.4s ease;
}

@keyframes socialBounce {
    0%, 100% { transform: translateY(-3px); }
    50% { transform: translateY(-6px); }
}

/* --- Contact Form Input Focus --- */
.form-group input:focus,
.form-group textarea:focus {
    animation: inputFocus 0.3s ease;
}

@keyframes inputFocus {
    0% { box-shadow: 0 0 0 0 rgba(0, 198, 212, 0.3); }
    100% { box-shadow: 0 0 0 3px rgba(0, 198, 212, 0.1); }
}

/* --- Filter Button Active Animation --- */
.filter-btn.active {
    animation: filterPop 0.3s ease;
}

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

/* --- Testimonial Slide Transition --- */
.testimonial-card {
    animation: testimonialFade 0.5s ease;
}

@keyframes testimonialFade {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* --- Section Tag Shimmer --- */
.section-tag {
    position: relative;
    overflow: hidden;
}

.section-tag::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 198, 212, 0.15), transparent);
    animation: tagShimmer 3s ease-in-out infinite;
}

@keyframes tagShimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* --- Page Load Stagger --- */
.hero-content > * {
    opacity: 0;
    animation: heroStagger 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.hero-content > *:nth-child(1) { animation-delay: 0.3s; }
.hero-content > *:nth-child(2) { animation-delay: 0.45s; }
.hero-content > *:nth-child(3) { animation-delay: 0.6s; }
.hero-content > *:nth-child(4) { animation-delay: 0.75s; }
.hero-content > *:nth-child(5) { animation-delay: 0.9s; }
.hero-content > *:nth-child(6) { animation-delay: 1.05s; }

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

.hero-visual {
    opacity: 0;
    animation: heroVisual 1s cubic-bezier(0.4, 0, 0.2, 1) 0.6s forwards;
}

@keyframes heroVisual {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

[dir="rtl"] .hero-visual {
    animation-name: heroVisualRTL;
}

@keyframes heroVisualRTL {
    from {
        opacity: 0;
        transform: translateX(-40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .reveal-up,
    .reveal-left,
    .reveal-right {
        opacity: 1;
        transform: none;
    }
}