:root {
  --bg: #f7f8f6;
  --bg-alt: #eef3f2;
  --surface: #ffffff;
  --text: #1a2a2c;
  --muted: #5b6b6d;
  --border: #d7e0df;
  --primary: #0f5c63;
  --primary-strong: #0a464c;
  --accent: #e07a3f;
  --error: #b42318;
  --c-medica: #0f5c63;
  --c-quirurgica: #a8452a;
  --c-mixta: #6b4fa0;
  --c-central: #3d6b2f;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 40 44 / 6%), 0 6px 20px rgb(16 40 44 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1718;
    --bg-alt: #142022;
    --surface: #1a2729;
    --text: #e6eeee;
    --muted: #9aaeb0;
    --border: #2b3c3e;
    --primary: #5fbfc6;
    --primary-strong: #86d3d8;
    --accent: #f0a06f;
    --error: #ff8a7a;
    --c-medica: #5fbfc6;
    --c-quirurgica: #f08e6d;
    --c-mixta: #b9a2ea;
    --c-central: #93c77f;
    --shadow: none;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.05rem;
}

.small {
  font-size: 0.82rem;
}

.skip {
  position: absolute;
  left: -9999px;
}

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

a {
  color: var(--primary);
}

.container {
  width: min(1100px, 100% - 32px);
  margin-inline: auto;
}

.narrow {
  width: min(760px, 100% - 32px);
}

/* Cabecera */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

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

.menu {
  display: flex;
  gap: 4px;
}

.menu a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.menu a:hover {
  background: var(--bg-alt);
}

.menu a[aria-current='page'] {
  color: var(--primary);
  font-weight: 600;
}

.menu-mobile {
  display: none;
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.menu-mobile summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.menu-mobile summary::-webkit-details-marker {
  display: none;
}

.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.menu-list a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

@media (max-width: 820px) {
  .menu {
    display: none;
  }

  .menu-mobile {
    display: block;
  }
}

/* Hero */
.hero {
  padding: clamp(56px, 10vw, 112px) 0 clamp(48px, 8vw, 88px);
  background:
    radial-gradient(60% 80% at 90% 0%, color-mix(in srgb, var(--primary) 16%, transparent), transparent),
    var(--bg);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 12px;
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 620px;
}

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

.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--bg);
}

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

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}

/* Secciones */
.section {
  padding: clamp(48px, 8vw, 88px) 0;
}

.section.alt {
  background: var(--bg-alt);
}

.section-intro {
  color: var(--muted);
  max-width: 680px;
  margin-bottom: 28px;
}

.note {
  font-size: 0.9rem;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-top: 24px;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card-stat {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 820px) {
  .two-col {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* Formularios */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 420px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

input,
select {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.result-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.result-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.error {
  color: var(--error);
  font-size: 0.9rem;
  margin: 8px 0 0;
  min-height: 1em;
}

.phases-legend {
  padding-left: 20px;
  color: var(--muted);
}

.phases-legend li {
  margin-bottom: 8px;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 0 12px 16px;
  border-left: 3px solid var(--primary);
  margin-bottom: 10px;
}

.timeline li:nth-child(2) {
  border-color: var(--accent);
}

.timeline li:nth-child(3) {
  border-color: var(--c-mixta);
}

.tl-title {
  font-weight: 700;
}

.tl-weeks {
  color: var(--muted);
  font-size: 0.9rem;
}

.tl-dates {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Especialidades */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.filters input {
  max-width: 320px;
  background: var(--surface);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  font: inherit;
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.chip[aria-pressed='true'] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--bg);
}

.spec-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.spec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--c-medica);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec-quirurgica {
  border-left-color: var(--c-quirurgica);
}

.spec-mixta {
  border-left-color: var(--c-mixta);
}

.spec-central {
  border-left-color: var(--c-central);
}

.spec-name {
  font-weight: 600;
}

.spec-type {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Calendario */
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  counter-reset: paso;
}

.steps li {
  counter-increment: paso;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}

.steps li::before {
  content: counter(paso);
  position: absolute;
  top: 16px;
  right: 18px;
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--border);
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.step-when {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
}

/* FAQ */
details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 18px;
  margin-bottom: 10px;
}

summary {
  cursor: pointer;
  font-weight: 600;
  padding: 16px 0;
}

details p {
  margin: 0 0 16px;
  color: var(--muted);
}

/* Pie */
.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0 0 6px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-brand {
  font-weight: 700;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-links a {
  color: var(--muted);
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* Artículos */
.article {
  max-width: 780px;
  padding-block: 32px 64px;
}

.article h2 {
  margin-top: 2em;
  scroll-margin-top: 80px;
}

.article p,
.article li {
  font-size: 1.05rem;
}

.article li {
  margin-bottom: 6px;
}

.article .cards {
  margin: 24px 0;
}

.section-tight {
  padding: 8px 0 48px;
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.breadcrumbs li + li::before {
  content: '/';
  margin-right: 6px;
}

.article-meta {
  color: var(--muted);
  font-size: 0.9rem !important;
  margin-top: -4px;
}

.toc {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 16px 22px;
  margin: 24px 0;
}

.toc-title,
.ficha-title {
  font-weight: 700;
  margin: 0 0 8px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
}

.toc li {
  margin-bottom: 2px;
  font-size: 0.98rem;
}

.ficha {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.ficha dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.ficha dl div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
}

.ficha dt {
  color: var(--muted);
}

.ficha dd {
  margin: 0;
  font-weight: 600;
}

@media (max-width: 520px) {
  .ficha dl div {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pros-cons > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.pros-cons > div:first-child {
  border-top: 4px solid var(--c-central);
}

.pros-cons > div:last-child {
  border-top: 4px solid var(--accent);
}

.pros-cons ul {
  padding-left: 18px;
  margin: 0;
}

@media (max-width: 640px) {
  .pros-cons {
    grid-template-columns: 1fr;
  }
}

.numbered li {
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-alt);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.faq {
  margin-top: 2em;
}

details > div {
  color: var(--muted);
}

details > div p {
  margin: 0 0 16px;
}

.related {
  margin-top: 48px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.guide-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--c-medica);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.guide-card:hover {
  transform: translateY(-2px);
}

.guide-card.spec-quirurgica {
  border-top-color: var(--c-quirurgica);
}

.guide-card.spec-mixta {
  border-top-color: var(--c-mixta);
}

.guide-card.spec-central {
  border-top-color: var(--c-central);
}

.guide-type {
  font-size: 0.8rem;
  color: var(--muted);
}

.guide-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.guide-desc {
  font-size: 0.9rem;
  color: var(--muted);
}

.card-link {
  color: var(--text);
  text-decoration: none;
}

.card-link:hover {
  border-color: var(--primary);
}

.link-arrow {
  font-weight: 600;
}

a.spec-name {
  color: var(--text);
}

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

  .guide-card {
    transition: none;
  }
}

/* Material recomendado */
.aviso-afiliados {
  font-size: 0.88rem !important;
  color: var(--muted);
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 10px 14px;
}

.productos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}

.producto {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.producto p {
  margin: 0;
}

.producto-nombre {
  font-weight: 700;
}

.producto-porque {
  color: var(--muted);
  font-size: 0.93rem !important;
  flex: 1;
}

.btn-amazon {
  margin-top: 8px;
  text-align: center;
  background: var(--accent);
  color: #1a1a1a;
  padding: 10px 14px;
}

.material {
  margin-top: 48px;
}

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li {
  position: relative;
  padding-left: 30px;
}

.checklist li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary);
  border-radius: 4px;
}

.brand b,
.footer-brand b {
  color: var(--accent);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
