/* ================================================================
   content.css — Salud & Ciencia
   Estilos de la página de artículo/contenido individual
   Requiere: style.css (variables, topbar, footer, trust strip)
             hub.css   (sidebar-card, tool-item, faq-item, cta-card)
================================================================ */

/* ── BREADCRUMB ──────────────────────────────────────────────── */
.breadcrumb { padding: 12px 0; border-bottom: 1px solid var(--border); background: var(--white); }
.breadcrumb-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-muted); flex-wrap: wrap; }
.breadcrumb-inner a { color: var(--text-muted); transition: color .2s; }
.breadcrumb-inner a:hover { color: var(--teal); }
.breadcrumb-inner span { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.breadcrumb-sep { color: var(--text-light); flex-shrink: 0; }

/* ── ARTICLE HERO ────────────────────────────────────────────── */
.article-hero { background: var(--white); padding: 36px 0 24px; border-bottom: 1px solid var(--border); }
.article-hero-inner { max-width: 720px; margin: 0 auto; padding: 0 20px; }

.article-cluster-tag {
  display: inline-block; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 4px 12px; border-radius: 99px;
  color: var(--white); margin-bottom: 14px;
  text-decoration: none; transition: opacity .2s;
}
.article-cluster-tag:hover { opacity: .85; }
.tag-metabolic  { background: var(--red); }
.tag-weight     { background: var(--purple); }
.tag-nutrition  { background: var(--green); }
.tag-body       { background: var(--orange); }
.tag-activity   { background: var(--blue); }
.tag-cholesterol{ background: var(--orange); }

.article-h1 {
  font-size: 2.2rem; font-weight: 800; line-height: 1.2;
  color: var(--text); margin-bottom: 16px;
}
.article-resumen {
  font-size: 1.05rem; color: var(--text-muted);
  line-height: 1.7; margin-bottom: 18px;
  border-left: 3px solid var(--teal);
  padding-left: 16px;
}
.article-meta-bar {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.meta-item {
  display: flex; align-items: center; gap: 5px;
  font-size: .78rem; color: var(--text-muted);
}
.meta-item svg { width: 14px; height: 14px; stroke: var(--text-light); fill: none; flex-shrink: 0; }
.meta-badge {
  background: var(--teal-bg); color: var(--teal);
  padding: 3px 10px; border-radius: 99px; font-weight: 600;
}
.meta-badge svg { stroke: var(--teal); }

@media (max-width: 768px) {
  .article-h1 { font-size: 1.6rem; }
  .article-resumen { font-size: .95rem; }
}
@media (max-width: 480px) {
  .article-h1 { font-size: 1.4rem; }
  .article-meta-bar { gap: 10px; }
}

/* ── IMAGEN DESTACADA ────────────────────────────────────────── */
.article-featured-img-wrap { padding: 0 0 0; background: var(--white); }
.article-featured-img {
  max-width: 800px; margin: 0 auto 0;
  padding: 0 20px;
}
.article-featured-img img {
  width: 100%; border-radius: var(--radius);
  object-fit: cover; height: auto; max-height: 420px;
  display: block;
}
.article-featured-img figcaption {
  font-size: .75rem; color: var(--text-muted);
  text-align: center; margin-top: 6px;
}

/* ── CONTENT BODY LAYOUT ─────────────────────────────────────── */
.content-body { padding: 40px 0 56px; }
.content-body-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: grid; grid-template-columns: 1fr 300px;
  gap: 48px; align-items: start;
}
@media (max-width: 1024px) { .content-body-inner { grid-template-columns: 1fr 260px; gap: 32px; } }
@media (max-width: 768px)  { .content-body-inner { grid-template-columns: 1fr; } }

/* ── TABLE OF CONTENTS ───────────────────────────────────────── */
.toc {
  background: var(--bg-light); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 32px;
}
.toc-header {
  display: flex; align-items: center; gap: 8px;
  font-size: .88rem; font-weight: 700; color: var(--text);
  margin-bottom: 12px;
}
.toc-header svg { width: 16px; height: 16px; stroke: var(--teal); fill: none; }
.toc-list { display: flex; flex-direction: column; gap: 6px; padding-left: 4px; }
.toc-list li { list-style: none; }
.toc-list a {
  font-size: .83rem; color: var(--text-muted);
  text-decoration: none; line-height: 1.4;
  display: block; padding: 2px 0;
  border-left: 2px solid transparent;
  padding-left: 10px; transition: color .2s, border-color .2s;
}
.toc-list a:hover, .toc-list a.active {
  color: var(--teal); border-left-color: var(--teal);
}
.toc-list li.toc-sub a { padding-left: 22px; font-size: .8rem; }

/* ── ARTICLE CONTENT (tipografía) ───────────────────────────── */
.article-content {
  font-size: 1rem; line-height: 1.8;
  color: var(--text); max-width: 720px;
}

/* Headings dentro del artículo */
.article-content h2 {
  font-size: 1.45rem; font-weight: 800;
  color: var(--text); margin: 40px 0 14px;
  padding-top: 8px; border-top: 1px solid var(--border);
  line-height: 1.3;
}
.article-content h3 {
  font-size: 1.15rem; font-weight: 700;
  color: var(--text); margin: 28px 0 10px;
  line-height: 1.35;
}
.article-content h4 {
  font-size: 1rem; font-weight: 700;
  color: var(--text); margin: 20px 0 8px;
}
.article-content p { margin-bottom: 18px; }
.article-content p:last-child { margin-bottom: 0; }

/* Listas */
.article-content ul, .article-content ol {
  margin: 0 0 18px 20px; display: flex; flex-direction: column; gap: 6px;
}
.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }
.article-content li { line-height: 1.7; }

