@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ══════════════════════════════════════════
   Unified "Signal" Design System
   Aligned with genil-dev aesthetic
   ══════════════════════════════════════════ */

:root {
  /* Typography */
  --font-head:  'DM Serif Display', Georgia, serif;
  --font-body:  'Manrope', -apple-system, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* Layout */
  --r:     12px;
  --r-sm:  8px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.9, 0.25, 1);

  /* Dark theme (default) */
  --bg:           #0c1018;
  --bg-raised:    #121820;
  --surface:      #161d28;
  --surface-2:    #1a2232;
  --surface-3:    #1e2838;
  --border:       rgba(255, 255, 255, 0.07);
  --border-faint: rgba(255, 255, 255, 0.04);
  --border-accent: rgba(74, 158, 255, 0.15);
  --text-strong:  #edf2f7;
  --text:         #cdd6e0;
  --text-muted:   #8a97a8;   /* contraste ≈5.7:1 sobre --surface (AA) */
  --accent:       #4a9eff;
  --accent-dim:   rgba(74, 158, 255, 0.1);
  --accent-2:     #a78bfa;
  --accent-3:     #34d399;
  --warn:         #f5b942;
  --err:          #f87171;
  --shadow:       0 1px 4px rgba(0,0,0,0.3), 0 4px 16px rgba(74,158,255,0.04);
  --shadow-hover: 0 8px 32px rgba(74,158,255,0.12), 0 0 0 1px rgba(74,158,255,0.1);

  /* "Papel" para diagramas SVG dibujados con tinta oscura:
     claro en ambos temas para que el texto #1a1a2e siga siendo legible */
  --paper:        #e4e9f1;
  --paper-border: rgba(255, 255, 255, 0.10);
  --paper-ink:    #1a1a2e;
}

/* Light theme */
[data-theme="light"] {
  --bg:           #ffffff;
  --bg-raised:    #ffffff;
  --surface:      #f7f9fc;
  --surface-2:    #f1f5fb;
  --surface-3:    #e8eef8;
  --border:       #e3e9f2;
  --border-faint: rgba(0,0,0,0.04);
  --border-accent: rgba(47, 111, 216, 0.15);
  --text-strong:  #101824;
  --text:         #16202e;
  --text-muted:   #5d6879;   /* contraste ≈5.3:1 sobre --surface (AA) */
  --accent:       #2f6fd8;
  --accent-dim:   rgba(47, 111, 216, 0.08);
  --accent-2:     #7c3aed;
  --accent-3:     #1f8a6f;
  --warn:         #b8860b;
  --err:          #dc2626;
  --shadow:       0 1px 2px rgba(22,32,46,0.05), 0 4px 16px rgba(47,111,216,0.04);
  --shadow-hover: 0 4px 20px rgba(47,111,216,0.12);
  --paper:        #f8fafd;
  --paper-border: #dfe6f0;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg); color: var(--text);
  max-width: 960px; margin: 0 auto; padding: 52px 32px 80px;
  line-height: 1.75; font-size: 15px; font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

/* Atmospheric background — dot grid + glow */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(74, 158, 255, 0.04) 1px, transparent 1px),
    radial-gradient(ellipse at 30% 0%, rgba(74, 158, 255, 0.06), transparent 50%),
    radial-gradient(ellipse at 70% 100%, rgba(167, 139, 250, 0.04), transparent 50%);
  background-size: 24px 24px, 100% 100%, 100% 100%;
}

[data-theme="light"] body::before {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(47, 111, 216, 0.06) 1px, transparent 1.5px),
    radial-gradient(circle at 50% 0%, rgba(47, 111, 216, 0.05), transparent 55%);
  background-size: 22px 22px, 100% 100%;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 25%, transparent 90%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 25%, transparent 90%);
}

/* Grain overlay */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}
[data-theme="light"] body::after { opacity: 0; }

/* Selection */
::selection {
  background: rgba(74, 158, 255, 0.3);
  color: var(--text-strong);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(74,158,255,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(74,158,255,0.45); }

/* Foco visible (navegación con teclado) */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px;
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
  box-shadow: var(--shadow);
}
.theme-toggle:hover {
  background: var(--accent-dim); border-color: var(--accent);
  color: var(--accent);
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: block; }

