/* =================================================================
   SLIDER DE TESTIMONIOS - FUNDECIMA (v4)
   - ★ 4 TARJETAS visibles en pantalla (responsive: 4 → 3 → 2 → 1)
   - Autoplay con loop infinito + barra de progreso en el indicador
   - Diseño minimalista profesional - Paleta de grises FUERTES
   ================================================================= */

/* ---------- Sección ---------- */
.testimonios-section {
    padding: 64px 0;
    background: #f3f3f5;
    position: relative;
}

/* ---------- Header ---------- */
.testimonios-header {
    text-align: center;
    margin-bottom: 34px;
    padding: 0 20px;
}

.testimonios-eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #6d6d76;
    margin-bottom: 10px;
}

.testimonios-header h2 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    color: #141418;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.testimonios-header p {
    font-size: 0.95rem;
    color: #63636b;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ---------- Wrapper del slider (★ MÁS ANCHO: 4 tarjetas) ---------- */
.testimonios-slider-wrapper {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
}

/* Degradados de borde: pista visual de que hay más contenido */
.testimonios-slider-wrapper::before,
.testimonios-slider-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 48px;
    z-index: 2;
    pointer-events: none;
}

.testimonios-slider-wrapper::before {
    left: 0;
    background: linear-gradient(to right, #f3f3f5 30%, rgba(243, 243, 245, 0));
}

.testimonios-slider-wrapper::after {
    right: 0;
    background: linear-gradient(to left, #f3f3f5 30%, rgba(243, 243, 245, 0));
}

/* ---------- Contenedor de tarjetas ---------- */
.testimonios-slider-container {
    --ts-gap: 18px;
    display: flex;
    gap: var(--ts-gap);
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 24px;   /* Debe coincidir con el padding-left */
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 18px 24px;
    position: relative;          /* Referencia correcta para offsetLeft */
    cursor: grab;
    outline: none;
}

.testimonios-slider-container::-webkit-scrollbar {
    display: none;
}

.testimonios-slider-container:focus-visible {
    outline: 2px solid #8f8f97;
    outline-offset: -2px;
    border-radius: 14px;
}

/* Estado de arrastre activo (evita lag del snap y selección de texto) */
.testimonios-slider-container.is-dragging {
    scroll-snap-type: none;
    scroll-behavior: auto;
    cursor: grabbing;
}

.testimonios-slider-container.is-dragging .testimonio-card {
    user-select: none;
}

/* ---------- Tarjeta de testimonio (★ 4 POR PANTALLA) ---------- */
.testimonio-card {
    /* 4 tarjetas visibles: (ancho total - 3 separaciones) / 4 */
    flex: 0 0 calc((100% - (3 * var(--ts-gap))) / 4);
    scroll-snap-align: start;
    background: #ffffff;
    border-radius: 14px;
    padding: 22px 20px 18px;
    border: 1px solid #d9d9de;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.testimonio-card:hover {
    border-color: #c6c6cc;
    box-shadow: 0 6px 18px rgba(18, 18, 24, 0.10);
    transform: translateY(-2px);
}

/* Tarjeta activa (feedback visual del autoplay) */
.testimonio-card.activa {
    border-color: #2c2c33;
    box-shadow: 0 8px 22px rgba(18, 18, 24, 0.12);
}

/* ---------- Insignia "Destacado" ---------- */
.testimonio-destacado {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: #232329;
    color: #f5f5f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ---------- Icono de persona ---------- */
.testimonio-icon-wrapper {
    width: 46px;
    height: 46px;
    background: #e7e7eb;
    border: 1px solid #d9d9de;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: #46464e;
}

.testimonio-icon-wrapper i {
    font-size: 1.15rem;
}

/* ---------- Comillas decorativas ---------- */
.testimonio-quotes {
    font-size: 2.2rem;
    line-height: 1;
    color: #d4d4da;
    margin-bottom: -8px;
    font-family: Georgia, serif;
    user-select: none;
}

/* ---------- Mensaje ---------- */
.testimonio-mensaje {
    font-size: 0.9rem;
    color: #26262c;
    line-height: 1.6;
    margin-bottom: 16px;
    font-style: italic;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Bloque de información ---------- */
.testimonio-info {
    padding-top: 14px;
    border-top: 1px solid #e3e3e8;
}

/* Estrellas (contraste fuerte) */
.testimonio-estrellas {
    display: flex;
    gap: 3px;
    margin-bottom: 10px;
}

.testimonio-estrellas i {
    font-size: 0.78rem;
    color: #c9c9cf;
}

.testimonio-estrellas i.activa {
    color: #3c3c44;
}

/* Nombre */
.testimonio-nombre {
    font-family: 'Inter', sans-serif;
    font-size: 0.93rem;
    font-weight: 700;
    color: #131317;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}

/* Cargo */
.testimonio-cargo {
    font-size: 0.78rem;
    color: #5f5f68;
    margin-bottom: 8px;
}

/* Municipio (píldora) */
.testimonio-municipio {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #52525b;
    background: #e6e6ea;
    border: 1px solid #d7d7dc;
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 8px;
}

/* Fecha */
.testimonio-fecha {
    display: block;
    font-size: 0.72rem;
    color: #8c8c94;
}

/* ---------- ★ BLOQUE INFERIOR: autoplay + indicadores + contador ---------- */
.testimonios-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Botón Play / Pausa del autoplay */
.testimonios-autoplay-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #d9d9de;
    color: #2c2c33;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 6px rgba(18, 18, 24, 0.06);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.testimonios-autoplay-btn:hover {
    background: #f0f0f2;
    border-color: #c6c6cc;
    box-shadow: 0 3px 10px rgba(18, 18, 24, 0.10);
}

.testimonios-autoplay-btn:focus-visible {
    outline: 2px solid #8f8f97;
    outline-offset: 2px;
}

.testimonios-autoplay-btn i {
    font-size: 0.6rem;
}

/* Indicadores */
.testimonios-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.testimonio-indicator {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #c3c3ca;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.25s ease, width 0.25s ease;
    position: relative;
}

.testimonio-indicator:hover {
    background: #9d9da5;
}

.testimonio-indicator.active {
    background: #2c2c33;
    width: 26px;
    overflow: hidden;
}

/* ★ Barra de progreso del autoplay (dentro del indicador activo) */
.testimonio-indicator-progreso {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.55);
    transform-origin: left center;
    animation-name: tsAutoplayProgreso;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes tsAutoplayProgreso {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Contador */
.testimonios-counter {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #8c8c94;
    font-variant-numeric: tabular-nums;
}

/* ---------- Estado de carga / error ---------- */
.ts-cargando {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 220px;
    color: #77777f;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.ts-cargando__spinner {
    width: 22px;
    height: 22px;
    border: 2px solid #dcdce1;
    border-top-color: #55555e;
    border-radius: 50%;
    animation: tsSpin 0.7s linear infinite;
}

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

/* Botón reintentar (estado de error) */
.ts-error-reintentar {
    background: #232329;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ts-error-reintentar:hover {
    background: #3a3a41;
}

/* ---------- Responsive ---------- */

/* Tablet horizontal: 3 tarjetas */
@media (max-width: 1180px) {
    .testimonio-card {
        flex: 0 0 calc((100% - (2 * var(--ts-gap))) / 3);
    }
}

/* Tablet vertical: 2 tarjetas */
@media (max-width: 860px) {
    .testimonios-section {
        padding: 46px 0;
    }

    .testimonios-header h2 {
        font-size: 1.35rem;
    }

    .testimonios-header p {
        font-size: 0.9rem;
    }

    .testimonios-slider-wrapper::before,
    .testimonios-slider-wrapper::after {
        width: 32px;
    }

    .testimonio-card {
        flex: 0 0 calc((100% - var(--ts-gap)) / 2);
        padding: 20px 18px 16px;
    }

    .testimonios-footer {
        gap: 12px;
    }
}

/* Móvil: 1 tarjeta con vista previa de la siguiente */
@media (max-width: 560px) {
    .testimonios-slider-container {
        scroll-padding-left: 20px;
        padding: 14px 20px;
    }

    .testimonio-card {
        flex: 0 0 84%;
    }

    .testimonio-mensaje {
        font-size: 0.88rem;
        -webkit-line-clamp: 3;
    }

    .testimonios-footer {
        gap: 10px;
    }
}

/* ---------- Accesibilidad ---------- */
@media (prefers-reduced-motion: reduce) {
    .testimonio-card,
    .testimonio-indicator,
    .testimonios-autoplay-btn,
    .ts-error-reintentar {
        transition: none;
    }
}