/* ============================================================
   Daun — estilos del blog. Se cargan encima de style.css, que ya
   define la paleta, la tipografía y los botones.
   ============================================================ */

body.blog { display: flex; flex-direction: column; min-height: 100dvh; }
body.blog .topbar,
body.blog .foot { width: min(100% - 2rem, 1100px); margin: 0 auto; }
body.blog .nav-btn { text-decoration: none; }
body.blog .foot { padding: 2rem 0 1.5rem; border-top: 1px solid var(--border); margin-top: 3rem; }
body.blog .foot a { color: var(--text-2); }

/* ---------- índice ---------- */
.blog-index { width: min(100% - 2rem, 1100px); margin: 0 auto; flex: 1; padding: 1.5rem 0 0; }
.blog-index h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.02em; margin: 0 0 .5rem; }
.blog-index .lead { max-width: 62ch; margin-bottom: 2.5rem; }
.cat { margin-bottom: 2.75rem; }
.cat h2 {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin: 0 0 1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border);
}
.entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.entry {
  display: flex; flex-direction: column; text-decoration: none; color: inherit; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.entry:hover { border-color: var(--border-strong); transform: translateY(-2px); text-decoration: none; }
.entry img { width: 100%; height: auto; display: block; background: var(--surface-2); }
.entry-text { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.entry-text h3 { font-size: 1.02rem; line-height: 1.35; margin: 0; }
.entry-text p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.entry-meta { margin-top: auto; padding-top: .5rem; color: var(--muted); font-size: .78rem; }

/* ---------- artículo ---------- */
.post { width: min(100% - 2rem, 760px); margin: 0 auto; flex: 1; padding: 1.5rem 0 0; }
.crumbs { color: var(--muted); font-size: .84rem; margin-bottom: 1rem; display: flex; gap: .5rem; }
.crumbs a { color: var(--muted); }
.post h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .75rem; }
.post-meta { display: flex; gap: .5rem; flex-wrap: wrap; color: var(--muted); font-size: .84rem; margin: 0 0 1.25rem; }
.post-lead { font-size: 1.1rem; line-height: 1.6; color: var(--text-2); margin: 0 0 2rem; }

.post-toc {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-bottom: 2.25rem;
}
.post-toc p { margin: 0 0 .5rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.post-toc ol { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .35rem; }
.post-toc a { color: var(--text-2); font-size: .92rem; }
.post-toc a:hover { color: var(--accent); }

/* El cuerpo del artículo: ancho de lectura cómodo y jerarquía clara. */
.post-body { font-size: 1.04rem; line-height: 1.75; color: var(--text-2); }
.post-body h2 {
  font-size: 1.5rem; line-height: 1.25; color: var(--text); letter-spacing: -.015em;
  margin: 2.75rem 0 .9rem; scroll-margin-top: 1.5rem;
}
.post-body h3 { font-size: 1.15rem; color: var(--text); margin: 2rem 0 .6rem; scroll-margin-top: 1.5rem; }
.post-body p { margin: 0 0 1.15rem; }
.post-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.post-body ul, .post-body ol { margin: 0 0 1.3rem; padding-left: 1.4rem; }
.post-body li { margin-bottom: .5rem; }
.post-body li::marker { color: var(--accent); }
.post-body strong { color: var(--text); font-weight: 600; }
.post-body blockquote {
  margin: 1.5rem 0; padding: .2rem 0 .2rem 1.1rem; border-left: 3px solid var(--accent);
  color: var(--text-2); font-style: normal;
}
.post-body code {
  font-family: var(--mono); font-size: .88em; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 5px; padding: .12em .38em;
}
.post-body pre {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 1rem 1.1rem; overflow-x: auto; margin: 0 0 1.4rem; line-height: 1.55;
}
.post-body pre code { background: none; border: 0; padding: 0; font-size: .87rem; }

/* Las tablas comparan cifras: tienen que poder leerse también en un móvil. */
.post-body table {
  width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: .93rem;
  display: block; overflow-x: auto; white-space: nowrap;
}
.post-body table thead th {
  text-align: left; color: var(--text); font-weight: 600; border-bottom: 2px solid var(--border-strong);
  padding: .6rem .75rem; background: var(--surface);
}
.post-body table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.post-body table tbody tr:hover { background: var(--surface); }

.post-figure { margin: 2rem 0; }
.post-figure img { width: 100%; height: auto; display: block; border-radius: var(--radius); }
.post-figure figcaption { margin-top: .6rem; color: var(--muted); font-size: .84rem; text-align: center; }

/* ---------- pie del artículo ---------- */
.post-related { margin-top: 3.5rem; }
.post-related h2 { font-size: 1.15rem; margin: 0 0 1rem; }
.post-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; }
.post-card {
  display: flex; flex-direction: column; gap: .35rem; padding: .9rem 1rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.post-card:hover { border-color: var(--accent); text-decoration: none; }
.post-card-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.post-card-title { color: var(--text); font-size: .93rem; line-height: 1.35; font-weight: 500; }

.post-cta {
  margin-top: 2.5rem; padding: 1.4rem 1.5rem; display: flex; align-items: center; gap: 1.25rem;
  flex-wrap: wrap; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.post-cta p { margin: 0; color: var(--text-2); }
.post-cta .btn { text-decoration: none; }

/* ---------- bloque del blog en la portada ---------- */
.home-blog { margin: 3.5rem 0 0; }
.home-blog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.home-blog-head h2 { font-size: 1.25rem; margin: 0; }
.home-blog-head a { font-size: .9rem; }
.home-blog .entries { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.home-blog .entry-text { padding: .8rem .9rem 1rem; }
.home-blog .entry-text h3 { font-size: .95rem; }
.home-blog .entry-text p { font-size: .84rem; }
.home-blog-more { display: flex; justify-content: center; margin-top: 1.25rem; }
.home-blog-more .btn { text-decoration: none; }

@media (max-width: 640px) {
  .post-body { font-size: 1rem; }
  .post-cta { flex-direction: column; align-items: flex-start; }
}
