/* ========================================
   UXI — Animations & Motion
   Premium Micro-interactions & Effects
   ======================================== */

/* ----------------------------------------
   Reveal Animations (Scroll-triggered)
   ---------------------------------------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(40px);
    transition: 
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

[data-reveal]:nth-child(1) { transition-delay: 0s; }
[data-reveal]:nth-child(2) { transition-delay: 0.1s; }
[data-reveal]:nth-child(3) { transition-delay: 0.2s; }
[data-reveal]:nth-child(4) { transition-delay: 0.3s; }

/* Staggered reveal for cards */
.services-grid [data-reveal]:nth-child(1) { transition-delay: 0.1s; }
.services-grid [data-reveal]:nth-child(2) { transition-delay: 0.2s; }
.services-grid [data-reveal]:nth-child(3) { transition-delay: 0.3s; }

.work-grid [data-reveal]:nth-child(1) { transition-delay: 0.1s; }
.work-grid [data-reveal]:nth-child(2) { transition-delay: 0.2s; }
.work-grid [data-reveal]:nth-child(3) { transition-delay: 0.3s; }

.why-grid [data-reveal]:nth-child(1) { transition-delay: 0.1s; }
.why-grid [data-reveal]:nth-child(2) { transition-delay: 0.2s; }
.why-grid [data-reveal]:nth-child(3) { transition-delay: 0.3s; }

/* ----------------------------------------
   3D Tilt Effect
   ---------------------------------------- */
[data-tilt] {
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0) rotateY(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-tilt]:hover {
    transform: perspective(1000px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) translateZ(10px);
}

[data-tilt] > * {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-tilt]:hover > * {
    transform: translateZ(20px);
}

/* ----------------------------------------
   Hero Animations
   ---------------------------------------- */
.hero-content {
    animation: heroFadeIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroFadeIn {
    0% {
        opacity: 0;
        transform: translateY(60px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-logo-wrapper {
    animation: heroLogoIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
    opacity: 0;
}

@keyframes heroLogoIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(40px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.hero-subtitle {
    animation: heroSubtitleIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
    opacity: 0;
}

@keyframes heroSubtitleIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
        letter-spacing: 0.5em;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: 0.3em;
    }
}

.hero-headline {
    animation: heroHeadlineIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
    opacity: 0;
}

@keyframes heroHeadlineIn {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-cta {
    animation: heroCTAIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
    opacity: 0;
}

@keyframes heroCTAIn {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Logo 3D Depth Animation */
.hero-logo {
    text-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 0 rgba(255, 255, 255, 0.08),
        0 3px 0 rgba(255, 255, 255, 0.06),
        0 4px 0 rgba(255, 255, 255, 0.04),
        0 5px 0 rgba(255, 255, 255, 0.02),
        0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------
   Button Animations
   ---------------------------------------- */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    box-shadow: 
        0 5px 20px rgba(255, 255, 255, 0.2),
        0 0 40px rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    box-shadow: 
        0 5px 20px rgba(255, 255, 255, 0.05),
        inset 0 0 20px rgba(255, 255, 255, 0.02);
}

/* ----------------------------------------
   Service Card Animations
   ---------------------------------------- */
.service-card {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(
        135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%,
        transparent 50%,
        rgba(0, 102, 255, 0.2) 100%
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.service-card:hover::before {
    opacity: 1;
}

.service-card-inner {
    background: 
        radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
            rgba(0, 102, 255, 0.03) 0%, 
            transparent 50%
        ),
        var(--color-bg-card);
}

/* ----------------------------------------
   Work Card Animations
   ---------------------------------------- */
.work-card {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-card-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(
        135deg, 
        rgba(0, 102, 255, 0.3) 0%, 
        transparent 40%,
        transparent 60%,
        rgba(0, 102, 255, 0.1) 100%
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.work-card:hover .work-card-inner::before {
    opacity: 1;
}

.work-card-content {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-card:hover .work-card-content {
    transform: translateY(-5px);
}

.work-card-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 30% 30%, 
        rgba(0, 102, 255, 0.1) 0%, 
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
}

.work-card:hover .work-card-bg::after {
    opacity: 1;
}

/* ----------------------------------------
   Navigation Animations
   ---------------------------------------- */
.nav {
    animation: navSlideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1s forwards;
    opacity: 0;
    transform: translateY(-100%);
}

@keyframes navSlideDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-links a {
    position: relative;
}

.nav-links a:not(.nav-cta)::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-accent);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links a:not(.nav-cta):hover::after {
    width: 100%;
}

/* ----------------------------------------
   Scroll Indicator Animation
   ---------------------------------------- */
.scroll-indicator {
    animation: fadeIn 1s ease 1.5s forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ----------------------------------------
   Form Animations
   ---------------------------------------- */
.form-group input,
.form-group select,
.form-group textarea {
    transition: 
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    transform: scale(1.01);
}

/* ----------------------------------------
   Fade In Up Animation
   ---------------------------------------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----------------------------------------
   Parallax Background Motion
   ---------------------------------------- */
.why-bg-text {
    transition: transform 0.1s linear;
}

.about-parallax-bg {
    transition: transform 0.1s linear;
}

/* ----------------------------------------
   Loading Animation
   ---------------------------------------- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    z-index: 10000;
    pointer-events: none;
    animation: pageLoad 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

@keyframes pageLoad {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* ----------------------------------------
   Smooth Scrollbar (Optional)
   ---------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-hover);
}

/* ----------------------------------------
   Focus States
   ---------------------------------------- */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ----------------------------------------
   Selection Animation
   ---------------------------------------- */
::selection {
    background-color: var(--color-accent);
    color: white;
}

/* ----------------------------------------
   Link Hover Effects
   ---------------------------------------- */
.footer-link svg {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.footer-link:hover svg {
    transform: scale(1.1);
}

/* ----------------------------------------
   Stats Counter Animation
   ---------------------------------------- */
.stat-number {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat:hover .stat-number {
    transform: scale(1.05);
}

/* ----------------------------------------
   Why Item Animations
   ---------------------------------------- */
.why-item-inner {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.why-item:hover .why-item-inner {
    transform: translateX(10px);
    border-color: var(--color-accent);
}

.why-number {
    transition: all 0.3s ease;
}

.why-item:hover .why-number {
    transform: scale(1.2);
}

/* ----------------------------------------
   Reduced Motion
   ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    [data-reveal] {
        opacity: 1;
        transform: none;
    }
    
    body::before {
        display: none;
    }
}
