/* ============================================================
   News Grid All v1.3 — full-width + flujo vertical correcto
   ============================================================ */

/* ── CONTENEDOR PADRE INMEDIATO ──
   Forzamos al .elementor-widget-container (el padre directo
   del wrapper) a ser él mismo full-width. Así el wrapper queda
   en flujo normal, sin trucos de margin negativo, y el padre
   reporta correctamente su altura al resto del documento. */
.elementor-widget-container:has(> .ngrid-wrapper),
.elementor-shortcode:has(> .ngrid-wrapper) {
    width: 100% !important;
    max-width: none !important;
}

.ngrid-wrapper {
    --ngrid-primary: #0b3d55;
    --ngrid-accent:  #d49500;
    --ngrid-light:   #6baaaf;
    --ngrid-text:    #1f2937;
    --ngrid-muted:   #64748b;
    --ngrid-bg:      #ffffff;
    --ngrid-border:  #e5e7eb;

    /* En flujo normal, sin extracción */
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: clamp(16px, 2vw, 32px) clamp(20px, 4vw, 64px);
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    container-type: inline-size;
    container-name: ngridw;
}

.ngrid-wrapper *,
.ngrid-wrapper *::before,
.ngrid-wrapper *::after {
    box-sizing: border-box;
}

/* ── Modo boxed opcional: respeta el ancho original del padre ── */
.ngrid-wrapper.ngrid-boxed {
    padding: clamp(16px, 2vw, 32px) 0;
}

/* ── GRID basado en ancho del contenedor ── */
.ngrid-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(16px, 1.8vw, 32px);
    width: 100%;
}

@container ngridw (max-width: 980px) {
    .ngrid-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container ngridw (max-width: 600px) {
    .ngrid-grid { grid-template-columns: 1fr; }
}

@supports not (container-type: inline-size) {
    @media (max-width: 980px) {
        .ngrid-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
    @media (max-width: 600px) {
        .ngrid-grid { grid-template-columns: 1fr; }
    }
}

/* ── CARD ── */
.ngrid-card {
    background: var(--ngrid-bg);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(11, 61, 85, 0.08);
    overflow: hidden;
    transition: transform .35s ease, box-shadow .35s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ngrid-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(11, 61, 85, 0.18);
}

.ngrid-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* ── MEDIA ── */
.ngrid-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    min-height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #e8f4f6 0%, #d0e8ec 100%);
}

.ngrid-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .6s ease;
}

.ngrid-card:hover .ngrid-card-media img {
    transform: scale(1.04);
}

.ngrid-card-noimg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ngrid-primary);
    opacity: .25;
}

.ngrid-card-tag {
    position: absolute;
    top: 14px;
    left: 14px;
    background: rgba(11, 61, 85, 0.95);
    color: #fff;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.20);
}

/* ── BODY ── */
.ngrid-card-body {
    padding: clamp(16px, 1.5vw, 24px);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.ngrid-card-date {
    font-size: 12px;
    color: var(--ngrid-muted);
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.ngrid-card-title {
    margin: 0 0 10px;
    font-size: clamp(16px, 1.1vw, 21px);
    font-weight: 700;
    color: var(--ngrid-text);
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ngrid-card-excerpt {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ngrid-muted);
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.ngrid-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ngrid-primary);
    font-weight: 700;
    font-size: 14px;
    transition: gap .25s ease, color .25s ease;
}

.ngrid-card:hover .ngrid-card-cta {
    gap: 10px;
    color: var(--ngrid-accent);
}

.ngrid-card-cta svg {
    transition: transform .25s ease;
}

.ngrid-card:hover .ngrid-card-cta svg {
    transform: translateX(2px);
}

/* ── EMPTY STATE ── */
.ngrid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    color: var(--ngrid-muted);
}

/* ── PAGINACIÓN ── */
.ngrid-pagination-wrap {
    margin-top: clamp(28px, 3vw, 48px);
    display: flex;
    justify-content: center;
}

.ngrid-pagination {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.ngrid-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid var(--ngrid-border);
    border-radius: 10px;
    color: var(--ngrid-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
    line-height: 1;
}

.ngrid-page-btn:hover:not(:disabled) {
    background: var(--ngrid-primary);
    color: #fff;
    border-color: var(--ngrid-primary);
    transform: translateY(-1px);
}

.ngrid-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ngrid-page-btn.is-active {
    background: var(--ngrid-primary);
    color: #fff;
    border-color: var(--ngrid-primary);
    box-shadow: 0 4px 12px rgba(11, 61, 85, 0.25);
}

.ngrid-page-gap {
    color: var(--ngrid-muted);
    padding: 0 4px;
    font-weight: 600;
    user-select: none;
}

/* ── LOADING STATE ── */
.ngrid-grid.is-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity .2s ease;
}

@media (max-width: 480px) {
    .ngrid-page-btn { min-width: 36px; height: 36px; font-size: 13px; padding: 0 8px; }
}