/* Links */
.article-content a {
  color: var(--teal); text-decoration: underline;
  text-decoration-color: transparent; transition: text-decoration-color .2s;
}
.article-content a:hover { text-decoration-color: var(--teal); }

/* Tablas */
.article-content table {
  width: 100%; border-collapse: collapse;
  margin: 24px 0; font-size: .9rem;
  border-radius: var(--radius); overflow: hidden;
}
.article-content th {
  background: var(--teal); color: white;
  padding: 10px 14px; text-align: left;
  font-weight: 600; font-size: .85rem;
}
.article-content td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  vertical-align: top; line-height: 1.5;
}
.article-content tr:last-child td { border-bottom: none; }
.article-content tr:nth-child(even) td { background: var(--bg-light); }
/* Tablas responsive */
.article-content .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 24px 0; }
.article-content .table-wrap table { margin: 0; }

/* Blockquote / dato destacado */
.article-content blockquote {
  border-left: 4px solid var(--teal);
  margin: 24px 0; padding: 14px 20px;
  background: var(--teal-bg); border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .95rem; color: var(--text); font-style: normal;
}
.article-content blockquote p { margin: 0; }
.article-content blockquote strong { color: var(--teal-dark); }

/* Callout / aviso especial */
.article-content .callout {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--blue-bg); border: 1px solid #bfdbfe;
  border-radius: var(--radius); padding: 14px 16px; margin: 24px 0;
}
.article-content .callout-icon {
  width: 22px; height: 22px; flex-shrink: 0;
  stroke: var(--blue); fill: none; margin-top: 1px;
}
.article-content .callout p { margin: 0; font-size: .9rem; }

/* Imágenes dentro del artículo */
.article-content img {
  max-width: 100%; border-radius: var(--radius);
  margin: 20px 0; height: auto;
}
.article-content figure { margin: 20px 0; }
.article-content figcaption {
  font-size: .78rem; color: var(--text-muted);
  text-align: center; margin-top: 6px;
}

/* Código */
.article-content code {
  background: var(--bg-light); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px;
  font-size: .88em; font-family: monospace;
}

/* Separador */
.article-content hr {
  border: none; border-top: 1px solid var(--border);
  margin: 36px 0;
}

