/* ============================================================
   Blog — landing y post. Requiere design-system.css
   ============================================================ */

/* ---------- Filtros de categoría ---------- */
.cat-bar { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

/* ---------- Post destacado ---------- */
.feat {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-md); margin-bottom: 2rem;
}
.feat-img {
  min-height: 260px; position: relative;
  background: linear-gradient(135deg, #071d4a, var(--blue-light));
  display: flex; align-items: center; justify-content: center; font-size: 3.5rem;
}
.feat-body { padding: 1.75rem; display: flex; flex-direction: column; justify-content: center; }
.feat-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; margin: 0.6rem 0 0.6rem; }
.feat-title a:hover { color: var(--blue-dark); }
.feat-excerpt { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.65; margin-bottom: 1rem; }
.feat-cta {
  align-self: flex-start; background: var(--blue-dark); color: #fff;
  font-size: 0.85rem; font-weight: 700; padding: 0.55rem 1.3rem;
  border-radius: var(--radius-pill); transition: var(--transition);
}
.feat-cta:hover { background: var(--blue-mid); transform: translateY(-1px); }

/* ---------- Etiquetas y meta ---------- */
.cat-tag {
  display: inline-block; font-size: 0.64rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem; border-radius: var(--radius-pill);
  background: var(--blue-pale); color: var(--blue-dark);
}
.cat-tag--uva { background: var(--amber-pale); color: var(--amber-dark); }
.cat-tag--ahorro { background: var(--green-pale); color: var(--green); }
.cat-tag--estrategia { background: #ede9fe; color: #6d28d9; }
.cat-tag--onwhite { background: rgba(255,255,255,0.22); color: #fff; }
.post-meta { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; color: var(--text-muted); flex-wrap: wrap; }
.post-meta .dot-sep { opacity: 0.5; }

/* ---------- Grilla de posts ---------- */
.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.post-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition);
  display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--blue-light); }
.post-img {
  height: 158px; position: relative; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-light));
  display: flex; align-items: center; justify-content: center; font-size: 2.6rem;
}
.post-img .cat-tag { position: absolute; bottom: 0.7rem; left: 0.85rem; }
.post-body { padding: 1.1rem; display: flex; flex-direction: column; flex: 1; }
.post-title { font-size: 1rem; font-weight: 700; line-height: 1.35; margin-bottom: 0.5rem; letter-spacing: -0.01em; }
.post-title a:hover { color: var(--blue-dark); }
.post-excerpt { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.55; margin-bottom: 0.85rem; flex: 1; }
.post-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.post-link { font-size: 0.8rem; font-weight: 700; color: var(--blue-mid); }
.post-link:hover { text-decoration: underline; }

