/* ==========================================================================
   Ingenti AI · v3 — Blog
   --------------------------------------------------------------------------
   Índice de artículos y página de artículo. El cuerpo del post llega saneado
   desde tools/build-blog.mjs: sin estilos en línea y sin clases de WordPress,
   así que aquí se le da la tipografía de la casa a etiquetas desnudas
   (h2, p, ul, a…) en vez de perseguir clases del generador.
   ========================================================================== */

/* ---- 1. Índice --------------------------------------------------------- */

.blog { padding-block: 150px var(--sec-y); }

.blog__head { max-width: 62ch; }
.blog__title { margin-top: 16px; letter-spacing: -1.6px; }
.blog__sub { margin-top: 18px; color: var(--text-dim); max-width: 54ch; }

.blog__list {
  margin-top: clamp(48px, 7vh, 80px);
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  list-style: none; padding: 0;
}

.bcard {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden;
  transition: border-color .35s ease, transform .35s ease;
}
.bcard:hover { border-color: var(--line-strong); transform: translateY(-3px); }

.bcard__link {
  display: flex; flex-direction: column; height: 100%;
  color: inherit; text-decoration: none;
}

/* Alto fijo y recorte: las portadas vienen de fuentes externas con relaciones
   de aspecto distintas y sin esto las tarjetas quedan desiguales. */
.bcard__media { display: block; height: 186px; overflow: hidden; background: var(--surface-2); }
.bcard__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.bcard__body {
  display: flex; flex-direction: column; flex: 1;
  padding: 24px 24px 26px; gap: 10px;
}

.bcard__date {
  font-family: var(--font-label);
  font-size: .625rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-mute);
}
.bcard__title {
  font-size: 1.125rem; line-height: 1.3; font-weight: 500;
  letter-spacing: -.4px; color: var(--text);
}
.bcard__desc {
  font-size: .875rem; line-height: 1.6; color: var(--text-dim);
  /* Tres líneas: los resúmenes que manda la automatización varían mucho de
     largo y sin tope las tarjetas se descuadran. */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.bcard__more {
  margin-top: auto; padding-top: 14px;
  font-family: var(--font-label); font-size: .75rem; letter-spacing: .02em;
  color: var(--blue-soft);
}
.bcard__link:hover .bcard__more { color: var(--blue); }

.bcard--empty { padding: 40px 24px; text-align: center; color: var(--text-mute); }

/* ---- 2. Artículo ------------------------------------------------------- */

.post { padding-block: 150px var(--sec-y); }
.post__in { max-width: 820px; }

.post__back {
  display: inline-block; margin-bottom: 34px;
  font-family: var(--font-label); font-size: .8125rem;
  color: var(--text-mute); text-decoration: none;
}
.post__back:hover { color: var(--text-dim); }

.post__title { margin-top: 16px; letter-spacing: -1.4px; }
.post__date {
  margin-top: 18px;
  font-family: var(--font-label);
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-mute);
}

.post__cover {
  margin: clamp(36px, 5vh, 52px) 0 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.post__cover img { width: 100%; height: auto; display: block; }

/* ---- 3. Cuerpo del artículo -------------------------------------------- */

.post__body {
  margin-top: clamp(40px, 6vh, 64px);
  font-size: 1.0625rem; line-height: 1.75; color: var(--text-dim);
}

.post__body h2 {
  margin-top: 52px; margin-bottom: 16px;
  font-weight: 500; font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  letter-spacing: -.8px; color: var(--text);
}
.post__body h3 {
  margin-top: 34px; margin-bottom: 10px;
  font-weight: 500; font-size: 1.0625rem; letter-spacing: -.3px; color: var(--text);
}
.post__body > :first-child { margin-top: 0; }

.post__body p { margin-top: 18px; }
.post__body strong { color: var(--text); font-weight: 500; }
.post__body em { color: var(--text); }

.post__body a { color: var(--blue-soft); text-decoration: none; border-bottom: 1px solid rgba(124, 156, 255, .3); }
.post__body a:hover { color: var(--blue); border-bottom-color: var(--blue); }

.post__body ul, .post__body ol { margin-top: 20px; display: grid; gap: 12px; padding-left: 0; }
.post__body li { padding-left: 22px; position: relative; list-style: none; }
.post__body ul > li::before {
  content: ""; position: absolute; left: 4px; top: 12px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--blue);
}
/* La lista numerada conserva su número: en un artículo el orden significa algo. */
.post__body ol { counter-reset: paso; }
.post__body ol > li { counter-increment: paso; }
.post__body ol > li::before {
  content: counter(paso); position: absolute; left: 0; top: 0;
  font-family: var(--font-label); font-size: .75rem; color: var(--blue);
}

.post__body img { max-width: 100%; height: auto; border-radius: var(--r-md); margin-top: 24px; }

.post__body blockquote {
  margin: 28px 0 0; padding: 18px 24px;
  border-left: 2px solid var(--blue);
  background: var(--surface); border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text);
}

.post__body pre {
  margin-top: 24px; padding: 20px 22px; overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg-2); font-size: .875rem; line-height: 1.6;
}
.post__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
}
.post__body :not(pre) > code {
  padding: 2px 6px; border-radius: 6px;
  background: var(--surface-2); color: var(--text);
}

/* El índice de contenidos que genera la automatización. Se le da aire y un
   fondo para que se lea como bloque aparte y no como una lista más. */
.post__body .post__toc {
  margin-top: 36px; padding: 22px 26px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.post__body .post__toc h2 {
  margin-top: 0; margin-bottom: 14px; font-size: 1rem; letter-spacing: -.2px;
}

.post__body table {
  margin-top: 24px; width: 100%; border-collapse: collapse; font-size: .9375rem;
}
.post__body th, .post__body td {
  padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left;
}
.post__body th { color: var(--text); font-weight: 500; }

/* ---- 4. Pie del artículo ------------------------------------------------ */

.post__foot {
  margin-top: clamp(56px, 8vh, 88px); padding-top: 34px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 14px;
}

/* ---- 5. Pantallas pequeñas ---------------------------------------------- */

@media (max-width: 720px) {
  .blog, .post { padding-block: 120px var(--sec-y); }
  .blog__list { grid-template-columns: 1fr; }
  .post__body { font-size: 1rem; }
  .post__foot .btn { width: 100%; justify-content: center; }
}
