/* =====================================================================
   HealthMonitor — página pública
   Misma identidad que el panel clínico: IBM Plex, paleta institucional y
   colores semánticos reservados para estado clínico.
   ===================================================================== */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 700;
  src: url("assets/fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gray-25: #fbfcfd;
  --gray-50: #f6f8fa;
  --gray-75: #f1f4f7;
  --gray-100: #eaeef3;
  --gray-150: #e0e5ec;
  --gray-200: #d2d9e2;
  --gray-400: #8b97a6;
  --gray-500: #657285;
  --gray-600: #4b5768;
  --gray-700: #36414f;
  --gray-900: #121a24;

  --brand-50: #eef4fb;
  --brand-100: #dbe7f4;
  --brand-200: #b8cfe8;
  --brand-300: #8aafd8;
  --brand-600: #1b5a98;
  --brand-700: #0f4a84;
  --brand-800: #0a3b6b;
  --brand-900: #072b4f;
  --brand-950: #051f3a;
  --sky-300: #8ad3f4;
  --sky-400: #42b4ea;

  --danger-50: #fef3f2;
  --danger-200: #fecdca;
  --danger-600: #d92d20;
  --danger-700: #b42318;

  --warning-50: #fffaeb;
  --warning-100: #fef0c7;
  --warning-200: #fedf89;
  --warning-600: #dc6803;
  --warning-700: #b54708;

  --border: var(--gray-150);
  --text: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --shadow-sm: 0 1px 3px rgba(18, 26, 36, 0.08), 0 1px 2px rgba(18, 26, 36, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(5, 31, 58, 0.45), 0 6px 12px -6px rgba(5, 31, 58, 0.25);
  --focus-ring: 0 0 0 3px rgba(42, 159, 217, 0.4);

  --topbar-height: 60px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-height) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--brand-700);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--brand-800);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(8px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
}

.nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
}

.nav a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}

.nav a:hover {
  color: var(--brand-700);
}

.lang {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.lang button {
  min-width: 36px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.lang button[aria-pressed="true"] {
  background: #ffffff;
  color: var(--brand-800);
  box-shadow: var(--shadow-sm);
}

/* ---------- Inicio ---------- */
.hero {
  padding: 84px 0 92px;
  background: linear-gradient(160deg, var(--brand-900) 0%, var(--brand-950) 100%);
  color: #ffffff;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 56px;
  align-items: center;
}

.eyebrow {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-600);
}

.eyebrow.on-dark {
  color: var(--sky-300);
}

.hero h1 {
  font-size: clamp(32px, 4.3vw, 50px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.hero-sub {
  max-width: 60ch;
  margin-top: 22px;
  font-size: 18.5px;
  line-height: 1.6;
  color: var(--brand-100);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 15.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--sky-400);
  color: var(--brand-950);
}

.btn-primary:hover {
  background: var(--sky-300);
}

.btn-ghost {
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
}

.btn-ghost:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border-radius: var(--radius-xl);
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.hero-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-card-meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

.hero-card-title {
  font-size: 18px;
  line-height: 1.35;
}

.hero-card-quote {
  padding: 12px 14px;
  border-left: 3px solid var(--warning-600);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--warning-50);
  font-size: 15px;
  line-height: 1.5;
  color: var(--gray-700);
}

.hero-card-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hero-card-facts li {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hero-card-facts span {
  font-size: 12px;
  color: var(--text-muted);
}

.hero-card-facts b {
  font-size: 14.5px;
  font-weight: 600;
}

.hero-card-foot {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Secciones ---------- */
.section {
  padding: 84px 0;
}

.section-alt {
  background: var(--gray-50);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-title {
  max-width: 24ch;
  margin-bottom: 36px;
  font-size: clamp(26px, 3.1vw, 36px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.section-title.small {
  margin-bottom: 20px;
  font-size: 26px;
}

.section-title:has(+ .section-lead) {
  margin-bottom: 14px;
}

.section-lead {
  max-width: 68ch;
  margin-bottom: 36px;
  font-size: 17.5px;
  color: var(--text-secondary);
}

.cards-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--gray-25);
}

.card h3 {
  margin-bottom: 8px;
  font-size: 18.5px;
  font-weight: 600;
}

.card p {
  color: var(--text-secondary);
}

/* ---------- Pasos ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 20px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #ffffff;
}

.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 36px;
  right: -13px;
  z-index: 1;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--brand-300);
  border-right: 2px solid var(--brand-300);
  transform: rotate(45deg);
}

.step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--brand-600);
  color: #ffffff;
}

.step-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step-number {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.step-title {
  font-size: 17px;
  font-weight: 600;
}

.step-role {
  font-size: 14px;
  color: var(--brand-700);
}

.step p {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ---------- Video ---------- */
.video-frame {
  aspect-ratio: 16 / 9;
  max-width: 920px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--brand-950);
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Caso de ejemplo ---------- */
.case {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--gray-75);
  overflow: hidden;
}

.case-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-800);
  font-size: 15px;
  font-weight: 600;
}

.case-banner-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-right: auto;
}

