/*
 * blog.css
 * Estilos compartidos del blog (listado + artículos). Reutiliza los mismos
 * tokens que el resto del sitio (src/estilos/tema.js). Patrones de tarjeta y
 * cabecera adaptados de 21st.dev en CSS puro (sin React), igual que el resto
 * del sitio.
 */

:root {
    --bl-cream: var(--ot-background);
    --bl-white: #FFFFFF;
    --bl-ink: var(--ot-on-surface);
    --bl-muted: var(--ot-on-surface-variant);    --bl-faint: var(--ot-outline-text); /* outline, oscurecido para contraste AA (≥ 4,5) en texto pequeño */
    --bl-hair: var(--ot-outline-variant);
    --bl-terra: var(--ot-primary);
    --bl-terra-dk: #7D3A1C;
    --bl-navy: var(--ot-secondary);
    --bl-sand: var(--ot-surface-container);
    --bl-sand-dk: var(--ot-primary-container);
}

.bl-eyebrow {
    font: 700 12px/1 "Archivo", sans-serif;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--bl-terra);
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.bl-eyebrow::before {
    content: "";
    width: 30px;
    height: 1px;
    background: currentColor;
    opacity: 0.55;
}

.bl-display {
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
    letter-spacing: -0.015em;
    line-height: 1.04;
    color: var(--bl-ink);
    font-size: clamp(40px, 6vw, 80px);
}

.bl-display em { font-style: italic; color: var(--bl-terra); }

.bl-h2 {
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.12;
    color: var(--bl-ink);
    font-size: clamp(28px, 3.4vw, 42px);
}

.bl-h3 {
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
    line-height: 1.2;
    color: var(--bl-ink);
    font-size: clamp(22px, 2.4vw, 28px);
}

.bl-hero {
    background:
        radial-gradient(52% 60% at 88% 4%, rgba(201, 122, 74, 0.16), transparent 60%),
        radial-gradient(64% 68% at 30% 30%, rgba(232, 199, 174, 0.26), transparent 74%),
        var(--bl-cream);
}

.bl-card {
    display: flex;
    flex-direction: column;
    background: var(--bl-white);
    border: 1px solid var(--bl-hair);
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

.bl-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(30, 23, 18, 0.08);
    border-color: var(--bl-sand-dk);
}

.bl-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(155deg, var(--ot-surface-container-high) 0%, var(--ot-surface-container) 55%, var(--ot-secondary-container) 100%);
}

.bl-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.bl-card:hover .bl-card__media img { transform: scale(1.04); }

.bl-card__body {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.bl-tag {
    display: inline-flex;
    align-items: center;
    font: 600 11px/1 "Archivo", sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bl-terra);
    background: var(--bl-sand);
    padding: 7px 12px;
    border-radius: 999px;
    width: fit-content;
}

.bl-meta {
    font: 500 13px/1.4 "Archivo", sans-serif;
    color: var(--bl-faint);
}

.bl-link {
    color: var(--bl-ink);
    text-decoration: none;
    background: linear-gradient(var(--bl-terra), var(--bl-terra)) 0 100% / 0% 1px no-repeat;
    transition: background-size 0.3s ease, color 0.3s ease;
    padding-bottom: 2px;
}

.bl-link:hover { color: var(--bl-terra); background-size: 100% 1px; }

/* Texto del artículo. Cada regla excluye lo que va dentro de .not-prose
   (CTAs, bloques de datos) para que esos componentes mantengan sus propios
   estilos: sin esto, `.bl-prose a` pintaba el texto de los .bl-btn del
   mismo terracota que su fondo y los botones salían vacíos. */
.bl-prose {
    font: 400 18px/1.75 "Archivo", sans-serif;
    color: var(--bl-muted);
}

.bl-prose p:not(:where(.not-prose, .not-prose *)) { margin: 0 0 1.25em; }

.bl-prose h2:not(:where(.not-prose, .not-prose *)) {
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
    font-size: clamp(28px, 3vw, 36px);
    line-height: 1.15;
    color: var(--bl-ink);
    margin: 2.4em 0 0.6em;
    padding-top: 1.1em;
    border-top: 1px solid var(--bl-hair);
}

.bl-prose > h2:first-child,
.bl-prose > .bl-facts + h2,
.bl-prose > figure + h2 { margin-top: 0; padding-top: 0; border-top: 0; }

.bl-prose h3:not(:where(.not-prose, .not-prose *)) {
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
    font-size: 24px;
    color: var(--bl-ink);
    margin: 1.8em 0 0.5em;
}

.bl-prose ul:not(:where(.not-prose, .not-prose *)) {
    list-style: none;
    margin: 0 0 1.5em;
    padding: 0;
}

.bl-prose li:not(:where(.not-prose, .not-prose *)) {
    position: relative;
    padding-left: 26px;
    margin-bottom: 0.7em;
}

.bl-prose li:not(:where(.not-prose, .not-prose *))::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.62em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid var(--bl-terra);
}

.bl-prose strong { color: var(--bl-ink); font-weight: 600; }

.bl-prose a:not(:where(.not-prose, .not-prose *)) {
    color: var(--bl-terra);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.bl-prose a:not(:where(.not-prose, .not-prose *)):hover { color: var(--bl-terra-dk); }

/* ---- Bloques de datos del artículo ---- */

/* Datos clave: rejilla de cifras al inicio del artículo */
.bl-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--bl-hair);
    border: 1px solid var(--bl-hair);
    border-radius: 18px;
    overflow: hidden;
    margin: 0 0 2.5em;
}

