/* ========================================
   SOMOS TRIBU - Animaciones CSS
   ======================================== */

/* ========================================
   Animaciones de entrada
   ======================================== */
@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);
    }
}

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

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

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

/* ========================================
   Animaciones de rotación y movimiento
   ======================================== */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

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

/* ========================================
   Animaciones de resplandor (glow)
   ======================================== */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(124, 77, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(124, 77, 255, 0.6);
    }
}

@keyframes glowPulseGreen {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 230, 118, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 230, 118, 0.6);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(124, 77, 255, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(124, 77, 255, 0.8),
                     0 0 30px rgba(0, 230, 118, 0.5);
    }
}

/* ========================================
   Animaciones de micelio (red neuronal)
   ======================================== */
@keyframes myceliumGrow {
    0% {
        stroke-dashoffset: 1000;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0.5;
    }
}

@keyframes myceliumPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.02);
    }
}

@keyframes networkPulse {
    0%, 100% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.6;
    }
}

/* ========================================
   Animaciones de partículas
   ======================================== */
@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

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

/* ========================================
   Animaciones de gradiente
   ======================================== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes colorShift {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

/* ========================================
   Animaciones de texto
   ======================================== */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    50% {
        border-color: transparent;
    }
}

@keyframes glitchText {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

/* ========================================
   Animaciones de ondas
   ======================================== */
@keyframes wave {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

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

/* ========================================
   Clases de animación aplicables
   ======================================== */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

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

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

.animate-glow-green {
    animation: glowPulseGreen 2s ease-in-out infinite;
}

.animate-text-glow {
    animation: textGlow 3s ease-in-out infinite;
}

.animate-rotate {
    animation: rotate 20s linear infinite;
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

/* ========================================
   Delays para animaciones escalonadas
   ======================================== */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ========================================
   Animaciones específicas del Hero
   ======================================== */
.animate-title {
    animation: fadeInDown 1s ease-out 0.2s backwards,
               textGlow 3s ease-in-out 1.2s infinite;
}

.animate-subtitle {
    animation: fadeInUp 1s ease-out 0.5s backwards;
}

.animate-motto {
    animation: fadeInUp 1s ease-out 0.8s backwards;
}

/* ========================================
   Partículas de fondo animadas
   ======================================== */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(0, 230, 118, 0.8), transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 15s linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; }
.particle:nth-child(3) { left: 30%; animation-delay: 4s; }
.particle:nth-child(4) { left: 40%; animation-delay: 6s; }
.particle:nth-child(5) { left: 50%; animation-delay: 8s; }
.particle:nth-child(6) { left: 60%; animation-delay: 10s; }
.particle:nth-child(7) { left: 70%; animation-delay: 12s; }
.particle:nth-child(8) { left: 80%; animation-delay: 14s; }
.particle:nth-child(9) { left: 90%; animation-delay: 16s; }

/* ========================================
   Efectos de hover avanzados
   ======================================== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(124, 77, 255, 0.6),
                0 0 40px rgba(0, 230, 118, 0.3);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

/* ========================================
   Animaciones de carga
   ======================================== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(124, 77, 255, 0.2);
    border-top-color: #7c4dff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   Transiciones suaves
   ======================================== */
.smooth-transition {
    transition: all 0.3s ease;
}

.smooth-transition-slow {
    transition: all 0.5s ease;
}

/* ========================================
   Efectos de desenfoque y aparición
   ======================================== */
@keyframes blurIn {
    from {
        filter: blur(10px);
        opacity: 0;
    }
    to {
        filter: blur(0);
        opacity: 1;
    }
}

.animate-blur-in {
    animation: blurIn 1s ease-out forwards;
}

/* ========================================
   Animación de línea de progreso
   ======================================== */
@keyframes progressBar {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

.progress-line {
    animation: progressBar 1.5s ease-out forwards;
}

/* ========================================
   Efectos de texto neón
   ======================================== */
.neon-text {
    text-shadow: 
        0 0 5px rgba(0, 230, 118, 0.5),
        0 0 10px rgba(0, 230, 118, 0.4),
        0 0 20px rgba(0, 230, 118, 0.3),
        0 0 40px rgba(124, 77, 255, 0.2);
    animation: textGlow 2s ease-in-out infinite;
}

/* ========================================
   Animaciones de scroll reveal
   ======================================== */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   Animación de borde brillante
   ======================================== */
@keyframes borderGlow {
    0%, 100% {
        border-color: rgba(124, 77, 255, 0.3);
    }
    50% {
        border-color: rgba(0, 230, 118, 0.6);
    }
}

.border-glow {
    animation: borderGlow 2s ease-in-out infinite;
}

/* ========================================
   Efectos para botones
   ======================================== */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   Animación de ondas de audio
   ======================================== */
@keyframes audioWave {
    0%, 100% {
        height: 10px;
    }
    50% {
        height: 30px;
    }
}

.audio-visualizer span {
    display: inline-block;
    width: 4px;
    height: 10px;
    background: var(--color-secondary);
    margin: 0 2px;
    animation: audioWave 0.8s ease-in-out infinite;
}

.audio-visualizer span:nth-child(1) { animation-delay: 0s; }
.audio-visualizer span:nth-child(2) { animation-delay: 0.1s; }
.audio-visualizer span:nth-child(3) { animation-delay: 0.2s; }
.audio-visualizer span:nth-child(4) { animation-delay: 0.3s; }
.audio-visualizer span:nth-child(5) { animation-delay: 0.4s; }

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