.case-banner-main strong {
  font-size: 17px;
  font-weight: 600;
}

.case-banner-main span {
  font-size: 14px;
  color: var(--text-secondary);
}

.case-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
  padding: 18px;
}

.case-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(18, 26, 36, 0.05);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-header h3 {
  font-size: 15.5px;
  font-weight: 600;
}

.panel-meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

.panel-body {
  padding: 16px 18px 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.badge.tone-neutral {
  background: var(--gray-50);
  border-color: var(--gray-200);
  color: var(--gray-700);
}

.badge.tone-danger {
  background: var(--danger-50);
  border-color: var(--danger-200);
  color: var(--danger-700);
}

.plan-list {
  display: grid;
  gap: 4px;
  padding-left: 22px;
  list-style: decimal;
  font-size: 15px;
  color: var(--gray-700);
}

.plan-rule {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--brand-50);
  font-size: 14.5px;
  color: var(--brand-900);
}

mark {
  padding: 1px 2px;
  background: var(--warning-100);
  color: inherit;
  box-shadow: inset 0 -1px 0 var(--warning-200);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.mark-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.transcript {
  display: flex;
  flex-direction: column;
}

.transcript-line {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--gray-100);
}

.transcript-line:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.transcript-who {
  padding-top: 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.transcript-who time {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--gray-400);
}

.transcript-line.patient .transcript-who {
  color: var(--brand-700);
}

.transcript-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.transcript-line.patient .transcript-text {
  font-weight: 500;
  color: var(--text);
}

.analysis-summary {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--gray-700);
}

.panel-body h4 {
  margin: 18px 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.bullets {
  display: grid;
  gap: 8px;
}

.bullets li {
  position: relative;
  padding-left: 18px;
  color: var(--gray-700);
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-600);
}

.bullets.danger li::before {
  background: var(--danger-600);
}

.bullets.warning li::before {
  background: var(--warning-600);
}

.panel-body .bullets {
  font-size: 15px;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.metric {
  display: flex;
  flex-direction: column;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--gray-25);
}

.metric span {
  font-size: 12.5px;
  color: var(--text-muted);
}

.metric b {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.metric small {
  font-size: 13px;
  color: var(--text-secondary);
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-sans);
}

.chart-grid line {
  stroke: var(--gray-100);
  stroke-width: 1;
}

.chart-axis text {
  font-size: 12px;
  fill: var(--gray-500);
}

