/* Efecto Texto Subrayado - Animación Horizontal SEO-Friendly CORREGIDO */
.texto-subrayado {
    position: relative;
    display: inline-block;
    /* RESPETA estilos heredados - sin italic, sin font-weight forzado */
}

.palabras-rotativas {
    position: relative;
    display: inline-block;
    min-width: 100px;
    height: 1.2em;
    line-height: 1.2;
}

/* TODAS las palabras en posición absoluta y con animación */
.palabra-rotativa {
    opacity: 0;
    position: absolute;
    left: 0;
    top: 0;
    animation: rotarTextoHorizontal 15s linear infinite;
    background-image: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    line-height: inherit;
    /* RESPETA estilos heredados del texto normal */
    font-style: inherit;
    font-weight: inherit;
    font-family: inherit;
    font-size: inherit;
}

/* Timing individual para cada palabra - TODAS animadas */
.palabra-rotativa:nth-child(1) { animation-delay: 0s; }
.palabra-rotativa:nth-child(2) { animation-delay: 3s; }
.palabra-rotativa:nth-child(3) { animation-delay: 6s; }
.palabra-rotativa:nth-child(4) { animation-delay: 9s; }
.palabra-rotativa:nth-child(5) { animation-delay: 12s; }

/* ANIMACIÓN HORIZONTAL - Mejorada para ciclo continuo */
@keyframes rotarTextoHorizontal {
    0% { 
        opacity: 0; 
        transform: translateX(-20px);
    }
    3% { 
        opacity: 1; 
        transform: translateX(0);
    }
    18% { 
        opacity: 1; 
        transform: translateX(0);
    }
    21% { 
        opacity: 0; 
        transform: translateX(20px);
    }
    100% { 
        opacity: 0; 
        transform: translateX(20px);
    }
}

/* SUBRAYADO CORREGIDO - Mejor alineación */
.texto-subrayado::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-image: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    animation: subrayar 3s infinite;
}

@keyframes subrayar {
    0%, 16% { 
        transform: scaleX(0); 
        opacity: 0; 
    }
    17% { 
        transform: scaleX(0.2); 
        opacity: 1; 
    }
    19% { 
        transform: scaleX(0.7); 
    }
    21% { 
        transform: scaleX(0.5); 
    }
    23% { 
        transform: scaleX(0.9); 
    }
    25% { 
        transform: scaleX(1); 
    }
    95% { 
        transform: scaleX(1); 
        opacity: 1; 
    }
    100% { 
        transform: scaleX(1); 
        opacity: 0; 
    }
}

/* MEJORAS DE ACCESIBILIDAD Y SEO - SIN afectar estilos visuales */
@media speech {
    .palabras-rotativas {
        display: none !important;
    }
    .texto-subrayado::before {
        content: "clientes, pacientes, alumnos, usuarios, leads";
        display: inline;
        background-image: none;
        background-clip: initial;
        -webkit-background-clip: initial;
        color: inherit;
        -webkit-text-fill-color: initial;
    }
}

/* Para navegadores que no soportan animaciones */
@media (prefers-reduced-motion: reduce) {
    .palabra-rotativa {
        animation: none;
        opacity: 1;
        position: relative;
    }
    .palabra-rotativa:not(:first-child) {
        display: none;
    }
    .texto-subrayado::after {
        animation: none;
        opacity: 1;
        transform: scaleX(1);
    }
}

/* Fallback para motores de búsqueda */
.no-js .palabras-rotativas {
    display: inline;
}

.no-js .palabra-rotativa {
    animation: none;
    opacity: 1;
    position: relative;
    display: inline;
}

.no-js .palabra-rotativa:not(:first-child)::before {
    content: ", ";
}

.no-js .texto-subrayado::after {
    animation: none;
    opacity: 1;
    transform: scaleX(1);
}