/* ==========================================================================
   ARTÍCULOS DE DIVULGACIÓN — blog público (listado, categorías y artículo)
   Misma identidad que el resto del sitio: fondo oscuro, tarjetas #161616 y acento verde.
   ========================================================================== */

.blog { max-width: 1200px; }
.blog a, .blog-article a { text-decoration: none; }

/* ---------- Buscador ---------- */
.blog-search { display: flex; gap: 12px; margin: 8px 0 24px; max-width: 560px; }
.blog-search input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    background: #161616;
    border: 1px solid #262626;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}
.blog-search input:focus { border-color: #2e7d32; }
.blog-search button {
    padding: 0 18px;
    background: #1b5e20;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
.blog-search button:hover { background: #2e7d32; }
.blog-search button:active { transform: scale(0.96); }

/* ---------- Categorías (chips) ---------- */
.blog-cats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
.blog-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #2a2a2a;
    background: #161616;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 600;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.blog-chip:hover { border-color: #4ade80; color: #fff; transform: translateY(-2px); }
.blog-chip:active { transform: scale(0.96); }
.blog-chip:focus-visible { outline: 2px solid #4ade80; outline-offset: 2px; }
.blog-chip__n { font-size: 11px; font-weight: 700; color: #94a3b8; font-variant-numeric: tabular-nums; }
.blog-chip.is-active { background: #1b5e20; border-color: #4ade80; color: #fff; }
.blog-chip.is-active .blog-chip__n { color: #bbf7d0; }

/* ---------- Encabezado de categoría / resultados ---------- */
.blog-context {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #262626;
}
.blog-context h2 { margin: 0; font-size: 20px; font-weight: 700; color: #fff; }
.blog-context p { margin: 0; font-size: 13px; color: #94a3b8; }
.blog-context a { font-size: 13px; font-weight: 600; color: #4ade80; }
.blog-context a:hover { text-decoration: underline; }

/* ---------- Tarjetas ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; }
.blog-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #161616;
    border: 1px solid #262626;
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}
.blog-card:hover { transform: translateY(-5px); border-color: #2e7d32; }
.blog-card__cover { position: relative; aspect-ratio: 16 / 10; background: #0f0f0f; overflow: hidden; }
.blog-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; }
.blog-card:hover .blog-card__cover img { transform: scale(1.05); }
.blog-card__ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #2e7d32; font-size: 34px; background: #121212; }
.blog-card__n {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #e5e7eb;
    font-size: 11px;
    font-weight: 700;
}
.blog-card__body { display: flex; flex-direction: column; gap: 10px; padding: 20px; flex: 1; }
.blog-card__meta { font-size: 12px; color: #94a3b8; }
.blog-card__title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: #fff; }
/* El título es el enlace de toda la tarjeta; las categorías quedan por encima para poder pulsarse aparte */
.blog-card__title a { color: inherit; }
.blog-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.blog-card__title a:focus-visible { outline: none; }
.blog-card:focus-within { border-color: #4ade80; }
.blog-card__excerpt {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: #a0aec0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card__cats { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.blog-tag {
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.25);
    color: #86efac;
    font-size: 11px;
    font-weight: 700;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.blog-tag:hover { background: #1b5e20; color: #fff; }
.blog-tag:focus-visible { outline: 2px solid #4ade80; outline-offset: 2px; }

.blog-empty {
    grid-column: 1 / -1;
    padding: 48px 24px;
    text-align: center;
    border: 1px dashed #262626;
    border-radius: 14px;
    background: #161616;
    color: #94a3b8;
    font-size: 14px;
}

/* ---------- Paginación ---------- */
.blog-pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 36px; font-size: 13px; color: #94a3b8; }
.blog-pager a, .blog-pager span.is-off {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid #2a2a2a;
    background: #161616;
    font-weight: 600;
}
.blog-pager a { color: #e5e7eb; transition: border-color 0.2s ease, transform 0.15s ease; }
.blog-pager a:hover { border-color: #4ade80; }
.blog-pager a:active { transform: scale(0.97); }
.blog-pager span.is-off { color: #4b5563; }

/* ==========================================================================
   ARTÍCULO
   ========================================================================== */
.blog-article { max-width: 860px; }
.blog-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 13px; font-weight: 600; color: #4ade80; }
.blog-back:hover { text-decoration: underline; }
.blog-article h1 { margin: 12px 0 16px; font-size: clamp(1.9rem, 4.2vw, 2.8rem); font-weight: 700; line-height: 1.15; color: #fff; letter-spacing: -0.01em; }
.blog-article__cats { display: flex; flex-wrap: wrap; gap: 8px; }

.blog-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 28px; font-size: 14px; color: #94a3b8; }
.blog-byline__dot { color: #374151; }
.blog-authors { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.blog-author { color: #e5e7eb; font-weight: 600; }
.blog-author:hover { color: #fff; }
.blog-author--orcid {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 8px;
    border-radius: 999px;
    border: 1px solid #2a2a2a;
    background: #161616;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.blog-author--orcid:hover { border-color: #a6ce39; background: rgba(166, 206, 57, 0.08); }
.blog-author--orcid:focus-visible { outline: 2px solid #a6ce39; outline-offset: 2px; }
.blog-author svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Galería ---------- */
.galeria { margin-bottom: 36px; }
.galeria__stage { position: relative; border-radius: 14px; overflow: hidden; background: #0f0f0f; border: 1px solid #262626; }
.galeria__main { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.galeria__main img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: opacity 0.25s ease; }
.galeria__main img.is-swap { opacity: 0; }
.galeria__counter {
    position: absolute;
    left: 14px;
    bottom: 14px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.galeria__nav {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.galeria__nav:hover { background: rgba(0, 0, 0, 0.85); transform: scale(1.08); }
.galeria__nav:active { transform: scale(0.94); }
.galeria__nav:focus-visible { outline: 2px solid #4ade80; outline-offset: 2px; }
.galeria__nav--prev { left: 14px; }
.galeria__nav--next { right: 14px; }
.galeria__thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
.galeria__thumb {
    flex: 0 0 auto;
    width: 92px;
    height: 62px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: #0f0f0f;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.galeria__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeria__thumb:hover { opacity: 1; }
.galeria__thumb:focus-visible { outline: 2px solid #4ade80; outline-offset: 2px; }
.galeria__thumb.is-active { opacity: 1; border-color: #4ade80; }

/* Pantalla completa */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.94);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox__img { max-width: min(100%, 1400px); max-height: 88vh; border-radius: 8px; object-fit: contain; }
.lightbox__close, .lightbox__nav {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lightbox__close:hover, .lightbox__nav:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.08); }
.lightbox__close:focus-visible, .lightbox__nav:focus-visible { outline: 2px solid #4ade80; outline-offset: 2px; }
.lightbox__close { top: 20px; right: 20px; width: 44px; height: 44px; font-size: 20px; }
.lightbox__nav { top: 50%; width: 52px; height: 52px; margin-top: -26px; font-size: 20px; }
.lightbox__nav--prev { left: 20px; }
.lightbox__nav--next { right: 20px; }
.lightbox__count { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 700; color: #cbd5e1; font-variant-numeric: tabular-nums; }

/* ---------- Texto del artículo ---------- */
.blog-prose { font-size: 1.125rem; line-height: 1.85; color: #d1d5db; overflow-wrap: anywhere; }
.blog-prose p { margin: 0 0 1.4em; }
.blog-prose h2 { margin: 2em 0 0.7em; font-size: 1.6rem; font-weight: 700; line-height: 1.25; color: #fff; }
.blog-prose h3 { margin: 1.8em 0 0.6em; font-size: 1.25rem; font-weight: 700; line-height: 1.3; color: #f3f4f6; }

/* ---------- Relacionados ---------- */
.blog-related { margin-top: 64px; padding-top: 32px; border-top: 1px solid #262626; }
.blog-related h2 { margin: 0 0 8px; font-size: 22px; font-weight: 700; color: #fff; }
.blog-related > p { margin: 0 0 24px; font-size: 13px; color: #94a3b8; }

@media (max-width: 600px) {
    .blog-grid { grid-template-columns: 1fr; }
    .galeria__nav { width: 38px; height: 38px; margin-top: -19px; }
    .galeria__thumb { width: 72px; height: 50px; }
    .blog-prose { font-size: 1.0625rem; }
    .lightbox__nav { width: 44px; height: 44px; margin-top: -22px; }
}
@media (prefers-reduced-motion: reduce) {
    .blog-card, .blog-card__cover img, .blog-chip, .galeria__main img, .galeria__nav, .galeria__thumb, .lightbox, .lightbox__close, .lightbox__nav { transition: none; }
    .blog-card:hover, .blog-chip:hover { transform: none; }
}
