/* disease.css — fichas de padecimientos (releases del runner y controles estacionales).
 *
 * Se carga después de assets/site/site.css: tokens, tipografía, cabecera y pie vienen de ahí. Esta hoja
 * sólo maqueta la lectura de una ficha (título, estado, cifras, controles, gráfica, tablas y método).
 * El estado científico se distingue por texto explícito y por color de apoyo, desde la vista que carga
 * la ficha (assets/site/estado-ficha.js pone data-publication-kind en #statusCard): superada en verde,
 * en curso en azul neutro, control estacional en ocre; cargando, error o veredicto desconocido, neutro.
 * Ninguna regla oculta contenido.
 * Las gráficas vivas las dibuja el script de cada ficha; aquí sólo su caja y su leyenda.
 */
:root {
  /* Alias de los tokens del template antiguo de fichas: estilos en línea y scripts de gráficas los leen
     de :root (getComputedStyle(document.documentElement)); aquí apuntan al sistema claro. */
  --text-primary: var(--ink);
  --text-secondary: var(--body);
  --text-muted: var(--muted);
  --cream: var(--ink);
  --teal: var(--series-1);
  --amber: var(--series-4);
  --amber-soft: #7d4400;
  --bg-deep: var(--white);
  --bg-card: var(--white);
  --bg-card-hover: var(--line);
}
.disease-page {
  --obs-line: #667d8f;   /* observado: el mismo gris azulado que usa el script de la ficha */
  --fc-line: var(--green);
  --estado-bg: var(--tint);
  --estado-ink: var(--body);
  --estado-border: var(--line);
  color: var(--body);
}
/* Mismos colores que las insignias del Dashboard (assets/dashboard/dashboard.css .badge--*). */
.status-card[data-publication-kind="pass"] { --estado-bg: var(--mint); --estado-ink: #235a3f; --estado-border: #b9d4c2; }
.status-card[data-publication-kind="pending"] { --estado-bg: #eef3fa; --estado-ink: #24497a; --estado-border: #c7d6ea; }
.status-card[data-publication-kind="control"] { --estado-bg: var(--gold-soft); --estado-ink: var(--gold-ink); --estado-border: #dacba6; }
.disease-page :where(h1, h2, h3, h4, p, ul, figure) { margin: 0; }
.disease-page main { display: block; }
.disease-page .wrap { max-width: 1200px; }
html { scroll-padding-top: 96px; }

/* ── Contexto: miga y enlaces a las otras herramientas ─────────────────────── */
.ficha-context { border-bottom: 1px solid var(--line); background: var(--white); font-size: 15px; }
.ficha-context__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; min-height: 52px; }
.ficha-context__inner > a, .ficha-context__links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--green-dark); font-weight: 600; }
.ficha-context__inner > span[aria-current] { color: var(--ink); font-weight: 650; }
.ficha-context__links { display: flex; flex-wrap: wrap; gap: 0 18px; margin-left: auto; }

/* ── Encabezado de la ficha ────────────────────────────────────────────────── */
.hero { padding: 32px 0 28px; background: linear-gradient(180deg, var(--white), var(--paper)); border-bottom: 1px solid var(--line); }
.eyebrow { display: block; color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.disease-page h1 { margin: 12px 0 14px; max-width: 30ch; color: var(--ink); font-size: clamp(30px, 3.6vw, 46px); font-weight: 700; line-height: 1.12; letter-spacing: -.03em; overflow-wrap: break-word; }
.lead { max-width: 75ch; font-size: 17px; line-height: 1.65; color: var(--body); }
.lead strong, section p strong, li strong { color: var(--ink); }

.status-card { margin: 22px 0 0; padding: 18px 22px; background: var(--white); border: 1px solid var(--estado-border); border-radius: var(--radius); }
.status-badge { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 12px; border-radius: 6px; background: var(--estado-bg); color: var(--estado-ink); font-size: 14px; font-weight: 650; }
.status-badge svg { width: 16px; height: 16px; flex: none; }
.status-kind { font-weight: 750; }
.status-notes { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 15px; line-height: 1.6; }
.status-notes li { position: relative; padding-left: 16px; }
.status-notes li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--estado-ink); }

