/* ==========================================================================
   WEBMEDICA99 - CSS MAESTRO INMUNE PARA ARTÍCULOS (.wm-prose)
   Arquitectura de Tipografía y Componentes Canónicos AWD
   Regla: Quien sube un artículo NO define clases inline. El CSS formatea todo.
   ========================================================================== */

/* 1. CONTENEDOR GENERAL DE LECTURA (Formato Editorial Proporcional) */
.wm-article-container {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  padding-top: 7.5rem;
  padding-bottom: 5rem;
}

@media (min-width: 768px) {
  .wm-article-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* 2. BREADCRUMBS CLÍNICOS */
.wm-breadcrumbs {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 1.5rem;
}

.wm-breadcrumbs a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.15s ease;
}

.wm-breadcrumbs a:hover {
  color: #00f2fe;
}

.wm-breadcrumbs .sep {
  color: rgba(255, 255, 255, 0.2);
}

.wm-breadcrumbs .current {
  color: #00f2fe;
}

/* 3. METADATOS DE CABECERA (BADGES) */
.wm-article-meta {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  font-family: 'Geist Mono', 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.wm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.wm-badge-cyan {
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: #00f2fe;
}

.wm-badge-orange {
  background: rgba(255, 107, 53, 0.08);
  border: 1px solid rgba(255, 107, 53, 0.3);
  color: #ff8c5a;
}

.wm-badge-slate {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

/* 4. MOTOR TIPOGRÁFICO INMUNE (.wm-prose) */
.wm-prose {
  color: #94a3b8;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.75;
}

/* Columna de Lectura Canónica para Texto Puro (760px para cero fatiga visual) */
.wm-prose > * {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* BLEED-OUT VISUAL (Catafixia Editorial): */
/* Tablas: Se expanden a 1000px para que las 4 columnas respiren completas */
.wm-prose > .wm-table-wrapper {
  max-width: 1000px !important;
  width: 100% !important;
}

/* Callouts de Conversión: Se expanden a 860px para destacar con elegancia */
.wm-prose > .wm-callout-tip,
.wm-prose > .wm-callout-example {
  max-width: 860px !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Footer Editorial Interno: Mantiene 760px */
.wm-prose > .wm-article-footer-nav {
  max-width: 760px !important;
}

/* Títulos H1 (Comando / Portada) */
.wm-prose h1, .wm-article-title {
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  letter-spacing: -0.035em !important;
  line-height: 1.22 !important;
  font-size: clamp(1.85rem, 4vw, 2.65rem) !important;
  margin-top: 0 !important;
  margin-bottom: 1.5rem !important;
}

/* Títulos H2 (Secciones principales) */
.wm-prose h2 {
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 400 !important;
  color: #f1f5f9 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.3 !important;
  font-size: clamp(1.35rem, 2.8vw, 1.8rem) !important;
  margin-top: 3.25rem !important;
  margin-bottom: 1.15rem !important;
  padding-bottom: 0.5rem !important;
  border-bottom: 1px solid rgba(0, 242, 254, 0.18) !important;
  display: block !important;
}

/* Títulos H3 (Subsecciones) */
.wm-prose h3 {
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 400 !important;
  color: #00f2fe !important;
  letter-spacing: -0.02em !important;
  line-height: 1.35 !important;
  font-size: 1.2rem !important;
  margin-top: 2.25rem !important;
  margin-bottom: 0.85rem !important;
}

/* Títulos H4 */
.wm-prose h4 {
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 400 !important;
  color: #dee2f3 !important;
  font-size: 1.05rem !important;
  margin-top: 1.75rem !important;
  margin-bottom: 0.5rem !important;
}

/* Párrafos */
.wm-prose p {
  margin-top: 0 !important;
  margin-bottom: 1.35rem !important;
  color: #94a3b8 !important;
  font-size: 1.0625rem !important;
  line-height: 1.75 !important;
}

/* Énfasis y Negritas */
.wm-prose strong, .wm-prose b {
  font-weight: 600 !important;
  color: #e2e8f0 !important;
}

/* Enlaces dentro del texto */
.wm-prose a {
  color: #00f2fe !important;
  text-decoration: underline !important;
  text-decoration-color: rgba(0, 242, 254, 0.35) !important;
  text-underline-offset: 3px !important;
  transition: all 0.15s ease !important;
}

.wm-prose a:hover {
  color: #ffffff !important;
  text-decoration-color: #00f2fe !important;
}

/* Listas */
.wm-prose ul {
  list-style: none !important;
  padding-left: 0 !important;
  margin-top: 0.5rem !important;
  margin-bottom: 1.5rem !important;
}

.wm-prose ul > li {
  position: relative !important;
  padding-left: 1.5rem !important;
  margin-bottom: 0.65rem !important;
  line-height: 1.65 !important;
  color: #94a3b8 !important;
}

.wm-prose ul > li::before {
  content: "" !important;
  position: absolute !important;
  left: 0.25rem !important;
  top: 0.65rem !important;
  width: 5px !important;
  height: 5px !important;
  border-radius: 9999px !important;
  background-color: #00f2fe !important;
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.8) !important;
}

.wm-prose ol {
  counter-reset: wm-counter !important;
  list-style: none !important;
  padding-left: 0 !important;
  margin-top: 0.5rem !important;
  margin-bottom: 1.5rem !important;
}

.wm-prose ol > li {
  counter-increment: wm-counter !important;
  position: relative !important;
  padding-left: 2rem !important;
  margin-bottom: 0.75rem !important;
  line-height: 1.65 !important;
  color: #94a3b8 !important;
}

.wm-prose ol > li::before {
  content: counter(wm-counter) "." !important;
  position: absolute !important;
  left: 0.25rem !important;
  top: 0 !important;
  font-family: 'Geist Mono', monospace !important;
  font-weight: 700 !important;
  color: #00f2fe !important;
  font-size: 0.95rem !important;
}

/* 5. TABLAS RESPONSIVAS CLÍNICAS */
.wm-prose table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  margin-top: 1.75rem !important;
  margin-bottom: 2rem !important;
  background: #10192e !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 0.85rem !important;
  font-size: 0.875rem !important;
  line-height: 1.55 !important;
  table-layout: fixed !important;
}

.wm-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.wm-table-wrapper table {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
}

.wm-prose th {
  background: #141c2e !important;
  color: #dee2f3 !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 700 !important;
  font-size: 0.775rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  padding: 0.75rem 0.85rem !important;
  text-align: left !important;
  border-bottom: 1px solid rgba(0, 242, 254, 0.2) !important;
  white-space: normal !important;
  line-height: 1.35 !important;
}

.wm-prose th:nth-child(1) { width: 22%; }
.wm-prose th:nth-child(2) { width: 26%; }
.wm-prose th:nth-child(3) { width: 26%; }
.wm-prose th:nth-child(4) { width: 26%; }

.wm-prose td {
  padding: 0.85rem 0.85rem !important;
  color: #94a3b8 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  vertical-align: top !important;
  font-size: 0.85rem !important;
  line-height: 1.55 !important;
}

.wm-prose tr:last-child td {
  border-bottom: none !important;
}

.wm-prose tr:hover td {
  background: rgba(0, 242, 254, 0.02) !important;
  color: #cbd5e1 !important;
}

/* 6. DIVIDER QUIRÚRGICO */
.wm-prose hr {
  border: none !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin: 3.5rem 0 !important;
}

/* 7. CAJAS DE CONVERSIÓN Y CALLOUTS (FASE 6) */

/* Callout Tip (Impacto Medio - Cian) */
.wm-callout-tip {
  margin: 2.5rem auto !important;
  padding: 1.35rem 1.5rem !important;
  background: rgba(0, 242, 254, 0.035) !important;
  border: 1px solid rgba(0, 242, 254, 0.28) !important;
  border-left: 4px solid #00f2fe !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 8px 24px -8px rgba(0, 242, 254, 0.12) !important;
}

.wm-callout-tip-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 500 !important;
  color: #00f2fe !important;
  font-size: 1rem !important;
  margin-bottom: 0.65rem !important;
}

.wm-callout-tip p {
  color: #94a3b8 !important;
  font-size: 0.985rem !important;
  line-height: 1.65 !important;
  margin-bottom: 0.85rem !important;
}

.wm-callout-tip p strong {
  color: #e2e8f0 !important;
  font-weight: 600 !important;
}

.wm-callout-tip a.wm-callout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  padding: 0.65rem 1.25rem;
  color: #00F2FE !important;
  background-color: rgba(0, 242, 254, 0.06) !important;
  border: 1px solid rgba(0, 242, 254, 0.35) !important;
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.16) !important;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none !important;
  border-radius: 0.65rem;
  transition: all 0.2s ease;
}

