/* ============================================
   PUSH FIT MADRID - Animations & Microinteractions
   Smooth, professional animations
   ============================================ */

/* Reveal Animations */
[data-animate],
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
    will-change: opacity, transform;
}

[data-animate].is-visible,
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Directional variants */
[data-animate="fade-left"] {
    transform: translateX(-24px);
}

[data-animate="fade-right"] {
    transform: translateX(24px);
}

[data-animate="scale-up"] {
    transform: scale(0.96);
}

[data-animate="scale-up"].is-visible {
    transform: scale(1);
}

/* Staggered Reveal */
.reveal-stagger>* {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.reveal-stagger.active>*,
.reveal-stagger.is-visible>* {
    opacity: 1;
    transform: translateY(0);
}

.reveal-stagger.active>*:nth-child(1) {
    transition-delay: 0.1s;
}

.reveal-stagger.active>*:nth-child(2) {
    transition-delay: 0.2s;
}

.reveal-stagger.active>*:nth-child(3) {
    transition-delay: 0.3s;
}

.reveal-stagger.active>*:nth-child(4) {
    transition-delay: 0.4s;
}

.reveal-stagger.active>*:nth-child(5) {
    transition-delay: 0.5s;
}

.reveal-stagger.active>*:nth-child(6) {
    transition-delay: 0.6s;
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.hover-grow {
    transition: transform 0.3s var(--ease-out);
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-shine {
    position: relative;
    overflow: hidden;
}

.hover-shine::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.6s var(--ease-out);
}

.hover-shine:hover::before {
    left: 100%;
}

/* Button Animations */
.btn-pulse {
    animation: pulse 2s var(--ease-out) infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn-ripple:focus:not(:active)::after {
    animation: ripple 1s var(--ease-out);
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }

    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* Loading Animations */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-blue);
    animation: loadingDot 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loadingDot {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Card Entrance Animations */
.card-entrance {
    animation: cardEntrance 0.6s ease-out;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Float Animation */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Text Animations */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: gradientShift 3s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-blue);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 100%
    }
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: var(--primary-blue)
    }
}

/* Progress Bars */
.progress-bar {
    height: 6px;
    background-color: var(--medium-gray);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-blue));
    border-radius: var(--radius-full);
    animation: progressFill 1.5s ease-out forwards;
    transform-origin: left;
}

@keyframes progressFill {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

/* Counters */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Image Reveal */
.img-reveal {
    position: relative;
    overflow: hidden;
}

.img-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-blue);
    z-index: 1;
    animation: imgReveal 1s ease-out forwards;
    transform-origin: left;
}

@keyframes imgReveal {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Section Separator */
.section-separator {
    position: relative;
    height: 100px;
    overflow: hidden;
}

.wave-separator {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.wave-separator svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 100px;
}

.wave-separator .shape-fill {
    fill: var(--primary-blue);
}

/* Parallax Scrolling */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

@media (max-width: 768px) {
    .parallax {
        background-attachment: scroll;
    }
}

/* Tilt Effect */
.tilt-effect {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.tilt-effect:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00ff;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00ffff;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(42px, 9999px, 44px, 0);
    }

    5% {
        clip: rect(12px, 9999px, 59px, 0);
    }

    10% {
        clip: rect(48px, 9999px, 29px, 0);
    }

    15% {
        clip: rect(42px, 9999px, 73px, 0);
    }

    20% {
        clip: rect(63px, 9999px, 27px, 0);
    }

    25% {
        clip: rect(34px, 9999px, 55px, 0);
    }

    30% {
        clip: rect(86px, 9999px, 73px, 0);
    }

    35% {
        clip: rect(20px, 9999px, 20px, 0);
    }

    40% {
        clip: rect(26px, 9999px, 60px, 0);
    }

    45% {
        clip: rect(25px, 9999px, 66px, 0);
    }

    50% {
        clip: rect(57px, 9999px, 98px, 0);
    }

    55% {
        clip: rect(5px, 9999px, 46px, 0);
    }

    60% {
        clip: rect(82px, 9999px, 31px, 0);
    }

    65% {
        clip: rect(54px, 9999px, 27px, 0);
    }

    70% {
        clip: rect(28px, 9999px, 99px, 0);
    }

    75% {
        clip: rect(45px, 9999px, 69px, 0);
    }

    80% {
        clip: rect(23px, 9999px, 85px, 0);
    }

    85% {
        clip: rect(54px, 9999px, 84px, 0);
    }

    90% {
        clip: rect(45px, 9999px, 47px, 0);
    }

    95% {
        clip: rect(37px, 9999px, 20px, 0);
    }

    100% {
        clip: rect(4px, 9999px, 91px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(65px, 9999px, 100px, 0);
    }

    5% {
        clip: rect(52px, 9999px, 74px, 0);
    }

    10% {
        clip: rect(79px, 9999px, 85px, 0);
    }

    15% {
        clip: rect(75px, 9999px, 5px, 0);
    }

    20% {
        clip: rect(67px, 9999px, 61px, 0);
    }

    25% {
        clip: rect(14px, 9999px, 79px, 0);
    }

    30% {
        clip: rect(1px, 9999px, 66px, 0);
    }

    35% {
        clip: rect(86px, 9999px, 30px, 0);
    }

    40% {
        clip: rect(23px, 9999px, 98px, 0);
    }

    45% {
        clip: rect(85px, 9999px, 72px, 0);
    }

    50% {
        clip: rect(71px, 9999px, 75px, 0);
    }

    55% {
        clip: rect(2px, 9999px, 48px, 0);
    }

    60% {
        clip: rect(30px, 9999px, 16px, 0);
    }

    65% {
        clip: rect(59px, 9999px, 50px, 0);
    }

    70% {
        clip: rect(41px, 9999px, 62px, 0);
    }

    75% {
        clip: rect(2px, 9999px, 82px, 0);
    }

    80% {
        clip: rect(47px, 9999px, 73px, 0);
    }

    85% {
        clip: rect(3px, 9999px, 27px, 0);
    }

    90% {
        clip: rect(40px, 9999px, 86px, 0);
    }

    95% {
        clip: rect(45px, 9999px, 69px, 0);
    }

    100% {
        clip: rect(18px, 9999px, 53px, 0);
    }
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg,
            var(--light-gray) 25%,
            var(--medium-gray) 50%,
            var(--light-gray) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Scroll Progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-blue));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Mouse Follow */
