/* =====================================================
   Noticias Blog v3 — front.css
   Grid de cards + Modal de noticia completa
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,700;1,400&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --nbf-accent:       #00897b;
    --nbf-accent-dark:  #00695c;
    --nbf-accent-light: #e0f2f1;
    --nbf-surface:      #ffffff;
    --nbf-bg:           #f4f7f6;
    --nbf-border:       #dde8e5;
    --nbf-text:         #1a2e2b;
    --nbf-muted:        #5c7470;
    --nbf-radius:       14px;
    --nbf-shadow:       0 2px 12px rgba(0,60,50,.07), 0 1px 3px rgba(0,60,50,.04);
    --nbf-shadow-hov:   0 12px 40px rgba(0,137,123,.16);
    --nbf-font-serif:   'Lora', Georgia, serif;
    --nbf-font-sans:    'Plus Jakarta Sans', system-ui, sans-serif;
}

/* =============================================================
   GRID
   ============================================================= */
.nb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 26px;
    padding: 4px 0 24px;
}

/* =============================================================
   CARD
   ============================================================= */
.nb-card {
    background: var(--nbf-surface);
    border-radius: var(--nbf-radius);
    border: 1px solid var(--nbf-border);
    box-shadow: var(--nbf-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: box-shadow .28s ease, transform .28s ease;
    outline: none;
}
.nb-card:hover,
.nb-card:focus-visible {
    box-shadow: var(--nbf-shadow-hov);
    transform: translateY(-5px);
}
.nb-card:focus-visible { outline: 2px solid var(--nbf-accent); outline-offset: 2px; }

/* Imagen card — tamaño 'large' de WP */
.nb-card__img-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--nbf-bg);
    flex-shrink: 0;
}
.nb-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}
.nb-card:hover .nb-card__img { transform: scale(1.05); }

/* Card sin imagen */
.nb-card--no-img { border-top: 3px solid var(--nbf-accent); }

/* Body */
.nb-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 22px 18px;
}

.nb-card__title {
    font-family: var(--nbf-font-serif);
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--nbf-text);
    margin: 0;
    line-height: 1.45;
    transition: color .2s;
}
.nb-card:hover .nb-card__title { color: var(--nbf-accent-dark); }

.nb-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}
.nb-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--nbf-font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--nbf-muted);
}
.nb-card__meta-item svg { color: var(--nbf-accent); flex-shrink: 0; }

.nb-card__excerpt {
    font-family: var(--nbf-font-sans);
    font-size: 0.875rem;
    line-height: 1.72;
    color: var(--nbf-muted);
    margin: 0;
    flex: 1;
}

/* CTA */
.nb-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--nbf-font-sans);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--nbf-accent);
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-top: 4px;
    transition: gap .2s, color .2s;
    user-select: none;
}
.nb-card:hover .nb-card__cta { gap: 9px; color: var(--nbf-accent-dark); }

/* =============================================================
   MODAL OVERLAY
   ============================================================= */
.nb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 26, 24, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: nbOverlayIn .22s ease;
}
@keyframes nbOverlayIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes nbOverlayOut { to   { opacity: 0; } }
.nb-modal-overlay.nb-closing { animation: nbOverlayOut .2s ease forwards; }

/* =============================================================
   MODAL BOX
   ============================================================= */
.nb-modal {
    background: var(--nbf-surface);
    border-radius: 18px;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,.35);
    overflow: hidden;
    animation: nbModalIn .26s cubic-bezier(.34,1.3,.64,1);
}
@keyframes nbModalIn {
    from { opacity: 0; transform: scale(.94) translateY(20px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}

/* Topbar del modal */
.nb-modal__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--nbf-border);
    flex-shrink: 0;
    background: var(--nbf-bg);
}

.nb-modal__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--nbf-border);
    border-radius: 8px;
    padding: 7px 14px;
    font-family: var(--nbf-font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--nbf-muted);
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s;
    white-space: nowrap;
}
.nb-modal__btn:hover {
    background: var(--nbf-accent-light);
    color: var(--nbf-accent-dark);
    border-color: var(--nbf-accent);
}
.nb-modal__btn:disabled {
    opacity: .32;
    cursor: not-allowed;
    pointer-events: none;
}
.nb-modal__btn--back {
    background: #FBBB01;
    color: #000000;
    border-color: #FBBB01;
}
.nb-modal__btn--back:hover {
    background: #e3a800;
    color: #000000;
    border-color: #e3a800;
}

.nb-modal__nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nb-modal__counter {
    font-family: var(--nbf-font-sans);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--nbf-muted);
    min-width: 44px;
    text-align: center;
    background: var(--nbf-border);
    padding: 4px 10px;
    border-radius: 20px;
}