/* ── PROGRESO DE LECTURA + VOLVER ARRIBA ── */
.read-progress {
  position: fixed; top: 0; left: 0; z-index: 60;
  height: 3px; width: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.to-top {
  position: fixed; right: 16px; bottom: 20px; z-index: 50;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: 1.05em; font-weight: 700;
  box-shadow: var(--shadow);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.to-top:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ── SERIE NAV ── */
.serie-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8em; gap: 8px;
}
.serie-nav-right {
  display: flex; align-items: center; gap: 6px;
}
.serie-nav a {
  color: var(--text-muted); text-decoration: none;
  transition: color 0.15s var(--ease);
}
.serie-nav a:hover { color: var(--accent); }
.serie-nav-bottom {
  margin: 36px 0 0; padding: 16px 2px 0;
  border-top: 1px solid var(--border); border-bottom: none;
}
.home-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--accent) !important; font-weight: 600;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s var(--ease), border-color 0.15s var(--ease) !important;
  white-space: nowrap;
}
.home-btn:hover {
  border-color: var(--accent) !important;
  box-shadow: var(--shadow-hover) !important;
}
.nav-arrow {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted) !important; font-weight: 400;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease) !important;
  white-space: nowrap;
}
.nav-arrow:hover {
  background: var(--surface) !important;
  color: var(--accent) !important;
  border-color: var(--border-accent) !important;
}
.serie-nav .sep { color: var(--border); font-size: 1.2em; margin: 0 2px; }

/* ── PAGE HEADER ── */
.page-header {
  background: linear-gradient(135deg, #1a2232 0%, #161d28 55%, #121820 100%);
  border: 1px solid var(--border-accent);
  border-radius: var(--r); padding: 36px 44px 32px;
  margin-bottom: 28px; position: relative; overflow: hidden;
}
[data-theme="light"] .page-header {
  background: linear-gradient(135deg, #1a3a6e 0%, #1e4ab5 55%, #1a3580 100%);
}
.page-header::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 55% 70% at 85% 15%, rgba(74,158,255,0.08) 0%, transparent 65%);
  pointer-events: none;
}
.page-header h1 {
  font-family: var(--font-head); font-size: 1.9em; font-weight: 400;
  color: #edf2f7; letter-spacing: -0.01em; line-height: 1.2; margin-bottom: 6px;
}
.page-header .subtitle { color: #9aa6b5; font-size: 0.87em; }
[data-theme="light"] .page-header .subtitle { color: #c3d6f5; }
.reading-time { white-space: nowrap; }

/* ── INDEX CARDS ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px 28px; margin-bottom: 14px;
  text-decoration: none; color: inherit; display: block;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.card:hover {
  box-shadow: var(--shadow-hover); border-color: rgba(74,158,255,0.25);
  transform: translateY(-1px);
}
/* Las ilustraciones de las cards usan tinta oscura: se montan sobre "papel" */
.card svg {
  background: var(--paper); border-radius: 10px; padding: 8px;
  box-sizing: content-box;
}
.card .number {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 0.78em; font-weight: 800; margin-right: 12px; flex-shrink: 0;
  font-family: var(--font-body);
}
.card.independent .number { background: var(--text-muted); }
.card.independent:hover { border-color: rgba(92,106,122,0.3); }
.card .title {
  font-family: var(--font-head); font-size: 1.1em; font-weight: 400;
  color: var(--text-strong); margin-bottom: 5px;
}
.card .desc { font-size: 0.87em; color: var(--text-muted); line-height: 1.65; }
.card .topics { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 5px; }
.card .tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 0.73em; font-weight: 600;
  background: var(--accent-dim); color: var(--accent); border: 1px solid var(--border-accent);
}
.card.independent .tag { background: rgba(92,106,122,0.08); color: var(--text-muted); border-color: var(--border); }

/* ── SECTION LABEL ── */
.section-label {
  font-size: 0.71em; font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.11em;
  margin: 36px 0 14px; padding-left: 2px;
  font-family: var(--font-body);
}

/* ── GLOSSARY (0_Intro) ── */
.glosario-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 28px 32px;
  box-shadow: var(--shadow);
}
.glosario-desc {
  font-size: 0.88em; color: var(--text-muted); line-height: 1.7;
  margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border-faint);
}
.glosario-desc strong { color: var(--text); }
.glosario-table { border-collapse: collapse; width: 100%; font-size: 0.86em; }
.glosario-table th {
  background: var(--surface-2); color: var(--text-muted);
  padding: 9px 14px; text-align: left; font-weight: 700;
  font-size: 0.76em; letter-spacing: 0.07em; text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  font-family: var(--font-body);
}
.glosario-table td {
  padding: 9px 14px; border-bottom: 1px solid var(--border-faint);
  vertical-align: middle; color: var(--text);
}
.glosario-table tr:last-child td { border-bottom: none; }
.glosario-table tr:hover td { background: var(--surface-2); }
.glosario-table td:first-child { color: var(--text-strong); font-weight: 600; white-space: nowrap; }

