/* ===================================
   ANIMACIONES PREMIUM - APPLE STYLE
   =================================== */

/* === VARIABLES GLOBALES === */
:root {
    --ease-in-out-quint: cubic-bezier(0.86, 0, 0.07, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out-cubic: cubic-bezier(0.65, 0, 0.35, 1);
}

/* === ANIMACIONES BASE === */
.animate-on-scroll {
    opacity: 0;
    will-change: transform, opacity, filter;
}

.animate-on-scroll.animated {
    opacity: 1;
}

/* === KEYFRAMES PREMIUM === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.96);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-80px) scale(0.94);
        filter: blur(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(80px) scale(0.94);
        filter: blur(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
        filter: blur(25px);
    }
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(1.15);
        filter: blur(30px);
    }
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

@keyframes gradientMove {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateY(40px) rotateX(25deg);
        filter: blur(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
        filter: blur(0);
    }
}

@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(100px);
        filter: blur(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* === CLASES DE ANIMACIÓN === */
.fade-in-up {
    animation: fadeInUp 1.4s var(--ease-out-expo) forwards;
}

.fade-in-left {
    animation: fadeInLeft 1.6s var(--ease-out-expo) forwards;
}

.fade-in-right {
    animation: fadeInRight 1.6s var(--ease-out-expo) forwards;
}

.scale-in {
    animation: scaleIn 1.8s var(--ease-out-expo) forwards;
}

.fade-in-scale {
    animation: fadeInScale 2s var(--ease-out-expo) forwards;
}

.float-animation {
    animation: float 6s var(--ease-in-out-quint) infinite;
}

.pulse-animation {
    animation: pulse 3s var(--ease-in-out-cubic) infinite;
}

.text-reveal {
    animation: textReveal 1.5s var(--ease-out-expo) forwards;
    transform-origin: center bottom;
    perspective: 1000px;
}

.slide-in-bottom {
    animation: slideInBottom 1.2s var(--ease-out-expo) forwards;
}

/* === EFECTO RIPPLE MEJORADO === */
.ripple-effect {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%);
    transform: scale(0);
    animation: rippleAnimation 0.8s var(--ease-out-expo);
    pointer-events: none;
}

@keyframes rippleAnimation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* === GLASSMORPHISM PREMIUM === */
.glassmorphism {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.06),
        0 2px 8px 0 rgba(0, 0, 0, 0.04),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.6);
    transition: all 0.8s var(--ease-out-expo);
}

.glassmorphism:hover {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    box-shadow: 
        0 16px 48px 0 rgba(0, 0, 0, 0.08),
        0 4px 12px 0 rgba(0, 0, 0, 0.05),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.7);
}

/* === CARD HOVER PREMIUM === */
.card-hover {
    position: relative;
    transition: all 0.8s var(--ease-out-expo);
    transform-style: preserve-3d;
    perspective: 1200px;
    will-change: transform, box-shadow;
}

.card-hover::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, 
        #000000 0%, 
        #2a2a2a 25%,
        #4a4a4a 50%,
        #2a2a2a 75%,
        #000000 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.8s var(--ease-out-expo);
    background-size: 300% 300%;
    animation: gradientMove 6s ease infinite;
}

.card-hover::after {
    content: '';
    position: absolute;
    inset: -100px;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
        rgba(255, 255, 255, 0.15) 0%, 
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.8s var(--ease-out-expo);
    pointer-events: none;
    border-radius: inherit;
}

.card-hover:hover::before {
    opacity: 1;
}

.card-hover:hover::after {
    opacity: 1;
}

.card-hover:hover {
    transform: translateY(-16px) scale(1.02) rotateX(2deg);
    box-shadow: 
        0 40px 80px rgba(0, 0, 0, 0.12),
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 8px 20px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.04);
}

/* === SHINE EFFECT PREMIUM === */
.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -120%;
    width: 80%;
    height: 200%;
    background: linear-gradient(
        110deg,
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.3) 45%,
        rgba(255, 255, 255, 0.7) 50%,
        rgba(255, 255, 255, 0.3) 55%,
        transparent 60%,
        transparent 100%
    );
    transform: skewX(-20deg);
    transition: left 1.2s var(--ease-out-expo);
}

.shine-effect:hover::after {
    left: 160%;
    transition: left 1.4s var(--ease-out-expo);
}

/* === GRADIENT TEXT PREMIUM === */
.gradient-text {
    background: linear-gradient(
        135deg,
        #000000 0%,
        #1a1a1a 15%,
        #2a2a2a 30%,
        #4a4a4a 45%,
        #5a5a5a 50%,
        #4a4a4a 55%,
        #2a2a2a 70%,
        #1a1a1a 85%,
        #000000 100%
    );
    background-size: 400% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 10s var(--ease-in-out-quint) infinite;
    letter-spacing: -0.05em;
    font-weight: 700;
}

/* === BOTONES PREMIUM === */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.6s var(--ease-out-expo);
    will-change: transform, box-shadow;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.6s var(--ease-out-expo);
}

.btn:hover::before {
    opacity: 1;
}

.btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 8px 16px rgba(0, 0, 0, 0.12);
}

.btn:active {
    transform: translateY(-2px) scale(1.01);
    transition: all 0.2s var(--ease-out-expo);
}

/* === PARTÍCULAS === */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    animation: float-particle 12s ease-in-out infinite;
    will-change: transform;
}

@keyframes float-particle {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(30px, -40px) rotate(90deg) scale(1.2);
        opacity: 0.5;
    }
    50% {
        transform: translate(-30px, -80px) rotate(180deg) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translate(-60px, -40px) rotate(270deg) scale(1.1);
        opacity: 0.6;
    }
}

/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(245, 245, 245, 1) 0%, 
        rgba(235, 235, 235, 1) 40%,
        rgba(245, 245, 245, 1) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 2s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* === SCROLL REVEAL === */
.scroll-reveal {
    opacity: 0;
    transform: translateY(100px);
    transition: all 1.2s var(--ease-out-expo);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* === STAGGER ANIMATIONS === */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* === SMOOTH TRANSITIONS === */
* {
    scroll-behavior: smooth;
}

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

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .animate-on-scroll {
        animation-duration: 0.8s !important;
    }
    
    .fade-in-left,
    .fade-in-right {
        animation-name: fadeInUp !important;
    }
    
    .card-hover:hover {
        transform: translateY(-8px) scale(1.01);
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
            filter: blur(5px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
            filter: blur(0);
        }
    }
}

/* === PAGE LOAD ANIMATION === */
@keyframes pageLoad {
    from {
        opacity: 0;
        filter: blur(20px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

body {
    animation: pageLoad 0.8s var(--ease-out-expo);
}

/* === FOCUS VISIBLE === */
*:focus-visible {
    outline: 2px solid #000;
    outline-offset: 4px;
    border-radius: 8px;
    transition: outline-offset 0.3s var(--ease-out-expo);
}
