.titulo-seccion {
    display: block;
    text-align: center;
    margin: 4rem auto 3rem;
    padding: 0;
    color: var(--blue-dark, #003D73);
    font-weight: 800;
    font-size: 2rem;
    background-color: transparent;
    border: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    width: fit-content;
}

.titulo-seccion::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: #0085C8;
    margin: 0.8rem auto 0;
    border-radius: 2px;
}

.seccion-por-que-elegirnos-contenedor {
    width: 100%;
    background-color: #0085C8;
}

.contenedor-carrusel {
    position: relative;
    left: 50%;
    right: 50%;
    width: 100vw;
    margin-top: 2rem;
    margin-right: -50vw;
    margin-left: -50vw;
}

.carrusel-contenedor {
    width: 100%;
    overflow: hidden;
    position: relative; /* Base para los botones */
    background-color: #0085C8;
    border-radius: 8px; /* Look más moderno y contenido */
    margin: 0 auto;
    max-width: 1400px; /* Limitar el ancho máximo para pantallas ultra-wide */
}

.carrusel-deslizador {
    display: flex;
    overflow: hidden; /* Cambiado de scroll a hidden para control total por JS */
    scroll-behavior: auto; /* Desactivar scroll nativo para usar transforms */
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform;
    width: 300%; /* Ancho para 3 slides */
    height: 450px; /* Altura fija para consistencia */
}