/* ── DOC-REF BADGE ── */
.doc-ref {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 5px;
  background: var(--accent-dim); border: 1px solid var(--border-accent);
  color: var(--accent); font-size: 0.82em; font-weight: 600;
  font-family: var(--font-mono); text-decoration: none; white-space: nowrap;
  transition: background 0.15s var(--ease);
}
.doc-ref:hover { background: rgba(74,158,255,0.15); }

/* ── TOC ── */
.toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px 28px; margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.toc strong {
  font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); display: block; margin-bottom: 10px;
  font-family: var(--font-body); font-weight: 800;
}
.toc ol { padding-left: 20px; }
.toc li { margin: 5px 0; }
.toc a { color: var(--accent); text-decoration: none; font-size: 0.9em; transition: color 0.15s var(--ease); }
.toc a:hover { color: var(--accent); text-decoration: underline; opacity: 0.8; }

/* ── SECCIONES ── */
.section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 32px 36px; margin-bottom: 20px;
  box-shadow: var(--shadow);
  scroll-margin-top: 16px;
}
.section h2 {
  font-family: var(--font-head); font-size: 1.2em; font-weight: 400;
  color: var(--text-strong);
  border-left: 3px solid var(--accent); padding-left: 14px;
  margin-bottom: 20px; letter-spacing: -0.01em;
}
.section h3 {
  font-size: 0.72em; font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin: 24px 0 10px; font-family: var(--font-body);
}
.section h4 {
  font-size: 0.95em; font-weight: 700; color: var(--text-strong);
  margin: 20px 0 8px;
}
.note { color: var(--text-muted); font-size: 0.9em; }

/* ── CALLOUTS ── */
.callout {
  border-radius: var(--r-sm); padding: 14px 18px; margin: 16px 0;
  font-size: 0.92em; line-height: 1.7;
  display: flex; gap: 12px; align-items: flex-start;
}
.callout .icon { font-size: 1.1em; flex-shrink: 0; margin-top: 2px; }
.callout.azul  { background: rgba(74,158,255,0.08); border: 1px solid rgba(74,158,255,0.2); }
.callout.verde { background: rgba(52,211,153,0.08); border: 1px solid rgba(52,211,153,0.2); }
.callout.ambar { background: rgba(245,185,66,0.08); border: 1px solid rgba(245,185,66,0.2); }
.callout.rosa  { background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.2); }