.chart-line {
  fill: none;
  stroke: var(--brand-600);
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-dots circle {
  fill: #ffffff;
  stroke: var(--brand-600);
  stroke-width: 2.25;
}

.chart-dots circle.is-alert {
  fill: var(--danger-600);
  stroke: #ffffff;
  stroke-width: 2;
}

.chart-values text {
  font-size: 12.5px;
  font-weight: 500;
  fill: var(--gray-600);
}

.chart-values text.is-alert {
  font-size: 14px;
  font-weight: 600;
  fill: var(--danger-700);
}

.chart-threshold {
  stroke: var(--danger-600);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.chart-threshold-label {
  font-size: 12px;
  fill: var(--danger-700);
}

.chart figcaption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.alert-panel {
  border-color: var(--danger-200);
}

.alert-title {
  display: block;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.alert-evidence-title {
  margin: 14px 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.quotes {
  display: grid;
  gap: 8px;
}

.quotes li {
  padding: 9px 12px;
  border-left: 3px solid var(--warning-600);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--warning-50);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--gray-700);
}

.alert-next {
  margin-top: 14px;
  font-size: 14.5px;
  color: var(--text-secondary);
}

/* ---------- Tecnología ---------- */
.tech-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.deflist {
  display: grid;
  gap: 4px;
}

.deflist dt {
  font-weight: 600;
}

.deflist dd {
  margin-bottom: 14px;
  font-size: 15.5px;
  color: var(--text-secondary);
}

.deflist dd:last-child {
  margin-bottom: 0;
}

.tech-int {
  font-size: 15.5px;
  color: var(--text-secondary);
}

.tech-int + .tech-int {
  margin-top: 12px;
}

/* ---------- Usos y estado ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
}

.status-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.status-list li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand-600);
  border-radius: var(--radius-lg);
  background: #ffffff;
}

.status-list strong {
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.35;
}

.status-list span {
  font-size: 14.5px;
  color: var(--text-secondary);
}

/* ---------- Pendientes (solo antes de publicar) ---------- */
/* Todo lo marcado con data-pending se ve solo en la vista previa local (app.js agrega
   la clase "borrador" en localhost). En el sitio público queda oculto. */
:root:not(.borrador) [data-pending] {
  display: none !important;
}

.pending {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 760px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 2px dashed var(--warning-600);
  border-radius: var(--radius-lg);
  background: var(--warning-50);
  font-size: 15px;
  color: var(--gray-700);
}

.pending strong {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--warning-700);
}

.section-title + .pending {
  margin-top: 0;
}

.pending.on-dark {
  margin-top: 0;
}

/* ---------- Contacto y pie ---------- */
.contact {
  background: var(--brand-900);
  color: #ffffff;
}

.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 40px;
  align-items: center;
}

.contact h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 2.8vw, 32px);
  font-weight: 600;
  line-height: 1.25;
}

.contact p {
  max-width: 56ch;
  font-size: 17px;
  color: var(--brand-100);
}

.contact .btn {
  justify-self: start;
}

.footer {
  padding: 24px 0;
  background: var(--brand-950);
  color: var(--brand-200);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.footer-inner span:first-child {
  font-weight: 600;
  color: #ffffff;
}

/* ---------- Pantallas medianas y móviles ---------- */
@media (max-width: 1020px) {
  .nav {
    display: none;
  }

  .lang {
    margin-left: auto;
  }

  .hero-grid,
  .case-grid,
  .tech-grid,
  .contact-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-card {
    max-width: 460px;
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step:not(:last-child)::after {
    display: none;
  }

  .status-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .wrap {
    padding: 0 18px;
  }

  .hero {
    padding: 52px 0 60px;
  }

  .section {
    padding: 56px 0;
  }

  .cards-3,
  .steps,
  .two-col,
  .status-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .two-col {
    gap: 40px;
  }

  .case-grid {
    padding: 12px;
  }

  .case-banner {
    flex-wrap: wrap;
  }

  .transcript-line {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .transcript-who time {
    display: inline;
    margin-left: 8px;
  }

  /* El gráfico se achica con la pantalla: se agranda el texto y se omite el eje,
     porque cada punto ya trae su valor. */
  .chart-axis text[text-anchor="end"] {
    display: none;
  }

  .chart-axis text,
  .chart-values text {
    font-size: 18px;
  }

  .chart-values text.is-alert {
    font-size: 20px;
  }

  .chart-threshold-label {
    font-size: 17px;
  }
}
