/* =====================================================================
   Blog (listado y artículo, blog.php) — diseño 2026
   Prefijo bl-. Tokens y .b-* en brand.css. El cuerpo del artículo es HTML de la BD (.bl-prose).
   ===================================================================== */

.bl { padding: 36px 0 90px; }
.bl-wrap { width: var(--b-max); margin: 0 auto; }

/* Categorías: color propio para la portada de cada tarjeta (los artículos no llevan imagen destacada) */
.bl-cat { --cat: var(--b-blue-soft); --cat-ink: var(--b-blue-ink); }
.bl-cat[data-cat="guias"] { --cat: #e6f8fe; --cat-ink: #06739c; }
.bl-cat[data-cat="eventos"] { --cat: #fff0fa; --cat-ink: #b0087f; }
.bl-cat[data-cat="temas"] { --cat: #f1ecff; --cat-ink: #5b3cc4; }
.bl-cat[data-cat="consejos"] { --cat: #e8f7ee; --cat-ink: #11723a; }
.bl-cat[data-cat="general"] { --cat: #fff6e0; --cat-ink: #8a5a00; }
.bl-cat[data-cat="novedades"] { --cat: #eef3f8; --cat-ink: #1a1a2e; }
.bl-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--cat); color: var(--cat-ink); font-size: 15px; font-weight: 800; }

/* Tarjeta de artículo (listado y relacionados) */
.bl-card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--b-radius-lg); background: var(--b-surface); box-shadow: var(--b-shadow); color: var(--b-text); text-decoration: none; transition: box-shadow .2s ease, transform .2s ease; }
.bl-card:hover { box-shadow: var(--b-shadow-hover); transform: translateY(-2px); }
.bl-card:focus-visible { outline: 4px solid var(--b-focus); outline-offset: 3px; }
.bl-cover { position: relative; height: 120px; flex-shrink: 0; background: var(--cat); overflow: hidden; }
.bl-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bl-cover-ico { position: absolute; left: 24px; bottom: 18px; z-index: 1; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--b-surface); font-size: 32px; box-shadow: var(--b-shadow); }
.bl-cover::after { content: ''; position: absolute; right: -30px; top: -30px; width: 170px; height: 170px; border-radius: 50%; border: 18px solid var(--cat-ink); opacity: .08; }
.bl-cover::before { content: ''; position: absolute; right: 80px; bottom: -36px; width: 90px; height: 90px; border-radius: 50%; background: var(--cat-ink); opacity: .07; }
.bl-cover:has(img)::before, .bl-cover:has(img)::after { display: none; }
.bl-card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 24px 22px; }
.bl-card h2, .bl-card h3 { margin-top: 12px !important; font-size: var(--b-fs-h3, 22px); font-weight: 800; line-height: 1.25; }
.bl-card p { margin-top: 8px !important; color: var(--b-muted); font-size: 17px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bl-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; color: var(--b-muted); font-size: 15px; font-weight: 700; }
.bl-card-meta b { color: var(--b-pink-ink); font-weight: 800; white-space: nowrap; }

/* Llamada a jugar (listado y final del artículo) */
.bl-cta { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; margin-top: 56px; padding: 30px 34px; border-radius: var(--b-radius-lg); background: linear-gradient(135deg, var(--b-blue-soft) 0%, var(--b-pink-soft) 100%); }
.bl-cta-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--b-surface); font-size: 32px; box-shadow: var(--b-shadow); }
.bl-cta h2 { font-size: var(--b-fs-h2, clamp(24px, 2.2vw, 30px)); font-weight: 800; line-height: 1.15; }
.bl-cta p { margin-top: 6px !important; color: var(--b-muted); font-size: 18px; line-height: 1.5; }
.bl-cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Sin artículos / artículo no encontrado */
.bl-empty { max-width: 620px; margin: 30px auto 0; padding: 40px 30px; text-align: center; }
.bl-empty-ico { width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--b-blue-soft); font-size: 40px; }
.bl-empty h1, .bl-empty h2 { font-size: var(--b-fs-h2, 26px); font-weight: 800; }
.bl-empty p { margin-top: 8px !important; color: var(--b-muted); font-size: 18px; }
.bl-empty .b-btn { margin-top: 20px; }

/* ---------- Listado ---------- */
.bl-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; }
.bl-top h1 { font-size: var(--b-fs-h1, clamp(36px, 3.6vw, 54px)); font-weight: 800; line-height: 1.05; }
.bl-top p { margin-top: 10px !important; color: var(--b-muted); font-size: var(--b-fs-lead, 20px); max-width: 34em; }
.bl-count { color: var(--b-muted); font-size: 17px; font-weight: 700; white-space: nowrap; }

