/* ===== Tokens ===== */
:root {
  --bg: #050d27;
  --bg-alt: #0b1c4d;
  --surface: #0d2158;
  --ink: #f2f6fd;
  --ink-soft: #b4c3e0;
  --line: #2a4083;
  --primary: #f2f6fd;
  --brand: #7db4ff;
  --sky: #38aaf5;
  --soft: #7db4ee;
  --brand-soft: #1d3a85;
  --accent: #ef5b69;
  --accent-ink: #ffffff;
  --accent-soft: #4a2040;
  --ok: #6fcf9c;
  --ok-soft: #153d36;
  --warn: #f0b45a;
  --warn-soft: #3d3220;
  --monitor: #061030;
  --monitor-line: #4ade80;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 28px rgba(3, 10, 36, .35);
  --font: Arial, Helvetica, sans-serif;
  --font-display: Arial, Helvetica, sans-serif;
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: linear-gradient(180deg, #030a1f 0%, #071641 38%, #04102e 70%, #02081c 100%) fixed;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin-top: 1.4em; }
h4:first-child { margin-top: 0; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 28px; } }
.narrow { max-width: 820px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

.eyebrow {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--brand); margin-bottom: .75em;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  background: var(--accent); color: var(--accent-ink);
  border: 2px solid var(--accent); border-radius: 999px;
  padding: .8em 1.5em; font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer; transition: transform .15s, background .15s, color .15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--soft); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: .5em 1.1em; font-size: .9rem; }
.btn-block { width: 100%; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 46px; height: 46px; border-radius: 10px; background: #fff; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: .95rem; }
.brand-text span { font-family: var(--font-display); font-size: 1.15rem; color: var(--brand); font-weight: 600; }

.nav { display: flex; align-items: center; gap: 28px; }
.nav a:not(.btn) { text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--ink-soft); }
.nav a:not(.btn):hover { color: var(--ink); }

.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; transition: transform .2s, opacity .2s; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 72px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px; box-shadow: var(--shadow);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a:not(.btn) { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .nav .btn { margin-top: 12px; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ===== Hero ===== */
.hero { padding: 64px 0 80px; overflow: hidden; }
.hero-inner { display: grid; gap: 48px; align-items: center; }
@media (min-width: 960px) { .hero-inner { grid-template-columns: 1.05fr 1fr; } .hero { padding: 96px 0 112px; } }
.hero h1 em { font-style: italic; color: var(--accent); }
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 36px; }
.hero-facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 12px 32px; color: var(--ink-soft); font-size: .92rem; }
.hero-facts strong { color: var(--ink); }

.monitor {
  background: var(--monitor); color: #cfe9d9; border-radius: 20px; padding: 18px 20px 20px;
  box-shadow: 0 30px 60px -20px rgba(11, 26, 69, .45);
  transform: rotate(-1.5deg);
}
.monitor-top { display: flex; align-items: center; gap: 10px; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.monitor-top .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--monitor-line); animation: blink 1.6s infinite; }
.monitor-bpm { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: .95rem; }
.monitor-bpm b { font-size: 1.6rem; color: var(--monitor-line); font-variant-numeric: tabular-nums; }
.ecg { width: 100%; height: 160px; margin: 12px 0 16px; color: var(--monitor-line); }
.ecg-line {
  fill: none; stroke: var(--monitor-line); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1400; stroke-dashoffset: 1400;
  animation: trace 4s linear infinite;
  filter: drop-shadow(0 0 4px rgba(74, 222, 128, .6));
}
.monitor-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.monitor-stats div { background: rgba(255, 255, 255, .05); border-radius: 10px; padding: 10px 12px; }
.monitor-stats span { display: block; font-size: .72rem; opacity: .7; text-transform: uppercase; letter-spacing: .08em; }
.monitor-stats b { font-size: 1.2rem; color: #fff; font-variant-numeric: tabular-nums; }

@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .ecg-line { animation: none; stroke-dashoffset: 0; }
  .monitor-top .dot { animation: none; }
  html { scroll-behavior: auto; }
}

/* ===== Sections ===== */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head p:last-child { color: var(--ink-soft); }
.note { margin-top: 24px; font-size: .88rem; color: var(--ink-soft); }