/* Fondos alternativos de cabecera */
.bg-uva { background: linear-gradient(135deg, #78350f, var(--amber)) !important; }
.bg-ahorro { background: linear-gradient(135deg, #065f46, var(--green)) !important; }
.bg-estrategia { background: linear-gradient(135deg, #4c1d95, #7c3aed) !important; }
.bg-dolar { background: linear-gradient(135deg, #134e4a, #0d9488) !important; }

/* ---------- Paginación ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 2rem; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 38px; height: 38px; padding: 0 0.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
  background: var(--card); transition: var(--transition);
}
.pager a:hover { border-color: var(--blue-light); color: var(--blue-dark); }
.pager .current { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.pager .gap { border: none; background: none; }

/* ============================================================
   POST
   ============================================================ */
.post-hero { padding-bottom: 2.5rem; }
.post-hero h1 { font-size: 2.1rem; line-height: 1.2; max-width: 24ch; }
.post-hero .post-meta { color: rgba(255,255,255,0.85); margin-top: 0.9rem; }
.post-hero .post-meta strong { color: #fff; }

/* Barra de progreso de lectura */
.read-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--blue-light), #6ee7a8);
  z-index: 200; transition: width 0.1s linear;
}

.article {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-sm); margin-top: -1.75rem; position: relative; z-index: 2;
}
.article > p, .article li { font-size: 1rem; color: var(--text-secondary); line-height: 1.75; }
.article > p { margin-bottom: 1.15rem; max-width: 68ch; }
.article .lead { font-size: 1.12rem; color: var(--text-primary); font-weight: 500; }
.article h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.015em; margin: 2rem 0 0.8rem; scroll-margin-top: 78px; }
.article h2 span { color: var(--blue-mid); }
.article h3 { font-size: 1.08rem; font-weight: 700; margin: 1.5rem 0 0.55rem; }
.article ul, .article ol { margin: 0 0 1.15rem 1.35rem; }
.article li { margin-bottom: 0.4rem; }
.article a.inline { color: var(--blue-mid); font-weight: 600; }
.article a.inline:hover { text-decoration: underline; }
.article blockquote {
  border-left: 4px solid var(--blue-light); background: var(--surface);
  padding: 1rem 1.25rem; margin: 1.4rem 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 1.02rem; color: var(--text-primary); font-style: italic;
}
.article figure { margin: 1.5rem 0; }
.article figcaption { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; text-align: center; }

/* Índice */
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: 1.75rem; }
.toc-title { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.5rem; }
.toc ol { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.toc a { font-size: 0.85rem; font-weight: 500; color: var(--blue-mid); }
.toc a:hover { text-decoration: underline; }

/* Cajas */
.box { border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin: 1.3rem 0; font-size: 0.92rem; line-height: 1.65; }
.box strong:first-child { display: block; margin-bottom: 0.25rem; }
.box-tip  { background: var(--green-pale); border: 1px solid #a7f3d0; color: #065f46; }
.box-warn { background: var(--amber-pale); border: 1px solid #fde68a; color: #78350f; }
.box-info { background: var(--blue-pale); border: 1px solid #c7dbfc; color: #1e3a8a; }

/* Tabla del artículo */
.mini-wrap { overflow-x: auto; margin: 1.3rem 0; -webkit-overflow-scrolling: touch; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 440px; }
.mini-table th { background: var(--blue-dark); color: #fff; text-align: left; padding: 0.65rem 0.9rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.mini-table td { border-bottom: 1px solid var(--border); padding: 0.65rem 0.9rem; color: var(--text-secondary); }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table td strong { color: var(--text-primary); }
.mini-table .win { background: var(--green-pale); }

/* CTA embebido a herramienta */
.tool-cta {
  background: linear-gradient(135deg, #071d4a 0%, var(--blue-dark) 60%, var(--blue-light) 100%);
  color: #fff; border-radius: var(--radius); padding: 1.5rem 1.75rem; margin: 1.75rem 0;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.tool-cta-text { flex: 1; min-width: 200px; }
.tool-cta-text h3 { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.25rem; }
.tool-cta-text p { font-size: 0.85rem; opacity: 0.9; margin: 0; }
.tool-cta a { background: #fff; color: var(--blue-dark); font-size: 0.875rem; font-weight: 700; padding: 0.6rem 1.4rem; border-radius: var(--radius-pill); white-space: nowrap; transition: var(--transition); }
.tool-cta a:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.25); }

/* Compartir */
.share { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.share-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.share a, .share button {
  font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
  border: 1.5px solid var(--border); background: var(--card);
  border-radius: var(--radius-pill); padding: 0.35rem 0.9rem;
  cursor: pointer; transition: var(--transition);
}
.share a:hover, .share button:hover { border-color: var(--blue-light); color: var(--blue-dark); }

/* Autor */
.author-box {
  display: flex; gap: 1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-top: 1.5rem;
}
.author-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue-dark); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800;
}
.author-name { font-size: 0.92rem; font-weight: 700; }
.author-bio { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; margin-top: 0.15rem; }

/* Actualización / disclaimer */
.article-footer { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--text-muted); }

/* FAQ */
.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 0.7rem; }
.faq-q { padding: 0.9rem 1.15rem; display: flex; justify-content: space-between; align-items: center; cursor: pointer; gap: 1rem; font-size: 0.9rem; font-weight: 600; width: 100%; background: none; border: none; text-align: left; color: inherit; }
.faq-q .chev { width: 22px; height: 22px; border-radius: 50%; background: var(--blue-pale); color: var(--blue-dark); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; flex-shrink: 0; transition: var(--transition); }
.faq-item.open .chev { transform: rotate(45deg); }
.faq-a { display: none; padding: 0.85rem 1.15rem 1rem; font-size: 0.875rem; color: var(--text-secondary); border-top: 1px solid var(--border); }
.faq-item.open .faq-a { display: block; }

/* Siguiente / anterior */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.post-nav a {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.15rem; transition: var(--transition);
}
.post-nav a:hover { border-color: var(--blue-light); box-shadow: var(--shadow-sm); }
.post-nav .dir { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.post-nav .t { font-size: 0.88rem; font-weight: 600; line-height: 1.4; margin-top: 0.25rem; }
.post-nav .next { text-align: right; }

/* Sidebar del blog: post populares */
.side-posts { list-style: none; }
.side-posts li { display: flex; gap: 0.7rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.side-posts li:last-child { border-bottom: none; }
.side-post-num {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue-pale); color: var(--blue-dark);
  font-size: 0.72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.side-post-t { font-size: 0.82rem; font-weight: 600; line-height: 1.4; color: var(--text-secondary); }
.side-post-t:hover { color: var(--blue-dark); }

@media (max-width: 1024px) {
  .post-grid { grid-template-columns: 1fr; }
  .feat { grid-template-columns: 1fr; }
  .feat-img { min-height: 190px; }
}
@media (max-width: 768px) {
  .post-hero h1 { font-size: 1.55rem; }
  .article { padding: 1.5rem 1.25rem; margin-top: -1rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
}

/* ============================================================
   Blog en WordPress (tema pf-v2)
   Estilos para el contenido que produce el editor y para las
   piezas que sólo existen en las plantillas del tema.
   ============================================================ */

/* ---------- Contenido del post (Gutenberg) ---------- */
.post-content { font-size: 1rem; color: var(--text-secondary); line-height: 1.75; }
.post-content p { margin-bottom: 1.1rem; max-width: 70ch; }
.post-content > *:first-child { margin-top: 0; }
.post-content h2 { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; margin: 2rem 0 0.8rem; scroll-margin-top: 78px; }
.post-content h3 { font-size: 1.08rem; font-weight: 700; color: var(--text-primary); margin: 1.5rem 0 0.6rem; }
.post-content h4 { font-size: 0.98rem; font-weight: 700; color: var(--text-primary); margin: 1.25rem 0 0.5rem; }
.post-content ul, .post-content ol { margin: 0 0 1.1rem 1.35rem; }
.post-content li { margin-bottom: 0.4rem; }
.post-content a { color: var(--blue-mid); font-weight: 600; }
.post-content a:hover { text-decoration: underline; }
.post-content strong { color: var(--text-primary); }
.post-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.post-content figure { margin: 1.5rem 0; }
.post-content figcaption { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.4rem; text-align: center; }
.post-content blockquote {
  margin: 1.5rem 0; padding: 0.9rem 1.25rem;
  border-left: 3px solid var(--blue-light); background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-style: italic;
}
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.post-content code {
  background: var(--surface); border-radius: 4px; padding: 0.1rem 0.35rem;
  font-size: 0.9em; color: var(--blue-dark);
}
.post-content iframe, .post-content embed, .post-content object { max-width: 100%; }
/* Los embeds de video traen su propio wrapper con padding-bottom */
.post-content .wp-block-embed__wrapper { position: relative; }

/* Tablas escritas en el editor: que no rompan el ancho en mobile */
.post-content table {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
  margin: 1.25rem 0; display: block; overflow-x: auto; white-space: nowrap;
}
.post-content table th { background: var(--blue-dark); color: #fff; text-align: left; padding: 0.6rem 0.9rem; font-size: 0.75rem; }
.post-content table td { border-bottom: 1px solid var(--border); padding: 0.6rem 0.9rem; }

/* Alineaciones de WordPress */
.post-content .alignleft  { float: left; margin: 0.4rem 1.25rem 1rem 0; }
.post-content .alignright { float: right; margin: 0.4rem 0 1rem 1.25rem; }
.post-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.post-content .wp-caption { max-width: 100%; }

/* Shim mínimo para posts viejos escritos con clases de Bootstrap: el v2 ya no
   lo carga, pero esas notas siguen publicadas. */
.post-content .text-center { text-align: center; }
.post-content .text-muted  { color: var(--text-muted); }
.post-content .btn {
  display: inline-block; background: var(--blue-dark); color: #fff !important;
  padding: 0.55rem 1.15rem; border-radius: var(--radius-pill);
  font-weight: 700; font-size: 0.875rem; text-decoration: none !important;
}
.post-content .btn:hover { background: var(--blue-mid); }
.post-content .row { display: flex; flex-wrap: wrap; gap: 1rem; }
.post-content .row > [class^="col"] { flex: 1 1 240px; }
.post-content .alert { border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin: 1.25rem 0; background: var(--blue-pale); color: #1e3a8a; }
.post-content .img-fluid, .post-content .img-responsive { max-width: 100%; height: auto; }

/* ---------- Imagen destacada ---------- */
.post-hero-img { margin: 0 0 1.5rem; }
.post-hero-img img { width: 100%; height: auto; border-radius: var(--radius); display: block; }

/* Tarjetas con foto real en lugar del emoji de respaldo */
/* Los contenedores de imagen del diseño original estaban pensados para un emoji
   centrado: .post-img con alto fijo y .feat-img estirándose a la altura del texto.
   Con fotos reales eso recortaba fuerte, porque las proporciones no coincidían.
   Ahora cada contenedor adopta la proporción del tamaño que genera WordPress:
     custom-size-300 = 350x200 (7/4)   ·   custom-size-800 = 800x400 (2/1)  */
.post-img--foto, .feat-img--foto { padding: 0; overflow: hidden; position: relative; display: block; }
.post-img--foto img, .feat-img--foto img { width: 100%; height: 100%; object-fit: cover; display: block; }

.post-img--foto { height: auto; aspect-ratio: 7 / 4; }
.feat-img--foto { min-height: 0; aspect-ratio: 2 / 1; }

/* Con foto, el destacado pasa a una columna: una panorámica 2:1 al ancho
   completo no entra en media caja sin perder la mitad de la imagen. */
.feat:has(.feat-img--foto) { grid-template-columns: 1fr; }

/* Respaldo para navegadores sin :has() — la clase la pone el tema */
.feat--foto { grid-template-columns: 1fr !important; }

.feat-img--foto .cat-tag { position: absolute; bottom: 1rem; left: 1rem; }
.post-img--foto .cat-tag { position: absolute; bottom: 0.6rem; left: 0.6rem; }

/* ---------- Etiquetas del post ---------- */
.post-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.5rem 0 0; }

/* ---------- Buscadores ---------- */
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.search-bar input, .side-search input {
  flex: 1; min-width: 0; padding: 0.6rem 0.9rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.9rem; color: var(--text-primary); outline: none;
  transition: var(--transition); background: var(--card);
}
.search-bar input:focus, .side-search input:focus { border-color: var(--blue-mid); box-shadow: 0 0 0 3px rgba(13,102,208,0.12); }
.side-search { display: flex; flex-direction: column; gap: 0.5rem; }

/* ---------- Chips de categorías en el sidebar ---------- */
.side-cats { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.side-cats .chip { font-size: 0.72rem; padding: 0.2rem 0.6rem; }
.side-cats .chip span { opacity: 0.6; font-weight: 500; }

/* ---------- Herramientas en el sidebar ---------- */
.side-tools li { padding-left: 0; }
.side-tools .side-post-t { font-weight: 500; }

/* ---------- Comentarios (wpDiscuz trae sus propios estilos) ---------- */
.comments-block {
  margin-top: 2rem; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.comments-block h2, .comments-block h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }

/* ---------- Barra de categorías: enlaces, no botones ---------- */
.cat-bar .chip { text-decoration: none; }

/* ---------- Accesibilidad ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (max-width: 768px) {
  .post-content table { font-size: 0.82rem; }
  .post-content .alignleft, .post-content .alignright { float: none; margin: 1rem auto; display: block; }
}