.bl-filter { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.bl-filter a { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 16px; border: 3px solid var(--b-line); border-radius: 999px; background: var(--b-surface); color: var(--b-text); font-size: 17px; font-weight: 700; text-decoration: none; }
.bl-filter a:hover { border-color: var(--b-line-strong); }
.bl-filter a[aria-current="page"] { border-color: var(--b-blue); background: var(--b-blue-soft); }
.bl-filter a:focus-visible { outline: 4px solid var(--b-focus); outline-offset: 3px; }
.bl-filter small { color: var(--b-muted); font-size: 14px; font-weight: 800; }

.bl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 30px; }
/* El más reciente, destacado (solo en la página 1 y sin filtro) */
.bl-card--lead { grid-column: span 2; flex-direction: row; }
.bl-card--lead .bl-cover { width: 42%; height: auto; min-height: 260px; }
.bl-card--lead .bl-cover-ico { left: 50%; top: 50%; bottom: auto; width: 110px; height: 110px; font-size: 56px; transform: translate(-50%, -50%); }
.bl-card--lead .bl-card-body { padding: 28px 30px; }
.bl-card--lead h2 { font-size: var(--b-fs-h2, clamp(26px, 2.2vw, 32px)); }
.bl-card--lead p { font-size: 18px; -webkit-line-clamp: 4; }
.bl-new { margin-left: 8px; padding: 4px 10px; border-radius: 999px; background: var(--b-pink-ink); color: var(--b-on-accent); font-size: 14px; font-weight: 800; }

.bl-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 40px; }
.bl-pages a, .bl-pages span { min-width: 52px; height: 52px; padding: 0 16px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--b-surface); box-shadow: var(--b-shadow); color: var(--b-text); font-size: 18px; font-weight: 800; text-decoration: none; }
.bl-pages a:hover { box-shadow: var(--b-shadow-hover); }
.bl-pages span[aria-current] { background: var(--b-text); color: var(--b-on-accent); }

/* ---------- Artículo (mismo ancho que la cabecera) ---------- */
.bl-art { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 56px; align-items: start; }
.bl-art--no-toc { grid-template-columns: minmax(0, 1fr); }
.bl-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 16px 4px 12px; border-radius: 999px; background: var(--b-surface); box-shadow: var(--b-shadow); color: var(--b-text); font-size: 17px; font-weight: 700; text-decoration: none; }
.bl-back:hover { box-shadow: var(--b-shadow-hover); }
.bl-art-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 26px; color: var(--b-muted); font-size: 17px; font-weight: 700; }
.bl-art h1 { margin-top: 14px !important; font-size: var(--b-fs-h1, clamp(32px, 3.2vw, 50px)); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }
.bl-art-img { display: block; width: 100%; margin-top: 26px; border-radius: var(--b-radius-lg); aspect-ratio: 16 / 9; object-fit: cover; }

/* Cuerpo: tipografía de lectura para el HTML de la BD */
.bl-prose { margin-top: 30px; color: #2a3140; font-size: var(--b-fs-body, 19px); line-height: 1.75; overflow-wrap: break-word; }
.bl-prose > * + * { margin-top: 18px !important; }
.bl-prose h2 { margin-top: 48px !important; color: var(--b-text); font-size: var(--b-fs-h2, clamp(26px, 2.3vw, 32px)); font-weight: 800; line-height: 1.2; scroll-margin-top: calc(var(--site-header-h, 80px) + 20px); }
.bl-prose h3 { margin-top: 32px !important; color: var(--b-text); font-size: var(--b-fs-h3, 23px); font-weight: 800; line-height: 1.3; }
.bl-prose h2 + *, .bl-prose h3 + * { margin-top: 10px !important; }
.bl-prose strong { color: var(--b-text); font-weight: 800; }
.bl-prose a { color: var(--b-pink-ink); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.bl-prose a:hover { text-decoration-color: var(--b-pink); }
.bl-prose ul, .bl-prose ol { padding-left: 0 !important; list-style: none; display: grid; gap: 10px; }
.bl-prose ul > li { position: relative; padding-left: 30px; }
.bl-prose ul > li::before { content: ''; position: absolute; left: 6px; top: .62em; width: 10px; height: 10px; border-radius: 50%; background: var(--b-pink); }
.bl-prose ol { counter-reset: blol; }
.bl-prose ol > li { position: relative; padding-left: 46px; counter-increment: blol; }
.bl-prose ol > li::before { content: counter(blol); position: absolute; left: 0; top: .1em; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--b-blue-soft); color: var(--b-blue-ink); font-size: 16px; font-weight: 800; line-height: 1; }
.bl-prose li ul, .bl-prose li ol { margin-top: 10px !important; }
.bl-prose li ul > li::before { background: transparent; border: 2px solid var(--b-pink); }
.bl-prose blockquote { padding: 18px 22px 18px 24px; border-left: 6px solid var(--b-blue); border-radius: 0 18px 18px 0; background: var(--b-blue-soft); color: var(--b-text); font-size: 19px; font-weight: 600; }
.bl-prose img { max-width: 100%; height: auto; border-radius: 18px; }
.bl-table { overflow-x: auto; border-radius: 18px; box-shadow: var(--b-shadow); background: var(--b-surface); }
.bl-prose table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 17px; line-height: 1.45; }
.bl-prose th { padding: 14px 16px; background: var(--b-text); color: var(--b-on-accent); text-align: left; font-weight: 800; }
.bl-prose td { padding: 12px 16px; border-top: 1px solid var(--b-line); vertical-align: top; }
.bl-prose tbody tr:nth-child(even) td { background: var(--b-surface-2); }