.wm-callout-tip a.wm-callout-btn:hover {
  color: #FFFFFF !important;
  background-color: rgba(0, 242, 254, 0.20) !important;
  border-color: #00F2FE !important;
  box-shadow: 0 0 22px rgba(0, 242, 254, 0.36) !important;
  transform: translateY(-1px);
}

/* Callout Example (Impacto Final - Tarjeta de Cierre Naranja Lead Magnet) */
.wm-callout-example {
  margin: 3.5rem auto 2rem auto !important;
  padding: 1.75rem 1.85rem !important;
  background: linear-gradient(135deg, rgba(20, 28, 46, 0.95), rgba(12, 17, 30, 0.98)) !important;
  border: 1px solid rgba(255, 107, 53, 0.4) !important;
  border-left: 4px solid #ff6b35 !important;
  border-radius: 1rem !important;
  box-shadow: 0 12px 36px -10px rgba(255, 107, 53, 0.22), 0 0 0 1px rgba(255, 107, 53, 0.15) !important;
  position: relative !important;
  overflow: hidden !important;
}

.wm-callout-example-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 600 !important;
  color: #ff8c5a !important;
  font-size: 1.15rem !important;
  margin-bottom: 0.85rem !important;
}

.wm-callout-example p {
  color: #94a3b8 !important;
  font-size: 1rem !important;
  line-height: 1.68 !important;
  margin-bottom: 1.25rem !important;
}