/* ===== Studies ===== */
.studies { display: grid; gap: 24px; }
@media (min-width: 960px) { .studies { grid-template-columns: 320px 1fr; align-items: start; } }

.study-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
@media (min-width: 960px) { .study-tabs { flex-direction: column; overflow: visible; position: sticky; top: 96px; } }

.study-tabs [role="tab"] {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
  text-align: left; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s;
  max-width: 280px;
}
@media (min-width: 960px) { .study-tabs [role="tab"] { max-width: none; } }
.study-tabs [role="tab"]:hover { border-color: var(--ink-soft); }
.study-tabs [role="tab"][aria-selected="true"] { border-color: var(--brand); background: var(--brand-soft); }
.study-tabs b { display: block; font-size: .95rem; line-height: 1.25; }
.study-tabs small { display: block; color: var(--ink-soft); font-size: .8rem; }

.tab-icon {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; background: var(--bg-alt); color: var(--brand);
}
[aria-selected="true"] .tab-icon { background: var(--brand); color: #fff; }
.tab-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 22px;
  animation: fade .25s ease;
}
@media (min-width: 640px) { .panel { padding: 36px 40px; } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.panel-head { border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 24px; }
.panel-head h3 { font-family: var(--font-display); font-size: clamp(1.4rem, 2.5vw, 1.85rem); font-weight: 600; }
.panel-body { display: grid; gap: 28px; }
@media (min-width: 760px) { .panel-body { grid-template-columns: 1fr 1fr; gap: 40px; } }

.chips { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--bg-alt); border-radius: 8px; padding: 6px 12px; font-size: .88rem; font-weight: 600; }
.chips span { display: block; font-size: .7rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }

.list { padding-left: 1.1em; margin: 0; color: var(--ink-soft); }
.list li { margin-bottom: .45em; }
.list li::marker { color: var(--accent); }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-left: 40px; margin-bottom: 14px; color: var(--ink-soft); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .85rem;
  display: grid; place-items: center;
}
.prep { margin-top: 24px; background: var(--bg-alt); border-radius: 12px; padding: 18px 20px; }
.prep .list { color: var(--ink); }
.prep .list b { color: var(--accent); }

/* ===== Prep table ===== */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.prep-table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: .95rem; }
.prep-table th, .prep-table td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.prep-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); background: var(--bg-alt); }
.prep-table tbody th { font-weight: 700; }
.prep-table tbody tr:last-child > * { border-bottom: 0; }
.prep-table td { color: var(--ink-soft); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.tag-no { background: var(--ok-soft); color: var(--ok); }
.tag-yes { background: var(--warn-soft); color: var(--warn); }

.bring { margin-top: 32px; }
.bring h3 { font-size: 1.05rem; }
.bring ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.bring li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.bring li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

/* ===== About ===== */
.about { display: grid; gap: 40px; }
@media (min-width: 900px) { .about { grid-template-columns: 1fr 1.1fr; align-items: center; } }
.about-copy p:last-child { color: var(--ink-soft); font-size: 1.05rem; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.features li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; border-top: 3px solid var(--sky); }
.features h3 { font-size: 1.05rem; }
.features p { color: var(--ink-soft); margin: 0; font-size: .95rem; }

/* ===== FAQ ===== */
.faq { display: grid; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 20px; }
.faq summary { cursor: pointer; list-style: none; padding: 18px 32px 18px 0; font-weight: 700; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-size: 1.4rem; color: var(--brand); font-weight: 400; transition: transform .2s;
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details p { color: var(--ink-soft); padding-bottom: 18px; margin: 0; }

/* ===== Contact ===== */
.contact-inner { display: grid; gap: 40px; }
@media (min-width: 900px) { .contact-inner { grid-template-columns: 1fr 1fr; align-items: start; } }
.contact-info > p { color: var(--ink-soft); }
.contact-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 18px; }
.contact-list span { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); font-weight: 700; }
.contact-list a { font-weight: 700; text-decoration: none; }
.contact-list a:hover { color: var(--brand); }