/* ── AVISO MÉDICO ────────────────────────────────────────────── */
.medical-disclaimer {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: var(--radius); padding: 14px 16px;
  margin-top: 36px; font-size: .82rem; color: #92400e;
  line-height: 1.55;
}
.medical-disclaimer svg {
  width: 20px; height: 20px; flex-shrink: 0;
  stroke: #d97706; fill: none; margin-top: 1px;
}
.medical-disclaimer p { margin: 0; }

/* ── PAGINACIÓN PREV/NEXT ────────────────────────────────────── */
.article-pagination { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border); }
.pagination-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pagination-btn {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius); text-decoration: none;
  color: var(--text); transition: all .2s;
}
.pagination-btn:hover { border-color: var(--teal); background: var(--teal-bg); }
.pagination-btn.next { text-align: right; align-items: flex-end; }
.pagination-dir {
  display: flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 600; color: var(--teal);
  text-transform: uppercase; letter-spacing: .5px;
}
.pagination-dir svg { width: 14px; height: 14px; stroke: var(--teal); fill: none; }
.pagination-title {
  font-size: .85rem; font-weight: 600; color: var(--text);
  line-height: 1.4; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 480px) {
  .pagination-inner { grid-template-columns: 1fr; }
  .pagination-btn.next { text-align: left; align-items: flex-start; }
}

/* ── SIDEBAR (content page) ──────────────────────────────────── */
.content-sidebar { display: flex; flex-direction: column; gap: 20px; }

/* sidebar-card, tool-item, faq-item, cta-card: reglas base
   (antes se asumían heredadas de hub.css, pero content.php no
   carga ese archivo — sin esto, los íconos SVG de herramientas
   se renderizaban a tamaño nativo, gigantes) */
.sidebar-card { background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sidebar-card-header { padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
.sidebar-card-header h3 { font-size: .92rem; font-weight: 700; color: var(--text); }

.tool-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); transition: background .15s; text-decoration: none; color: inherit; }
.tool-item:last-of-type { border-bottom: none; }
.tool-item:hover { background: var(--bg-light); }
.tool-item-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tool-item-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }
.tool-item-body { flex: 1; min-width: 0; }
.tool-item-body strong { display: block; font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-item-body span { font-size: .74rem; color: var(--text-muted); }
.tool-item-arrow { font-size: .9rem; color: var(--text-light); flex-shrink: 0; }

.faq-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .82rem; color: var(--text); transition: background .15s; text-decoration: none; min-height: 46px; }
.faq-item:last-of-type { border-bottom: none; }
.faq-item:hover { background: var(--bg-light); color: var(--teal); }
.faq-item span { flex: 1; line-height: 1.4; }
.faq-item-arrow { font-size: .8rem; color: var(--text-light); flex-shrink: 0; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }

.cta-card { background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 20px; }
.cta-card-icon { width: 44px; height: 44px; background: var(--teal-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.cta-card-icon svg { width: 22px; height: 22px; stroke: var(--teal); fill: none; }
.cta-card h3 { font-size: .92rem; font-weight: 700; color: var(--text); margin-bottom: 6px; line-height: 1.3; }
.cta-card p { font-size: .8rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 16px; }

.view-all { font-size: .8rem; font-weight: 600; color: var(--teal); text-decoration: none; }
.view-all:hover { text-decoration: underline; }

.back-to-hub {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .84rem;
  font-weight: 500; color: var(--text-muted);
  text-decoration: none; transition: all .2s;
}
.back-to-hub:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-bg); }
.back-to-hub svg { width: 16px; height: 16px; stroke: currentColor; fill: none; flex-shrink: 0; }

/* Sticky sidebar en desktop */
@media (min-width: 769px) {
  .content-sidebar { position: sticky; top: 110px; }
}

/* ── ARTÍCULOS RELACIONADOS ──────────────────────────────────── */
.related-section { padding: 48px 0; background: var(--bg-light); border-top: 1px solid var(--border); }
.related-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 24px; max-width: 1200px; margin-left: auto; margin-right: auto; padding: 0 20px; }
.related-header h2 { font-size: 1.2rem; font-weight: 700; }
.related-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 22px; max-width: 1200px;
  margin: 0 auto; padding: 0 20px;
}