.wm-callout-example p strong {
  color: #e2e8f0 !important;
  font-weight: 600 !important;
}

/* Bloque de Preguntas Frecuentes AEO */
.wm-faq-accordion h3 {
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 400 !important;
  color: #00f2fe !important;
}

.wm-faq-accordion p {
  color: #94a3b8 !important;
}

.wm-callout-example a.wm-action-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  color: #FF6B35 !important;
  background-color: #0e0906 !important;
  border: 1px solid #FF6B35 !important;
  box-shadow: 0 0 18px rgba(255, 107, 53, 0.28), inset 0 0 10px rgba(255, 107, 53, 0.14) !important;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.925rem;
  text-decoration: none !important;
  border-radius: 0.75rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: -0.01em;
}

@media (min-width: 640px) {
  .wm-callout-example a.wm-action-card-btn {
    width: auto;
  }
}

.wm-callout-example a.wm-action-card-btn:hover {
  color: #FFFFFF !important;
  background-color: rgba(255, 107, 53, 0.22) !important;
  border-color: #FF8C5A !important;
  box-shadow: 0 0 28px rgba(255, 107, 53, 0.55), inset 0 0 14px rgba(255, 107, 53, 0.25) !important;
  transform: translateY(-2px);
}

/* 8. FOOTER EDITORIAL INTERNO */
.wm-article-footer-nav {
  margin-top: 3rem;
  padding: 1.5rem;
  background: rgba(18, 24, 38, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #64748b;
}

.wm-article-footer-nav h4 {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 0;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wm-article-footer-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.wm-article-footer-nav li a {
  color: #94a3b8 !important;
  text-decoration: none !important;
}

.wm-article-footer-nav li a:hover {
  color: #00f2fe !important;
}

/* ==========================================================================
   9. ÍNDICE DE CONTENIDOS (TOC) & ARTÍCULOS RELACIONADOS
   ========================================================================== */

/* Offset de scroll para que el header fijo no tape los encabezados */
.wm-prose h2, .wm-prose h3 {
  scroll-margin-top: 6.5rem;
}

/* Acordeón Inline en Cabecera */
.wm-toc-inline {
  max-width: 760px;
  margin: 2rem auto 2.5rem auto;
  background: rgba(12, 19, 36, 0.7);
  border: 1px solid rgba(0, 242, 254, 0.2);
  border-radius: 0.75rem;
  padding: 0.85rem 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s ease;
}

.wm-toc-inline[open] {
  border-color: rgba(0, 242, 254, 0.4);
  background: rgba(12, 19, 36, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.wm-toc-inline summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #00f2fe;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}

.wm-toc-inline summary::-webkit-details-marker {
  display: none;
}

.wm-toc-inline summary svg {
  transition: transform 0.2s ease;
}

.wm-toc-inline[open] summary svg {
  transform: rotate(180deg);
}

.wm-toc-inline-list {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
}

.wm-toc-inline-list li a {
  color: #94a3b8 !important;
  text-decoration: none !important;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.wm-toc-inline-list li a:hover {
  color: #00f2fe !important;
  transform: translateX(3px);
}

.wm-toc-inline-list li a .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #00f2fe;
  opacity: 0.7;
}

/* Botón Flotante en la Esquina (TOC Floating Pill) */
.wm-toc-pill-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 40;
  background: rgba(11, 19, 41, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 242, 254, 0.35);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 242, 254, 0.2);
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.65rem 1rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.wm-toc-pill-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.wm-toc-pill-btn:hover {
  border-color: #00f2fe;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 242, 254, 0.4);
  transform: translateY(-2px);
}

/* Panel Flotante Desplegable */
.wm-toc-drawer {
  position: fixed;
  bottom: 4.75rem;
  right: 1.5rem;
  z-index: 45;
  width: min(340px, calc(100vw - 2.5rem));
  max-height: 65vh;
  background: rgba(11, 19, 41, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.85), 0 0 30px rgba(0, 242, 254, 0.15);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.wm-toc-drawer.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.wm-toc-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.75rem;
}

.wm-toc-drawer-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: #00f2fe;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.wm-toc-drawer-close {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.wm-toc-drawer-close:hover {
  color: #ffffff;
}

.wm-toc-drawer-body {
  overflow-y: auto;
  padding-right: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.wm-toc-drawer-body::-webkit-scrollbar {
  width: 4px;
}
.wm-toc-drawer-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.wm-toc-link {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #94a3b8 !important;
  text-decoration: none !important;
  padding: 0.4rem 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.wm-toc-link:hover {
  color: #00f2fe !important;
  background: rgba(255, 255, 255, 0.03);
  padding-left: 0.75rem;
}

.wm-toc-link.active {
  color: #00f2fe !important;
  font-weight: 600;
  border-left-color: #00f2fe;
  background: rgba(0, 242, 254, 0.05);
}