/* Bloque de temas (tras el primer párrafo) */
.bl-themes { margin: 30px 0 !important; padding: 22px 22px 24px; border-radius: var(--b-radius-lg); background: var(--b-surface); box-shadow: var(--b-shadow); line-height: 1.3; }
.bl-themes-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.bl-themes-top strong { font-size: 20px; font-weight: 800; }
.bl-prose .bl-themes a { font-weight: 700; text-decoration: none; }
.bl-prose .bl-themes .b-btn { min-height: 44px; padding: 4px 16px; color: var(--b-text); font-size: 16px; }
.bl-themes-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.bl-prose .bl-themes-grid a { display: grid; gap: 6px; color: var(--b-text); font-size: 14px; text-align: center; }
.bl-themes-grid img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 3px solid transparent; }
.bl-themes-grid a:hover img { border-color: var(--b-blue); }

/* Lateral: índice + atajo (fijo al bajar) */
.bl-side { position: sticky; top: calc(var(--site-header-h, 80px) + 24px); display: grid; gap: 16px; margin-top: 70px; }
.bl-toc { padding: 18px 16px; }
.bl-toc strong { display: block; padding: 0 8px 8px; font-size: 19px; font-weight: 800; }
.bl-toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; max-height: calc(100vh - var(--site-header-h, 80px) - 300px); overflow-y: auto; }
.bl-toc a { display: block; padding: 8px 10px; border-left: 4px solid transparent; border-radius: 0 12px 12px 0; color: var(--b-muted); font-size: 16px; font-weight: 700; line-height: 1.3; text-decoration: none; }
.bl-toc a:hover { background: var(--b-surface-2); color: var(--b-text); }
.bl-toc a.is-on { border-left-color: var(--b-pink); background: var(--b-pink-soft); color: var(--b-text); }
.bl-side-cta { padding: 22px; text-align: center; background: var(--b-text); color: var(--b-on-accent); }
.bl-side-cta strong { display: block; font-size: 21px; font-weight: 800; line-height: 1.2; }
.bl-side-cta p { margin-top: 6px !important; opacity: .85; font-size: 16px; line-height: 1.4; }
.bl-side-cta .b-btn { width: 100%; margin-top: 14px; }

/* Índice plegable para tablet/móvil */
.bl-mtoc { display: none; }

/* Relacionados */
.bl-related { margin-top: 64px; }
.bl-related > h2 { font-size: var(--b-fs-h2, clamp(26px, 2.4vw, 34px)); font-weight: 800; }
.bl-related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.bl-related .bl-cover { height: 90px; }
.bl-related .bl-cover-ico { width: 52px; height: 52px; font-size: 26px; bottom: 14px; }

@media (prefers-reduced-motion: reduce) {
    .bl-card { transition: none; }
    .bl-card:hover { transform: none; }
}

@media (max-width: 1100px) {
    .bl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bl-art { grid-template-columns: minmax(0, 1fr); }
    .bl-side { display: none; }
    .bl-mtoc { display: block; margin-top: 22px; padding: 0; overflow: hidden; }
    .bl-mtoc summary { padding: 16px 20px; cursor: pointer; font-size: 18px; font-weight: 800; }
    .bl-mtoc .bl-toc { padding: 0 12px 14px; box-shadow: none; }
    .bl-mtoc .bl-toc ol { max-height: none; }
    .bl-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .bl-cta { grid-template-columns: 1fr; }
    .bl-cta-ico { display: none; }
}
@media (max-width: 760px) {
    .bl-top { grid-template-columns: 1fr; }
    .bl-grid { grid-template-columns: 1fr; }
    .bl-card--lead { grid-column: auto; flex-direction: column; }
    .bl-card--lead .bl-cover { width: auto; min-height: 150px; }
    .bl-card--lead .bl-cover-ico { width: 80px; height: 80px; font-size: 40px; }
    .bl-filter { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 0 16px 6px; scrollbar-width: none; }
    .bl-filter a { flex-shrink: 0; }
}
@media (max-width: 640px) {
    .bl { padding-top: 20px; }
    .bl-card-body { padding: 18px 18px 20px; }
    .bl-cta { padding: 24px 20px; }
    .bl-cta-actions .b-btn { width: 100%; }
    .bl-prose { font-size: var(--b-fs-body, 18px); }
    .bl-prose h2 { margin-top: 38px !important; }
    .bl-themes-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .bl-related-grid { grid-template-columns: 1fr; }
}
