/* =================================================================
   Portfolio DAM - Animations CSS
   ================================================================= */

/* Keyframes - Animaciones principales */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
        opacity: 0.7;
    }
    25% { 
        transform: translateY(-10px) rotate(2deg); 
        opacity: 0.9;
    }
    50% { 
        transform: translateY(-20px) rotate(-1deg); 
        opacity: 1;
    }
    75% { 
        transform: translateY(-10px) rotate(1deg); 
        opacity: 0.9;
    }
}

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

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

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

@keyframes slideInRight {
    from { 
        transform: translateX(100px); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInScale {
    from { 
        opacity: 0; 
        transform: scale(0.8); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

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

@keyframes pulseGlow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3); 
    }
    50% { 
        box-shadow: 0 0 40px rgba(102, 126, 234, 0.6), 
                    0 0 60px rgba(102, 126, 234, 0.4); 
    }
}

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

@keyframes rotateY {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-15px);
    }
    70% {
        transform: translateY(-7px);
    }
    90% {
        transform: translateY(-3px);
    }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes wobble {
    0% { transform: translateX(0%); }
    15% { transform: translateX(-25%) rotate(-5deg); }
    30% { transform: translateX(20%) rotate(3deg); }
    45% { transform: translateX(-15%) rotate(-3deg); }
    60% { transform: translateX(10%) rotate(2deg); }
    75% { transform: translateX(-5%) rotate(-1deg); }
    100% { transform: translateX(0%); }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blinkCursor {
    from, to { border-color: transparent; }
    50% { border-color: var(--color-primary); }
}

@keyframes shimmer {
    0% { 
        transform: translateX(-100%) translateY(-100%) rotate(45deg); 
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% { 
        transform: translateX(100%) translateY(100%) rotate(45deg); 
        opacity: 0;
    }
}

@keyframes glowPulse {
    0%, 100% { 
        text-shadow: 0 0 5px var(--color-primary), 
                     0 0 10px var(--color-primary), 
                     0 0 15px var(--color-primary); 
    }
    50% { 
        text-shadow: 0 0 10px var(--color-primary), 
                     0 0 20px var(--color-primary), 
                     0 0 30px var(--color-primary), 
                     0 0 40px var(--color-primary); 
    }
}

@keyframes countUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes progressFill {
    from { width: 0%; }
    to { width: var(--target-width, 100%); }
}

@keyframes cardFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(-90deg); }
    100% { transform: rotateY(0deg); }
}

@keyframes morphButton {
    0% { border-radius: 50px; }
    50% { border-radius: 10px; transform: scale(1.1); }
    100% { border-radius: 50px; }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Animaciones de entrada escalonadas */
@keyframes staggerFadeIn {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Animaciones específicas para elementos */

/* Hero animations */
.hero-content h1 .hero-name {
    animation: slideInUp 1s ease;
}

.hero-content h1 .hero-title {
    animation: slideInUp 1s ease 0.2s both;
}

.hero-subtitle {
    animation: slideInUp 1s ease 0.4s both;
}

.cta-buttons {
    animation: slideInUp 1s ease 0.6s both;
}

.hero-stats {
    animation: slideInUp 1s ease 0.8s both;
}

.hero-image {
    animation: slideInRight 1s ease 1s both;
}

/* Floating elements animations */
.floating-shape:nth-child(1) {
    animation: float 6s ease-in-out infinite;
    animation-delay: 0s;
}

.floating-shape:nth-child(2) {
    animation: float 6s ease-in-out infinite;
    animation-delay: -2s;
}

.floating-shape:nth-child(3) {
    animation: float 6s ease-in-out infinite;
    animation-delay: -4s;
}

/* Skill card animations */
.skill-card {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.skill-card:hover {
    animation: morphButton 0.6s ease;
}

/* Project card animations */
.project-card {
    transition: all 0.5s cubic-bezier(0.23, 1, 0.320, 1);
}

.project-card:hover .project-image::before {
    animation: shimmer 0.8s ease-out;
}

/* Button animations */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.98);
}

/* Navigation animations */
.nav-links a {
    position: relative;
    overflow: hidden;
}

.nav-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
    transition: left 0.5s;
}

.nav-links a:hover::before {
    left: 100%;
}

/* Mobile menu animations */
.mobile-nav {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: translateY(-20px);
    opacity: 0;
}

.mobile-nav.active {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

/* Stats counter animations */
.stat-number {
    animation: countUp 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Progress bar animations */
.skill-bar {
    animation: progressFill 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Contact section animations */
.contact-method {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.contact-method:hover {
    animation: bounceSlow 2s infinite;
}

/* Footer animations */
.footer-social a {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.footer-social a:hover {
    animation: rotateY 0.6s ease;
}

/* Info cards floating animation */
.info-card:nth-child(1) {
    animation: float 6s ease-in-out infinite;
    animation-delay: 0s;
}

.info-card:nth-child(2) {
    animation: float 6s ease-in-out infinite;
    animation-delay: -2s;
}

.info-card:nth-child(3) {
    animation: float 6s ease-in-out infinite;
    animation-delay: -4s;
}

/* Stagger animations for grids */
.skills-grid .skill-card:nth-child(1) { animation-delay: 0.1s; }
.skills-grid .skill-card:nth-child(2) { animation-delay: 0.2s; }
.skills-grid .skill-card:nth-child(3) { animation-delay: 0.3s; }
.skills-grid .skill-card:nth-child(4) { animation-delay: 0.4s; }
.skills-grid .skill-card:nth-child(5) { animation-delay: 0.5s; }
.skills-grid .skill-card:nth-child(6) { animation-delay: 0.6s; }

.projects-grid .project-card:nth-child(1) { animation-delay: 0.1s; }
.projects-grid .project-card:nth-child(2) { animation-delay: 0.3s; }
.projects-grid .project-card:nth-child(3) { animation-delay: 0.5s; }

/* Loading animations */
.loading-spinner {
    animation: rotate 1s linear infinite;
}

.pulse-dot {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Hover effects especiales */
.special-hover:hover {
    animation: wobble 1s ease-in-out;
}

.glow-on-hover:hover {
    animation: glowPulse 2s ease-in-out infinite;
}

/* Animaciones de entrada para filtros */
.fade-in-filter {
    animation: staggerFadeIn 0.5s ease forwards;
}

/* Parallax smooth animation */
.parallax-element {
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* Responsive animations */
@media (max-width: 768px) {
    /* Reducir animaciones en móvil para mejor rendimiento */
    .floating-shape {
        animation-duration: 8s;
    }
    
    .hero-content h1 {
        animation-duration: 0.8s;
    }
    
    .skill-card:hover {
        transform: scale(1.02) rotate(1deg);
    }
    
    .project-card:hover {
        transform: translateY(-10px) scale(1.01);
    }
}

/* Preferencias de movimiento reducido */
@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;
    }
    
    .floating-shape {
        animation: none;
    }
    
    .parallax-element {
        transform: none !important;
    }
}

/* Animaciones para conexiones lentas */
.reduced-motion * {
    animation-duration: 0.1s !important;
    transition-duration: 0.1s !important;
}

.reduced-motion .floating-shape {
    animation: none;
    opacity: 0.3;
}