/* SJD NEWS - CSS STYLES - v1.3.1 */

/* --- Contenedor Principal del Grid --- */
.sjd-news-grid-container-v3 {
    display: grid;
    grid-template-columns: 1fr 1.8fr 1fr; /* Columna central más ancha */
    grid-template-rows: repeat(3, 1fr);
    grid-auto-flow: column;
    gap: 15px;
    font-family: sans-serif;
    margin-bottom: 20px;
    height: 600px; /* Altura fija para el contenedor */
}

/* --- Estilo General de cada Card --- */
.sjd-news-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background-size: cover;
    background-position: center center;
    background-color: #2c3e50;
    text-decoration: none;
    display: flex;
    align-items: flex-end;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sjd-news-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.sjd-news-item[style*="background-image"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.95) 100%);
    z-index: 1;
}

/* --- Layout de 3 columnas para Escritorio --- */
.sjd-news-item.sjd-news-large {
    grid-row: 1 / span 3;
    grid-column: 2;
}
.sjd-news-grid-container-v3 > a:nth-of-type(2) { grid-column: 1; grid-row: 1; }
.sjd-news-grid-container-v3 > a:nth-of-type(3) { grid-column: 3; grid-row: 1; }
.sjd-news-grid-container-v3 > a:nth-of-type(4) { grid-column: 1; grid-row: 2; }
.sjd-news-grid-container-v3 > a:nth-of-type(5) { grid-column: 3; grid-row: 2; }
.sjd-news-grid-container-v3 > a:nth-of-type(6) { grid-column: 1; grid-row: 3; }
.sjd-news-grid-container-v3 > a:nth-of-type(7) { grid-column: 3; grid-row: 3; }


/* --- Contenido dentro de las Cards --- */
.sjd-news-content {
    position: relative;
    z-index: 2;
    padding: 20px;
    width: 100%;
}

.sjd-news-cat {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 3;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.sjd-news-title {
    margin: 0;
    padding: 0;
    font-size: 16px;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0px 2px 6px rgba(0, 0, 0, 0.8);
}

.sjd-news-large .sjd-news-title {
    font-size: 28px;
}

/* --- Responsive --- */

/* --- CAMBIO: Media Query para Tablet corregida --- */
@media (max-width: 980px) {
    .sjd-news-grid-container-v3 {
        grid-template-columns: 1fr 1fr; /* 2 columnas */
        grid-template-rows: auto;
        grid-auto-flow: dense; /* Permite al grid rellenar huecos */
        height: auto;
    }
    
    .sjd-news-item.sjd-news-large {
        grid-column: 1 / span 2; /* Grande ocupa todo el ancho */
        grid-row: 1;
        min-height: 350px;
    }

    /* Esta es la corrección clave: reseteamos la posición de las cards pequeñas */
    .sjd-news-grid-container-v3 > a:not(.sjd-news-large) {
        grid-column: auto;
        grid-row: auto;
        min-height: 250px;
    }
}


@media (max-width: 767px) {
    .sjd-news-grid-container-v3 {
        display: flex; /* Cambiamos a Flexbox para una sola columna simple */
        flex-direction: column;
        height: auto;
    }
    .sjd-news-item {
        min-height: 280px;
    }
    .sjd-news-item.sjd-news-large {
        order: -1; /* La grande siempre primero */
    }
}