.mouse-follow {
    position: fixed;
    width: 20px;
    height: 20px;
    background-color: rgba(37, 99, 235, 0.2);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, background-color 0.3s;
}

.mouse-follow.hover {
    width: 40px;
    height: 40px;
    background-color: rgba(37, 99, 235, 0.1);
}

/* Particle Background */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particle {
    position: absolute;
    background-color: var(--accent-blue);
    border-radius: 50%;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    from {
        transform: translateY(100vh) rotate(0deg);
    }

    to {
        transform: translateY(-100px) rotate(360deg);
    }
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Bounce Animation */
.bounce {
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

/* Flip Animation */
.flip {
    animation: flip 1s ease;
    transform-style: preserve-3d;
}

@keyframes flip {
    from {
        transform: rotateY(0);
    }

    to {
        transform: rotateY(360deg);
    }
}

/* Zoom In */
.zoom-in {
    animation: zoomIn 0.5s ease forwards;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide In */
.slide-in-left {
    animation: slideInLeft 0.5s ease forwards;
}

.slide-in-right {
    animation: slideInRight 0.5s ease forwards;
}

.slide-in-up {
    animation: slideInUp 0.5s ease forwards;
}

.slide-in-down {
    animation: slideInDown 0.5s ease forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

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

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

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

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

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

/* Fade In */
.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.fade-in-down {
    animation: fadeInDown 0.6s ease forwards;
}

@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);
    }
}

/* Rotate Animation */
.rotate {
    animation: rotate 2s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

/* Pulsing Border */
.pulse-border {
    position: relative;
}

.pulse-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: inherit;
    border: 2px solid transparent;
    animation: pulseBorder 2s linear infinite;
}

@keyframes pulseBorder {
    0% {
        border-color: var(--primary-blue);
        opacity: 1;
        transform: scale(1);
    }

    100% {
        border-color: var(--primary-blue);
        opacity: 0;
        transform: scale(1.1);
    }
}

/* Morph Animation */
.morph {
    animation: morph 3s ease-in-out infinite;
}

@keyframes morph {

    0%,
    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }

    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

/* Blob Animation */
.blob {
    animation: blob 7s infinite;
}

@keyframes blob {
    0% {
        transform: translate(0px, 0px) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }

    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

/* Staggered Children Animation */
.stagger-children>* {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.stagger-children>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-children>*:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-children>*:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-children>*:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-children>*:nth-child(5) {
    animation-delay: 0.5s;
}

.stagger-children>*:nth-child(6) {
    animation-delay: 0.6s;
}

.stagger-children>*:nth-child(7) {
    animation-delay: 0.7s;
}

.stagger-children>*:nth-child(8) {
    animation-delay: 0.8s;
}

.stagger-children>*:nth-child(9) {
    animation-delay: 0.9s;
}

.stagger-children>*:nth-child(10) {
    animation-delay: 1s;
}

/* Performance Optimized Animations */
@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;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-animate],
    .reveal,
    .reveal-stagger>* {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