.stats, .metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.stat, .metric { min-width: 0; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.stat .v, .metric .mv { color: var(--ink); font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l, .metric .ml { margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.4; }

/* ── Secciones ─────────────────────────────────────────────────────────────── */
.disease-page section { padding: 40px 0; border-top: 1px solid var(--line); }
.label { display: block; color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.disease-page h2 { margin: 8px 0 14px; color: var(--ink); font-size: clamp(26px, 2.8vw, 34px); font-weight: 700; line-height: 1.18; letter-spacing: -.025em; }
.disease-page h3 { color: var(--ink); }
.disease-page section p { max-width: 80ch; margin-bottom: 14px; font-size: 16px; line-height: 1.7; }
.pico-heredado { padding: 12px 16px; border-left: 4px solid var(--gold); background: var(--gold-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.callout { margin-top: 18px; padding: 18px 20px; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius); }
.callout h3 { margin-bottom: 6px; font-size: 19px; }
.next-links { margin-top: 18px; font-size: 15px; }
.mono-meta { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.disease-page code { font-size: .92em; color: var(--gold-ink); overflow-wrap: anywhere; }
.err { color: var(--danger); font-weight: 600; }

/* ── Controles y gráfica ───────────────────────────────────────────────────── */
.controls { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px 20px; align-items: end; margin-top: 22px; padding: 18px; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius); }
.ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ctl > span { color: var(--body); font-size: 14px; font-weight: 650; }
.ctl select { width: 100%; min-width: 0; min-height: 46px; padding: 8px 12px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--white); color: var(--ink); font-size: 16px; }
.seg { display: flex; min-height: 46px; border: 1px solid var(--control-border); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border: 0; background: var(--white); color: var(--ink); font-size: 15px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--control-border); }
.seg button.on { background: var(--green); color: var(--white); font-weight: 700; }

.charts { display: grid; gap: 18px; margin-top: 18px; }
.chart-card { margin-top: 18px; padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.chart-title { padding: 2px 4px 10px; color: var(--ink); font-size: 20px; font-weight: 650; }
.chart-box { position: relative; height: 390px; }
.chart-card .cap, figcaption { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 4px 0; color: var(--body); font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 24px; height: 3px; border-radius: 2px; }
.sw-obs { background: var(--obs-line); }
.sw-fc { height: 0; background: none; border-top: 3px dashed var(--fc-line); }
.sw-band { width: 16px; height: 12px; background: rgb(23 100 77 / 10%); border: 1px solid #a4bfa7; }
.sw-origin { width: 0; height: 14px; border-left: 2px dashed var(--muted); border-radius: 0; }
.engine-line { margin-top: 12px; font-size: 15px; }

/* ── Tablas ────────────────────────────────────────────────────────────────── */
.table-scroll { margin-top: 14px; overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.disease-page table { width: 100%; border-collapse: collapse; font-size: 14px; }
.disease-page thead th { position: sticky; top: 0; padding: 10px 14px; background: var(--tint); color: var(--body); font-size: 13px; font-weight: 650; text-align: right; white-space: nowrap; }
.disease-page thead th:first-child, .disease-page thead th:nth-child(2) { text-align: left; }
.disease-page tbody td { padding: 12px 14px; border-top: 1px solid var(--line); color: var(--body); text-align: right; font-variant-numeric: tabular-nums; }
.disease-page tbody td:first-child { color: var(--ink); font-weight: 550; text-align: left; }
.disease-page tbody tr:hover { background: var(--tint); }
.disease-page tfoot td { padding: 10px 14px; border-top: 2px solid var(--line); background: var(--tint); color: var(--ink); font-weight: 700; text-align: right; }
td.motor { color: var(--muted); font-size: 13px; text-align: left; }
#tablaEstados tr { cursor: pointer; }
#tablaEstados tr.sel { background: var(--mint); }
.table-note { margin-top: 10px; color: var(--muted); font-size: 14px; }

/* ── Método ────────────────────────────────────────────────────────────────── */
.steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.step { padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.step .n { color: var(--green); font-size: 13px; font-weight: 700; }
.step h4 { margin: 4px 0 6px; color: var(--ink); font-size: 17px; }
.step p { margin: 0; font-size: 15px; color: var(--body); }

/* ── Bloques de la ficha de la cohorte original (Dengue) ───────────────────── */
h3.subh { display: flex; align-items: center; gap: 10px; margin: 26px 0 10px; color: var(--ink); font-size: 21px; }
h3.subh svg { width: 20px; height: 20px; flex: none; color: var(--gold-ink); }
.eda-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.eda-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 16px; margin: 18px 0; align-items: start; }
.eda-gallery figure { margin: 0; padding: 10px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.disease-page figure { margin-top: 18px; }
.disease-page figure img, .eda-gallery img, .chart-card img { display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); cursor: zoom-in; }
.sev { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.sev span { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font-size: 14px; }
.sev b { color: var(--gold-ink); }
.live-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 6px; }
.badge-live { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border: 1px solid #a4bfa7; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: 13px; font-weight: 650; }
.badge-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.live-meta { color: var(--muted); font-size: 14px; }
.disease-page tbody td.casos { color: var(--gold-ink); font-weight: 650; }
.refs { display: grid; gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; }
.refs li { padding: 14px 18px; background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: var(--radius); }
.refs .rt { color: var(--ink); font-weight: 650; }
.refs .rd { margin: 4px 0 6px; font-size: 15px; }
.refs .rtag { color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.refs a { overflow-wrap: anywhere; }
.lightbox { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 40px 20px; background: rgb(15 40 32 / 88%); cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 86vh; border-radius: 10px; background: var(--white); }
.lightbox .lb-close { position: absolute; top: 16px; right: 18px; width: 44px; height: 44px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--white); color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; }
.lightbox .lb-cap { position: absolute; left: 0; right: 0; bottom: 16px; padding: 0 20px; color: var(--white); text-align: center; font-size: 14px; pointer-events: none; }

@media (max-width: 900px) {
  .eda-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controls { grid-template-columns: 1fr; }
  .stats, .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero { padding-top: 22px; }
  .disease-page h1 { font-size: 30px; }
  .lead { font-size: 16px; }
  .status-card, .controls, .chart-card { padding: 14px; }
  .chart-box { height: 310px; }
  .stat .v, .metric .mv { font-size: 22px; }
  .ficha-context__links { margin-left: 0; }
}
.ficha-colophon { padding: 22px 0; border-top: 1px solid var(--line); background: var(--tint); text-align: center; }
.ficha-colophon .t { color: var(--ink); font-weight: 700; }
.ficha-colophon .s { margin-top: 4px; color: var(--muted); font-size: 14px; }

/* Mesa de expertos (24-nov-2026): microdefiniciones de las métricas, en lenguaje llano. */
.metric-help { margin-top: 8px; max-width: 80ch; font-size: 14px; color: var(--muted); }
.metric-help a { color: var(--green-dark); }
