*, *::before, *::after {
    box-sizing: border-box !important;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background-color: #FFFFFF;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   PAGE MASTER WRAPPER - Garantía matemática anti-overflow
   ========================================================================== */

.page-master-wrapper {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    display: flex;
    flex-wrap: wrap;
}

/* ==========================================================================
   LAYOUT PRINCIPAL - 1 COLUMNA (Sin aside)
   ========================================================================== */

.home-institutional {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* ==========================================================================
   COLUMNA PRINCIPAL (75%)
   ========================================================================== */

.main-column {
    background-color: #FFFFFF;
    min-width: 0;
}

/* ==========================================================================
   HERO CARRUSEL - ASPECT RATIO
   ========================================================================== */

.carousel-section {
    position: relative;
    width: 100%;
    aspect-ratio: 21 / 9;
    max-height: 60vh;
    min-height: 220px;
    overflow: hidden;
    background-color: #1B365D;
}

.carousel-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* DOTS */
.carousel-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.carousel-dot:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.carousel-dot.active {
    background-color: #FFFFFF;
    border-color: #FFFFFF;
}

/* ==========================================================================
   SECCIÓN ACCESOS
   ========================================================================== */

.accesos-section {
    padding: 40px 0;
}

/* ==========================================================================
   WRAPPER - Contenedor sin padding (el padding está en el carrusel)
   ========================================================================== */

.accesos-wrapper {
    position: relative;
    width: 100%;
    padding: 0; /* Sin padding - el espacio lo maneja el carrusel */
    box-sizing: border-box;
}

/* Cuando caben todas las tarjetas - Sin flechas */
.accesos-wrapper.no-overflow .carousel-arrow {
    display: none !important;
}

/* ==========================================================================
   FLECHAS ELEGANTES - Invisibles/sutiles
   ========================================================================== */

.carousel-arrow {
    display: flex;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background-color: #FFFFFF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    color: #6B7280;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.carousel-arrow-left {
    left: 10px;
}

.carousel-arrow-right {
    right: 10px;
}

.carousel-arrow:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.carousel-arrow i {
    font-size: 14px;
}

/* ==========================================================================
   CARRUSEL DE TARJETAS - MATEMÁTICA FLUIDA
   ========================================================================== */

.accesos-carousel {
    width: 100%;
    display: flex;
    gap: 24px;
    justify-content: center; /* Centra las tarjetas cuando no hay overflow */
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 8px 80px 16px 80px; /* Padding lateral crea espacio para flechas */
    box-sizing: border-box;
    
    /* Sin scrollbar visible */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.accesos-carousel::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   TARJETA - FÓRMULA MATEMÁTICA FLUIDA
   ========================================================================== */

.acceso-card {
    flex: 0 0 calc((100% - (3 * 24px)) / 4);
    min-width: 200px;
    scroll-snap-align: start;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    
    background: #FFFFFF;
    border: 1px solid #EAEAEA;
    border-radius: 4px;
    padding: 28px 20px;
    
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.acceso-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* ICONO - Monocromático gris oscuro */
.acceso-card-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F3F4F6;
    border-radius: 10px;
    margin-bottom: 18px;
}

.acceso-card-icon i {
    font-size: 22px;
    color: #374151;
}

/* TÍTULO */
.acceso-card h3 {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

/* DESCRIPCIÓN */
.acceso-card p {
    font-family: inherit;
    font-size: 0.875rem;
    color: #6B7280;
    line-height: 1.5;
    margin: 0 0 18px 0;
    flex-grow: 1;
}

/* BOTÓN ENLACE */
.btn-enlace {
    display: inline-block;
    padding: 10px 22px;
    background-color: #1B365D;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin-top: auto;
}

.btn-enlace:hover {
    background-color: #2A4A75;
    color: #FFFFFF;
    text-decoration: none;
}

/* BOTÓN SECUNDARIO - Estilo outline */
.btn-enlace-secundario {
    display: inline-block;
    padding: 10px 22px;
    background-color: transparent;
    color: #1B365D;
    border: 1px solid #1B365D;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-top: auto;
}

.btn-enlace-secundario:hover {
    background-color: #1B365D;
    color: #FFFFFF;
    text-decoration: none;
}

/* CONTENEDOR DE BOTONES - Layout responsivo */
.acceso-card-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: auto;
}

/* Desktop: botones en horizontal si hay espacio */
@media (min-width: 1200px) {
    .acceso-card-buttons {
        flex-direction: row;
        justify-content: center;
    }
    
    .acceso-card-buttons .btn-enlace,
    .acceso-card-buttons .btn-enlace-secundario {
        flex: 1;
        text-align: center;
        padding: 10px 16px;
        font-size: 0.75rem;
    }
}

/* Móvil: botones apilados con ancho completo */
@media (max-width: 1199px) {
    .acceso-card-buttons .btn-enlace,
    .acceso-card-buttons .btn-enlace-secundario {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   THUMBNAIL - Imagen 80x80px con aspect ratio perfecto
   ========================================================================== */

.news-thumbnail {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.news-card:hover .news-thumbnail {
    border-color: #3B82F6;
}

.news-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.news-card:hover .news-thumbnail img {
    transform: scale(1.05);
}

/* Placeholder con gradiente premium */
.news-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    border-radius: 6px;
}

.news-thumbnail-placeholder i {
    font-size: 28px;
    color: #9CA3AF;
    transition: color 0.3s ease;
}

.news-card:hover .news-thumbnail-placeholder i {
    color: #6B7280;
}

/* ==========================================================================
   CONTENIDO DE LA TARJETA
   ========================================================================== */

.news-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 6px;
}

/* Título con tipografía jerárquica */
.news-card-title {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.35;
    transition: color 0.2s ease;
    
    /* Truncar a 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card:hover .news-card-title {
    color: #1B365D;
}

/* Extracto con color secundario */
.news-card-excerpt {
    font-family: inherit;
    font-size: 0.875rem;
    color: #6B7280;
    line-height: 1.45;
    margin: 0;
    
    /* Truncar a 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   INDICADOR VISUAL - Flecha hover
   ========================================================================== */

.news-card-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    align-self: center;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.3s ease;
}

.news-card:hover .news-card-arrow {
    opacity: 1;
    transform: translateX(0);
}

.news-card-arrow i {
    font-size: 12px;
    color: #3B82F6;
}

/* ==========================================================================
   COMPATIBILIDAD - Mantener clases antiguas por si se referencian
   ========================================================================== */

.media-object {
    /* Deprecated - usar .news-card */
}

.media-image-frame {
    /* Deprecated - usar .news-thumbnail */
}

.media-content {
    /* Deprecated - usar .news-card-content */
}

/* ==========================================================================
   RESPONSIVE - FLUID BREAKPOINTS
   ========================================================================== */

/* Monitores Ultra-Anchos (4K+) - 5 tarjetas accesos */
@media (min-width: 1800px) {
    .acceso-card {
        flex: 0 0 calc((100% - (4 * 24px)) / 5);
    }
    
    .carousel-section {
        aspect-ratio: 21 / 7;
    }
}

/* Laptops grandes - 4 tarjetas (default) */
@media (max-width: 1799px) and (min-width: 1200px) {
    .acceso-card {
        flex: 0 0 calc((100% - (3 * 24px)) / 4);
    }
}

/* Laptops pequeñas - 3 tarjetas */
@media (max-width: 1199px) and (min-width: 1025px) {
    .acceso-card {
        flex: 0 0 calc((100% - (2 * 24px)) / 3);
    }
}

/* Tablets - Layout adaptado */
@media (max-width: 1024px) {
    .carousel-section {
        aspect-ratio: 16 / 9;
        max-height: 50vh;
    }
    
    .acceso-card {
        flex: 0 0 calc((100% - (2 * 24px)) / 3);
        min-width: 220px;
    }
}

/* ==========================================================================
   FIX OVERLAP FLECHAS - Portátiles, tablets y móviles usan swipe
   ========================================================================== */

@media (max-width: 1024px) {
    .carousel-arrow {
        display: none !important; /* Flechas ocultas - swipe natural */
    }
    
    .accesos-carousel {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* ==========================================================================
   MÓVIL PREMIUM < 768px
   ========================================================================== */

@media (max-width: 768px) {
    .accesos-section {
        padding: 32px 0;
    }
    
    .accesos-carousel {
        gap: 16px;
        padding: 8px 0 16px 0;
    }
    
    /* TARJETA MÓVIL - 85vw (asoma siguiente) */
    .acceso-card {
        flex: 0 0 85vw;
        max-width: 320px;
        min-width: auto;
        scroll-snap-align: center;
    }
    
    .carousel-section {
        aspect-ratio: 16 / 9;
        max-height: 45vh;
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    .accesos-section {
        padding: 24px 0;
    }
    
    .accesos-carousel {
        gap: 12px;
        padding: 8px 0 16px 0;
    }
    
    .acceso-card {
        flex: 0 0 85vw;
        padding: 24px 16px;
    }
    
    .acceso-card-icon {
        width: 44px;
        height: 44px;
    }
    
    .acceso-card-icon i {
        font-size: 18px;
    }
    
    .carousel-section {
        aspect-ratio: 4 / 3;
        max-height: 40vh;
    }
}