.contact-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 22px; display: grid; gap: 16px; }
@media (min-width: 640px) { .contact-form { padding: 32px; } }
.field-row { display: grid; gap: 16px; }
@media (min-width: 520px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field [aria-invalid="true"] { border-color: var(--accent); }
.form-msg { margin: 0; font-size: .9rem; color: var(--accent); min-height: 1.4em; }

/* ===== Footer ===== */
.site-footer { background: #071233; border-top: 4px solid var(--accent); color: #cdd5e3; padding: 40px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.footer-inner p { margin: 0; }
.footer-inner strong { color: #fff; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-inner a { text-decoration: none; color: #cdd5e3; }
.footer-inner a:hover { color: #fff; }
.small { font-size: .85rem; width: 100%; opacity: .8; }

/* ===== Especialistas ===== */
.doctors { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.doctor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 22px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; margin-bottom: 16px;
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--sky));
}
.doctor h3 { font-size: 1.1rem; margin-bottom: .25em; }
.doctor .role { color: var(--accent); font-weight: 700; font-size: .85rem; margin: 0 0 .6em; }
.doctor p:last-child { color: var(--ink-soft); font-size: .92rem; margin: 0; }

.hours-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
  background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .9rem;
}
.hours-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ===== Fondo: trazos de ECG sutiles ===== */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='140' viewBox='0 0 900 140'%3E%3Cpath d='M0 80H150l12-10 12 10H230l8 12 12-62 12 76 9-26H400l16-16 16 16H520l12-10 12 10H600l8 12 12-62 12 76 9-26H780l16-16 16 16H900' fill='none' stroke='%237db4ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 900px 140px;
  background-position: 0 12%, -300px 48%, -120px 86%;
  opacity: .07;
}
.section-alt { background: rgba(20, 50, 120, .28); }

/* ===== Bloques en blanco ===== */
.on-light {
  --surface: #ffffff; --ink: #0f2358; --ink-soft: #475a7d; --line: #d9e3f1;
  --brand: #193d9e; --brand-soft: #e3edfb; --bg-alt: #eef3fb; --accent: #d62839;
  --ok: #2f7d5b; --ok-soft: #e4f2ea; --warn: #9a5b00; --warn-soft: #fbefdc;
  --shadow: 0 1px 2px rgba(15, 35, 88, .08), 0 8px 24px rgba(3, 10, 36, .25);
  color: var(--ink);
}
section.on-light { background: #ffffff; }

/* ===== Bienvenida ===== */
.hero { padding: 72px 0 56px; }
.hero-welcome { text-align: center; }
.hero-welcome h1 { font-size: clamp(2.4rem, 8vw, 5.2rem); font-weight: 800; letter-spacing: .01em; line-height: 1.05; margin-bottom: .35em; }
.tagline { font-size: clamp(1.4rem, 3.6vw, 2.2rem); font-weight: 700; color: var(--brand); line-height: 1.3; margin: 0 0 40px; }
.hero-visual { max-width: 640px; margin: 0 auto; }
.intro { padding-top: 24px; }
.intro-inner { text-align: center; }
.intro-inner .lead { margin-left: auto; margin-right: auto; }
.intro-inner .hero-actions, .intro-inner .hero-facts { justify-content: center; }
.intro h2 em { font-style: normal; color: var(--accent); }

/* ===== Títulos más grandes ===== */
h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); }
h2 { font-size: clamp(2.2rem, 4.6vw, 3.4rem); font-weight: 700; }
h3 { font-size: 1.5rem; }
.panel-head h3 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); font-weight: 700; }
.doctor h3 { font-size: 1.3rem; }
.features h3, .bring h3 { font-size: 1.25rem; }
.brand-text span { font-weight: 700; }

/* ===== Bienvenida: el lema es el protagonista ===== */
.kicker { font-size: clamp(.95rem, 2vw, 1.25rem); font-weight: 700; letter-spacing: .28em; color: var(--brand); margin: 0 0 1em; }
.hero-welcome h1 { font-size: clamp(2.8rem, 9vw, 6rem); font-weight: 800; letter-spacing: -.01em; line-height: 1.08; margin: 0 0 .6em; }
.hero-welcome h1 em { font-style: normal; color: var(--accent); }