/* article-card: reglas base (antes se asumían heredadas de hub.css,
   pero content.php no carga ese archivo — sin esto, los SVG de
   .article-meta se renderizaban a tamaño nativo, gigantes) */
.article-card a { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.article-thumb-placeholder {
  width: 100%; height: 100%; background: var(--border);
}
.article-tag {
  position: absolute; top: 8px; left: 8px;
  font-size: .67rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; padding: 3px 8px;
  border-radius: 4px; color: var(--white);
}
.article-body { padding: 12px 0 0; display: flex; flex-direction: column; flex: 1; gap: 6px; }
.article-body h3 { font-size: .9rem; font-weight: 700; line-height: 1.4; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-body p { font-size: .78rem; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.article-meta { display: flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--text-light); margin-top: auto; padding-top: 8px; }
.article-meta svg { width: 13px; height: 13px; stroke: var(--text-light); fill: none; flex-shrink: 0; }

@media (max-width: 768px) { .related-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .related-grid { grid-template-columns: 1fr; } }

/* ── ESTILOS PARA TIPOS ESPECIALES ───────────────────────────── */

/* FAQ — destacar la respuesta corta al inicio */
.faq-answer-highlight {
  background: var(--teal-bg); border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px; margin-bottom: 28px; font-size: 1rem; line-height: 1.7;
}
.faq-answer-highlight strong { color: var(--teal-dark); }

/* Análisis — tabla de referencia de valores */
.values-table-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin: 28px 0;
}
.values-table-card-header {
  background: var(--teal); color: white;
  padding: 12px 16px; font-size: .88rem; font-weight: 700;
}
.values-table-card table { width: 100%; border-collapse: collapse; }
.values-table-card th {
  background: var(--teal-bg); padding: 10px 14px;
  font-size: .8rem; font-weight: 700; color: var(--teal-dark);
  text-align: left; border-bottom: 1px solid var(--border);
}
.values-table-card td {
  padding: 10px 14px; font-size: .85rem;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.values-table-card tr:last-child td { border-bottom: none; }

/* Badges de estado (normal, límite, alto, bajo) */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: .75rem; font-weight: 700;
}
.status-normal  { background: #dcfce7; color: #15803d; }
.status-limit   { background: #fef9c3; color: #a16207; }
.status-high    { background: #fee2e2; color: #b91c1c; }
.status-low     { background: #dbeafe; color: #1d4ed8; }

/* ── RESPONSIVE MOBILE ───────────────────────────────────────── */
@media (max-width: 768px) {
  .article-hero { padding: 24px 0 18px; }
  .article-content { font-size: .95rem; }
  .article-content h2 { font-size: 1.25rem; margin: 28px 0 10px; }
  .article-content h3 { font-size: 1.05rem; }
  .toc { margin-bottom: 24px; }
  .content-body { padding: 28px 0 40px; }
  /* Sidebar aparece ANTES del artículo en móvil en algunos casos;
     aquí lo dejamos después (orden natural del DOM) */
}
@media (max-width: 480px) {
  .article-content { font-size: .92rem; line-height: 1.75; }
  .article-content table { font-size: .8rem; }
  .medical-disclaimer { flex-direction: column; gap: 8px; }
}

/* ── BOTÓN DE FAVORITO ───────────────────────────────────────── */
.favorito-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 99px;
  border: 1.5px solid var(--border); background: var(--white);
  font-family: inherit; font-size: .78rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  transition: all .2s; margin-left: auto;
}
.favorito-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; flex-shrink: 0; transition: fill .2s; }
.favorito-btn:hover { border-color: #f43f5e; color: #f43f5e; }
.favorito-btn.is-favorito {
  border-color: #f43f5e; background: #fff1f2; color: #f43f5e;
}
.favorito-btn.is-favorito svg { fill: #f43f5e; }

@media (max-width: 480px) {
  .favorito-btn { margin-left: 0; width: 100%; justify-content: center; margin-top: 8px; }
}