.bl-facts > div {
    background: var(--bl-white);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bl-facts dt {
    font: 600 11px/1.3 "Archivo", sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bl-faint);
}

.bl-facts dd {
    margin: 0;
    font-family: "Instrument Serif", Georgia, serif;
    font-size: 28px;
    line-height: 1.1;
    color: var(--bl-ink);
}

.bl-facts dd small {
    display: block;
    margin-top: 4px;
    font: 400 13px/1.4 "Archivo", sans-serif;
    color: var(--bl-muted);
}

/* Tabla de datos (precios, comparativas) */
.bl-table-wrap {
    margin: 0 0 1.5em;
    border: 1px solid var(--bl-hair);
    border-radius: 18px;
    overflow-x: auto;
    background: var(--bl-white);
}

.bl-table {
    width: 100%;
    border-collapse: collapse;
    font: 400 16px/1.4 "Archivo", sans-serif;
    color: var(--bl-muted);
    font-variant-numeric: tabular-nums;
}

.bl-table caption {
    caption-side: bottom;
    text-align: left;
    padding: 12px 20px 14px;
    font-size: 13px;
    color: var(--bl-faint);
    border-top: 1px solid var(--bl-hair);
}

.bl-table th,
.bl-table td {
    padding: 14px 20px;
    text-align: right;
    white-space: nowrap;
}

.bl-table th:first-child,
.bl-table td:first-child { text-align: left; }

.bl-table thead th {
    font: 600 11px/1.3 "Archivo", sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bl-faint);
    background: var(--bl-cream);
    border-bottom: 1px solid var(--bl-hair);
}

.bl-table tbody tr + tr td { border-top: 1px solid var(--bl-hair); }

.bl-table tbody td:first-child { color: var(--bl-ink); font-weight: 600; }

.bl-table .is-old { text-decoration: line-through; color: var(--bl-faint); }

/* Tablas de clima: la última columna es texto y hace salto de línea */
.bl-table--clima th:last-child,
.bl-table--clima td:last-child { white-space: normal; text-align: left; min-width: 13em; }

.bl-table .is-new { color: var(--bl-ink); font-weight: 700; }

.bl-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bl-sand);
    color: var(--bl-terra);
    font: 700 12px/1.2 "Archivo", sans-serif;
}

/* Nota / aviso destacado */
.bl-note {
    margin: 0 0 1.5em;
    padding: 18px 22px;
    border-left: 3px solid var(--bl-terra);
    border-radius: 0 14px 14px 0;
    background: var(--bl-sand);
    font: 400 16px/1.65 "Archivo", sans-serif;
    color: var(--bl-ink);
}

.bl-note strong { display: block; margin-bottom: 4px; }

/* Fuente oficial */
.bl-source {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin: 0 0 1.5em;
    font: 400 14px/1.5 "Archivo", sans-serif;
    color: var(--bl-faint);
}

.bl-source a {
    color: var(--bl-terra);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* "Para seguir leyendo": enlaces como tarjetas */
.bl-related {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.bl-related a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 1px solid var(--bl-hair);
    border-radius: 14px;
    background: var(--bl-white);
    color: var(--bl-ink);
    font: 500 16px/1.4 "Archivo", sans-serif;
    text-decoration: none;
    transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.bl-related a::after { content: "→"; color: var(--bl-terra); transition: transform 0.25s ease; }

.bl-related a:hover { border-color: var(--bl-terra); color: var(--bl-terra); }

.bl-related a:hover::after { transform: translateX(4px); }

.bl-cta {
    background: var(--bl-white);
    border: 1px solid var(--bl-hair);
    border-radius: 22px;
    padding: 36px;
}

.bl-cta--navy {
    background: var(--bl-navy);
    border-color: transparent;
    color: #C7BCAE;
}

.bl-cta--navy .bl-h2 { color: #fff; }

.bl-eyebrow--light { color: var(--bl-sand-dk); }

.bl-cta--navy .bl-btn:hover { background: #fff; color: var(--bl-terra-dk); box-shadow: none; }

.bl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 30px;
    border-radius: 999px;
    background: var(--bl-terra);
    color: #fff;
    font: 700 12px/1 "Archivo", sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.bl-btn:hover {
    background: var(--bl-terra-dk);
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(156, 74, 36, 0.25);
}

.bl-btn--ghost {
    background: transparent;
    color: var(--bl-ink);
    border: 1px solid var(--bl-hair);
}

.bl-btn--ghost:hover {
    background: transparent;
    color: var(--bl-terra);
    border-color: var(--bl-terra);
    box-shadow: none;
}

/* Sobre fondo navy el texto tinta del ghost no se leía. */
.bl-cta--navy .bl-btn--ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
}

.bl-cta--navy .bl-btn--ghost:hover {
    background: #fff;
    color: var(--bl-navy);
    border-color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .bl-card, .bl-card__media img, .bl-btn, .bl-link,
    .bl-related a, .bl-related a::after { transition: none !important; }
    .bl-related a:hover::after { transform: none; }
    .bl-card:hover, .bl-btn:hover { transform: none; }
}