.carrusel-diapositiva {
    display: grid;
    grid-template-columns: 50% 50%;
    flex: 0 0 33.333%; /* Cambiado para ocupar 1/3 del ancho total */
    width: 33.333%;
    min-width: 33.333%;
    height: 450px;
    scroll-snap-align: start;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.diapositiva-contenido {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-right: -50px;
    padding: 3rem 4rem;
    color: white;
    background-color: #0085C8;
    clip-path: polygon(0 0, 90% 0, 100% 50%, 90% 100%, 0 100%);
}

.diapositiva-contenido h3 {
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 2.5rem;
}

.diapositiva-contenido p {
    font-size: 1.1rem;
    line-height: 1.6;
}

.diapositiva-imagen {
    z-index: 1;
    width: 100%;
    height: 100%;
    background-color: #ccc;
    background-size: cover;
    background-position: center;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    transform: translateZ(0); /* Forzar renderizado GPU */
}

/* Botones Navegación Carrusel */
.boton-carrusel {
    position: absolute;
    top: 50%;
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #004E8E;
    font-size: 1.2rem;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transform: translateY(-50%);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.boton-carrusel:hover {
    background-color: #0085C8;
    color: #ffffff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.boton-carrusel:active {
    transform: translateY(-50%) scale(0.95);
}

.boton-carrusel--anterior {
    left: 20px;
}

.boton-carrusel--siguiente {
    right: 20px;
}

/* 2. SECCIÓN ESPECIALIDADES (BLOQUES AZULES CON CÍRCULOS) */
.seccion-especialidades-contenedor {
    width: 100%;
    margin-bottom: 4rem;
    background-color: #ffffff;
}

.titulo-seccion-especialidades-externo {
    display: block;
    text-align: center;
    margin: 4rem auto 3rem;
    padding: 0;
    color: var(--blue-dark, #003D73);
    font-weight: 800;
    font-size: 2rem;
    background-color: transparent;
    border: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    width: fit-content;
}

.titulo-seccion-especialidades-externo::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: #ffffff; /* White against blue background transition */
    margin: 0.8rem auto 0;
    border-radius: 2px;
}

.seccion-especialidades {
    position: relative;
    left: 50%;
    right: 50%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Evita que las tarjetas se rompan en resoluciones medias */
    gap: 4rem; /* Reduced gap to accommodate cards */
    width: 100vw;
    margin-right: -50vw;
    margin-left: -50vw;
    padding: 5rem 0;
    background-color: #0085C8;
}

.item-especialidad {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.05); /* Very subtle card feel */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2.5rem 1.5rem;
    gap: 1.5rem;
    flex: 0 0 320px; /* Fixed width for better card consistency */
    text-align: center;
    color: #ffffff;
    text-decoration: none; /* For the new <a> wrapper */
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

.item-especialidad::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.item-especialidad:hover {
    background-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.item-especialidad:hover::before {
    opacity: 1;
}

.item-especialidad h3 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin: 0;
}

.img-especialidad {
    width: 160px; /* Slightly smaller to fit in the card comfortably */
    height: 160px;
    object-fit: cover;
    border-radius: 50%;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.item-especialidad:hover .img-especialidad {
    transform: scale(1.1) rotate(5deg);
}

.item-especialidad p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    min-height: 80px; /* Consistency in card height */
}

.boton-tarjeta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    color: #003D73;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-top: 0.5rem;
}

.item-especialidad:hover .boton-tarjeta {
    background: #003D73;
    color: white;
    transform: scale(1.05);
}

/* Logo hover removed to prevent layout jitter as it was redundant and misconfigured */

/* 3. RESPONSIVIDAD ESPECÍFICA DE LA HOME */

@media (max-width: 1024px) {
    .seccion-especialidades {
        gap: 5rem;
    }
}

@media (max-width: 768px) {
    .carrusel-diapositiva {
        display: grid;
        grid-template-columns: 100%;
        grid-template-rows: 1fr 250px; /* Text takes available space, image is fixed at bottom */
        height: 550px; /* Uniform height for all slides */
        flex: 0 0 33.333%; /* Mantener el ancho original para el cálculo */
        width: 33.333%;
        min-width: 33.333%;
    }

    .diapositiva-contenido {
        margin-right: 0;
        padding: 2rem 2.5rem; /* Balanced padding */
        clip-path: none;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden; /* Safety against text overflow */
    }

    .diapositiva-contenido h3 {
        font-size: 1.5rem; /* Reduced to fit better in mobile */
        margin-bottom: 0.5rem;
    }

    .diapositiva-contenido p {
        font-size: 0.95rem; /* Reduced for mobile */
        line-height: 1.4;
    }

    .diapositiva-imagen {
        height: 250px;
    }

    .boton-carrusel {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
        top: auto;
        bottom: 100px; /* Positioned roughly over the image area */
        transform: none;
    }

    .boton-carrusel:hover {
        transform: scale(1.1); /* Simplified hover transform for mobile */
    }

    .boton-carrusel--anterior {
        left: 10px;
    }

    .boton-carrusel--siguiente {
        right: 10px;
    }

    .carrusel-deslizador {
        width: 300%; /* Mantener para deslizar */
        height: 550px; /* Fixed height matching slides */
    }

    .seccion-especialidades {
        flex-direction: column;
        align-items: center;
        gap: 3rem;
        padding: 4rem 0; /* Changed from 1rem to 0 to respect the full width on mobile */
        width: 100vw; /* Keep full bleed on mobile */
        margin-right: -50vw;
        margin-left: -50vw;
        left: 50%;
        right: 50%;
    }

    .item-especialidad {
        flex: 0 0 auto;
        width: 90%;
        max-width: 340px;
        padding: 2rem 1.5rem;
        margin: 0 auto; /* Ensure centering within flex/grid */
    }

    .img-especialidad {
        width: 140px;
        height: 140px;
        display: block;
        margin: 0 auto; /* Explicit center */
    }

    .item-especialidad p {
        max-height: none;
        opacity: 1;
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    .titulo-seccion,
    .titulo-seccion-especialidades-externo {
        font-size: 1.5rem;
        padding: 0;
        max-width: none;
        margin: 3rem auto 2rem;
    }
}

/* 4. SECCIÓN INFORMACIÓN LATERAL (TEXTO + IMAGEN) */
.index-side-content {
    padding: 6rem 8%;
    background-color: #ffffff;
}

.index-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: center;
}

.index-text-block h2 {
    font-size: 2.5rem;
    color: var(--blue-dark, #003D73);
    margin-bottom: 1.5rem;
    font-weight: 900;
}

.index-text-block p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #555;
    margin-bottom: 2rem;
}

.index-image-block {
    position: relative;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    height: 450px;
}

.index-image-block img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.index-image-block:hover img {
    transform: scale(1.05);
}

/* Ajustes Map Footer */
.footer__mapa-contenedor {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 3px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .index-grid-2 {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .index-image-block {
        height: 300px;
        order: -1;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .index-text-block h2 {
        font-size: 2rem;
    }
}

/* Accessibility & Sticky Navbar Fixes */
.encabezado {
    position: fixed !important;
    top: 0;
    width: 100% !important;
    left: 0;
    z-index: 9999 !important;
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}

.encabezado__logo-imagen {
    margin: 0 !important;
    transform: none !important;
    position: relative !important;
    top: 0 !important;
    background-image: url('../img/logo_transparent.png') !important;
}

.encabezado__logo-contenedor {
    display: flex !important;
    align-items: center !important;
}


/* Centrar texto en los botones de llamada a la acción (Contactar) */
.boton-llamada-accion {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

/* Visibilidad de foco y accesibilidad */
:focus-visible {
    outline: 3px solid #00E5FF !important;
    outline-offset: 3px;
    border-radius: 2px;
}

/* Contraste en las tarjetas de especialidades */
.item-especialidad h3,
.item-especialidad p {
    color: #FFFFFF !important;
}