.nb-modal__close {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: none;
    border: 1px solid var(--nbf-border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--nbf-muted);
    flex-shrink: 0;
    transition: background .18s, color .18s;
}
.nb-modal__close:hover { background: #ffebee; color: #c62828; border-color: #ef9a9a; }

/* Body del modal — scrollable */
.nb-modal__body {
    overflow-y: auto;
    flex: 1;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

/* Imagen FULL en modal — máxima calidad */
.nb-modal__img-wrap {
    width: 100%;
    overflow: hidden;
    background: var(--nbf-bg);
    flex-shrink: 0;
    line-height: 0;
}
.nb-modal__img-wrap img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
    /* Sin ningún suavizado artificial */
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
}

/* Contenido del modal */
.nb-modal__content {
    padding: 26px 32px 38px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nb-modal__title {
    font-family: var(--nbf-font-serif);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--nbf-text);
    line-height: 1.32;
    margin: 0;
}

.nb-modal__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--nbf-border);
}
.nb-modal__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--nbf-font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--nbf-muted);
}
.nb-modal__meta-item svg { color: var(--nbf-accent); }

.nb-modal__text {
    font-family: var(--nbf-font-sans);
    font-size: 0.97rem;
    line-height: 1.85;
    color: var(--nbf-text);
}
.nb-modal__text p  { margin: 0 0 1em; }
.nb-modal__text ul,
.nb-modal__text ol { padding-left: 1.5em; margin: 0 0 1em; }
.nb-modal__text li { margin-bottom: .4em; }
.nb-modal__text strong, .nb-modal__text b { font-weight: 700; }
.nb-modal__text em,     .nb-modal__text i { font-style: italic; }

/* =============================================================
   EMPTY
   ============================================================= */
.nb-empty-msg {
    text-align: center;
    color: var(--nbf-muted);
    padding: 48px 20px;
    background: var(--nbf-bg);
    border-radius: var(--nbf-radius);
    border: 1px dashed var(--nbf-border);
    font-family: var(--nbf-font-sans);
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 680px) {
    .nb-grid { grid-template-columns: 1fr; gap: 18px; }
    .nb-card__body { padding: 16px 16px 14px; }
    .nb-card__title { font-size: 1rem; }

    .nb-modal-overlay { align-items: flex-end; padding: 0; }
    .nb-modal {
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
    }
    .nb-modal__topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
    .nb-modal__btn span { display: none; }
    .nb-modal__content { padding: 18px 16px 30px; }
    .nb-modal__title { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .nb-modal, .nb-modal-overlay { animation: none; }
    .nb-card { transition: none; }
}

/* ══════════════════════════════════════════════════════════════
   IMÁGENES DEL CONTENIDO en el modal — front.css
   ══════════════════════════════════════════════════════════════ */

.nb-modal__content-images {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1.5px solid rgba(0,0,0,.07);
}

.nb-ci-modal-grid {
    display: grid;
    gap: 6px;
}

/* Celda base */
.nb-ci-modal-item {
    overflow: hidden;
    background: transparent;
}

/* Imagen rellena exactamente la celda */
.nb-ci-modal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ── 1 foto: ancho completo, imagen completa sin recorte ── */
.nb-ci-modal-single { grid-template-columns: 1fr; }
.nb-ci-modal-single .nb-ci-modal-item {
    width: 100%;
    line-height: 0;
    aspect-ratio: 16 / 9;
}
.nb-ci-modal-single .nb-ci-modal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ── 2 fotos: dos columnas iguales, altura uniforme ─────── */
.nb-ci-modal-double { grid-template-columns: 1fr 1fr; }
.nb-ci-modal-double .nb-ci-modal-item {
    aspect-ratio: 4 / 3;
    background: transparent;
}

/* ── 3 fotos: primera fila sin recorte, segunda 2 col ───── */
.nb-ci-modal-triple { grid-template-columns: 1fr 1fr; }
.nb-ci-modal-triple .nb-ci-modal-item:first-child {
    grid-column: 1 / -1;
    width: 100%;
    line-height: 0;
    aspect-ratio: 16 / 9;
}
.nb-ci-modal-triple .nb-ci-modal-item:first-child .nb-ci-modal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}
.nb-ci-modal-triple .nb-ci-modal-item:not(:first-child) {
    aspect-ratio: 4 / 3;
    background: transparent;
}

/* ── 4 fotos: 2×2 todas con misma proporción ────────────── */
.nb-ci-modal-quad { grid-template-columns: 1fr 1fr; }
.nb-ci-modal-quad .nb-ci-modal-item {
    aspect-ratio: 4 / 3;
    background: transparent;
}

/* Responsive: columna única en móvil */
@media (max-width: 600px) {
    .nb-ci-modal-double,
    .nb-ci-modal-triple,
    .nb-ci-modal-quad { grid-template-columns: 1fr; }
    .nb-ci-modal-triple .nb-ci-modal-item:first-child {
        grid-column: 1;
    }
    .nb-ci-modal-double  .nb-ci-modal-item,
    .nb-ci-modal-triple  .nb-ci-modal-item:not(:first-child),
    .nb-ci-modal-quad    .nb-ci-modal-item { aspect-ratio: 4 / 3; }
}

/* ── Fecha de creación (icono reloj) — visual más tenue ── */
.nb-card__meta-item--created,
.nb-modal__meta-item--created {
    opacity: 0.65;
    font-style: italic;
}