[data-theme="light"] .callout.azul  { background: #eff6ff; border-color: #bfdbfe; }
[data-theme="light"] .callout.verde { background: #f0fdf4; border-color: #86efac; }
[data-theme="light"] .callout.ambar { background: #fffbeb; border-color: #fcd34d; }
[data-theme="light"] .callout.rosa  { background: #fff1f2; border-color: #fda4af; }

/* ── CODE ── */
code {
  background: var(--accent-dim); padding: 2px 7px; border-radius: 5px;
  font-family: var(--font-mono); font-size: 0.86em; color: var(--accent);
}
pre {
  position: relative;
  background: #0a0e14; color: #e2e8f0; border: 1px solid rgba(74,158,255,0.1);
  padding: 18px 22px; border-radius: var(--r-sm);
  overflow-x: auto; font-family: var(--font-mono);
  font-size: 0.82em; line-height: 1.7; margin: 14px 0;
}
[data-theme="light"] pre {
  background: #0f172a; color: #e2e8f0; border-color: #1e293b;
}
[data-theme="light"] code {
  background: #eff6ff; color: #1d4ed8;
}
/* Botón "Copiar" que el router agrega a los bloques de comandos (doc 6) */
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 9px; border-radius: 6px; cursor: pointer;
  font: 600 11px var(--font-body); letter-spacing: 0.02em;
  background: rgba(255,255,255,0.08); color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.14);
  opacity: 0; transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: rgba(74,158,255,0.25); }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* ── TABLAS ── */
.gtable { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 0.9em; }
.gtable th {
  background: var(--surface-2); color: var(--accent);
  padding: 10px 14px; text-align: left; font-weight: 700;
  font-size: 0.76em; letter-spacing: 0.05em; text-transform: uppercase;
  font-family: var(--font-body);
  border-bottom: 2px solid var(--border-accent);
}
.gtable td {
  padding: 10px 14px; border-bottom: 1px solid var(--border-faint);
  vertical-align: top; color: var(--text);
}
.gtable tr:last-child td { border-bottom: none; }
.gtable tr:hover td { background: var(--surface-2); }
.gtable .sec-head td {
  background: var(--accent-dim); color: var(--accent);
  font-weight: 700; font-size: 0.78em; letter-spacing: 0.07em;
  padding: 7px 14px; border-top: 2px solid var(--border-accent);
  font-family: var(--font-body);
}
.gtable .indent1 { padding-left: 26px; color: var(--text-muted); }
.gtable .indent2 { padding-left: 42px; color: var(--text-muted); }

.ptable { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 0.88em; }
.ptable th {
  background: var(--surface-2); color: var(--accent);
  padding: 10px 14px; text-align: left; font-weight: 700;
  font-size: 0.76em; letter-spacing: 0.05em; text-transform: uppercase;
  font-family: var(--font-body);
  border-bottom: 2px solid var(--border-accent);
}
.ptable .psec td {
  background: var(--accent-dim); color: var(--accent);
  font-weight: 700; font-size: 0.76em; letter-spacing: 0.07em;
  padding: 7px 14px; border-top: 2px solid var(--border-accent);
  font-family: var(--font-body);
}
.ptable td { padding: 10px 14px; border-bottom: 1px solid var(--border-faint); vertical-align: middle; }
.ptable tr:hover td { background: var(--surface-2); }
/* Celdas compuestas de la tabla de parámetros (valor + subtítulo) */
.ptable .dim, .ptable .pval {
  display: block; font-family: var(--font-mono); font-weight: 600; color: var(--text-strong);
}
.ptable .dsub, .ptable .psub, .ptable .tcol-sub {
  display: block; font-size: 0.78em; font-weight: 500; color: var(--text-muted);
  font-family: var(--font-body);
}
.ptable .tcol { text-align: right; font-family: var(--font-mono); font-weight: 700; color: var(--accent); }
.ptable .mat { font-family: var(--font-mono); font-weight: 700; color: var(--accent-2); }
.ptable th.right, .ptable td.right { text-align: right; }
.gtable .sec-head td span, .ptable .psec td span {
  font-weight: 500; opacity: 0.75; margin-left: 6px;
  text-transform: none; letter-spacing: 0;
}
.gtable .total-row td, .ptable .total-row td {
  background: rgba(52,211,153,0.08); border-top: 2px solid rgba(52,211,153,0.35);
  font-weight: 700; color: var(--accent-3);
}

/* ── FORMULA ── */
.formula {
  text-align: center; font-family: var(--font-mono);
  font-size: 1.05em; margin: 20px 0; padding: 18px;
  background: var(--accent-dim); border: 1px solid var(--border-accent);
  border-radius: var(--r-sm); color: var(--accent); font-weight: 500;
  overflow-x: auto;
}

/* ── TAGS ── */
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 0.76em; font-weight: 600; }
.tag-peso    { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.tag-runtime { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--border-accent); }

/* ── PASOS NUMERADOS ── */
body { counter-reset: paso; }
.paso { counter-increment: paso; margin-bottom: 28px; }
.paso-titulo {
  font-family: var(--font-body); font-size: 0.82em; font-weight: 700;
  color: var(--accent); text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.paso-titulo::before {
  content: counter(paso);
  background: var(--accent); color: #fff; width: 22px; height: 22px;
  border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: 0.85em; flex-shrink: 0; font-weight: 800;
}

/* ── FIGURAS ── */
/* Diagramas SVG con tinta oscura → panel "papel" legible en ambos temas */
.fig {
  margin: 24px 0; padding: 24px;
  background: var(--paper); border: 1px solid var(--paper-border);
  border-radius: 10px; text-align: center; color: var(--paper-ink);
  overflow-x: auto;
}
.fig svg { max-width: 100%; height: auto; }
/* Diagramas dibujados con tinta clara → panel oscuro en ambos temas (como <pre>) */
.fig.fig-dark { background: #111723; border-color: var(--border-accent); color: #e2e8f0; }
.fig-frame {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow: hidden; margin: 16px 0; background: #fff;
}
.fig-frame img { width: 100%; height: auto; display: block; }
.caption {
  font-size: 0.78em; color: var(--text-muted);
  text-align: center; margin-top: -8px;
}

/* ── ACORDEONES Q&A ── */
details.qa {
  margin: 10px 0; padding: 12px 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
details.qa summary { cursor: pointer; font-weight: 600; color: var(--text-strong); }
details.qa summary::marker { color: var(--accent); }
details.qa[open] summary { margin-bottom: 4px; }
details.qa p { margin: 10px 0 2px; }

/* ── MISC ── */
hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
p { margin: 10px 0; }
ul, ol { padding-left: 22px; margin: 10px 0; }
li { margin: 6px 0; }
.footer {
  color: var(--text-muted); font-size: 0.78em; text-align: center;
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border);
}
.footer:empty { display: none; }

/* ── CODE HIGHLIGHTS ── */
.c  { color: #34d399; }
.hi { color: #f5b942; }

/* ── HEADER EJEMPLO ── */
.page-header .ejemplo {
  margin-top: 18px; background: rgba(74,158,255,0.08);
  border-radius: var(--r-sm); padding: 12px 16px; font-size: 0.88em; color: #9aa6b5;
}
[data-theme="light"] .page-header .ejemplo { color: #c7dbfa; }
.page-header .ejemplo code {
  background: rgba(255,255,255,0.12); color: #edf2f7;
  padding: 2px 7px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.92em;
}

/* ── RESPONSIVE ── */
@media (max-width: 760px) {
  /* Tablas anchas: scroll horizontal dentro de la tabla, nunca en la página */
  .gtable, .ptable, .glosario-table {
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .glosario-table td:first-child { white-space: normal; }
}
@media (max-width: 640px) {
  .card svg { display: none; }
  body { padding: 32px 16px 60px; }
  .section { padding: 22px 20px; }
  .page-header { padding: 28px 24px 24px; }
  .page-header h1 { font-size: 1.5em; }
  .card { padding: 18px 20px; }
  .serie-nav { flex-wrap: wrap; }
  .fig { padding: 14px; }
  .toc { padding: 16px 20px; }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ── IMPRESIÓN ── */
@media print {
  :root, [data-theme="light"] {
    --bg: #fff; --surface: #fff; --surface-2: #f4f6fa;
    --text: #111; --text-strong: #000; --text-muted: #444;
    --border: #ddd; --border-faint: #eee; --paper: #fff;
  }
  body { max-width: none; padding: 0; font-size: 10.5pt; }
  body::before, body::after, .theme-toggle, .read-progress, .to-top,
  .serie-nav, .copy-btn { display: none !important; }
  .section, .card, .glosario-card, .toc { box-shadow: none; }
  .page-header { background: none !important; border: none; padding: 0 0 12px; }
  .page-header h1, .page-header .subtitle, .page-header .ejemplo { color: #000 !important; }
  .fig, .callout, pre, tr, .fig-frame { break-inside: avoid; }
  pre { white-space: pre-wrap; }
  a { color: inherit; }
}
