/* =====================================================================
   Guía SHINING en castellano — hoja de estilos principal
   ---------------------------------------------------------------------
   · Sin dependencias externas (ni Bootstrap ni CDN): todo se sirve
     desde doc.shining.es, lo que mejora velocidad y privacidad (RGPD).
   · Sistema de diseño: estilo «Swiss / minimalista» para documentación
     (recomendación ui-ux-pro-max) con la marca SHINING (navy #195097).
   · Tokens en :root; el modo oscuro solo redefine tokens.
   · Accesibilidad: contraste ≥ 4,5:1, foco visible, objetivos ≥ 44 px,
     respeta prefers-reduced-motion.
   ===================================================================== */

/* ---------- Tipografía autoalojada (SIL OFL, ver fonts/OFL.txt) ---------- */
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-700-italic.woff2") format("woff2");
  font-weight: 700; font-style: italic; font-display: swap;
}

/* ---------- Tokens (modo claro) ---------- */
:root {
  /* Marca */
  --brand: #195097;            /* navy SHINING (7,9:1 sobre blanco) */
  --brand-strong: #0f3a73;     /* hover / pulsado */
  --brand-soft: #e8f0fa;       /* fondos suaves de marca */
  --brand-ring: #3b82f6;       /* anillo de foco */

  /* Superficies y texto */
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #0f1b2d;
  --text-muted: #4a5868;       /* 7,1:1 sobre blanco */
  --border: #dbe3ee;
  --code-bg: #eef2f7;

  /* Avisos (callouts) */
  --info-bg: #eaf2fd;   --info-border: #2f6fca;
  --tip-bg: #eaf7ef;    --tip-border: #1f8a4c;
  --warn-bg: #fdf5e6;   --warn-border: #b7791f;
  --danger-bg: #fdecec; --danger-border: #c53030;

  /* Medidas */
  --header-h: 64px;
  --sidebar-w: 280px;
  --toc-w: 230px;
  --content-max: 780px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .06), 0 1px 3px rgba(15, 27, 45, .08);
  --shadow-md: 0 4px 16px rgba(15, 27, 45, .10);

  /* Espaciado (densidad estándar) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px;

  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  color-scheme: light;
}

/* ---------- Tokens (modo oscuro) ----------
   Se activa por preferencia del sistema salvo que el usuario haya
   elegido «claro» con el botón (data-theme="light"), o al revés. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #8cb8f2; --brand-strong: #b5d1f7; --brand-soft: #16263d; --brand-ring: #8cb8f2;
    --bg: #0d1420; --surface: #131c2b; --surface-2: #1a2537;
    --text: #e6edf6; --text-muted: #a9b6c8; --border: #27344a; --code-bg: #1a2537;
    --info-bg: #13243b; --info-border: #6aa3ec;
    --tip-bg: #11291d;  --tip-border: #4cc285;
    --warn-bg: #2e2412; --warn-border: #e0a948;
    --danger-bg: #331a1a; --danger-border: #f07a7a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 6px 20px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #8cb8f2; --brand-strong: #b5d1f7; --brand-soft: #16263d; --brand-ring: #8cb8f2;
  --bg: #0d1420; --surface: #131c2b; --surface-2: #1a2537;
  --text: #e6edf6; --text-muted: #a9b6c8; --border: #27344a; --code-bg: #1a2537;
  --info-bg: #13243b; --info-border: #6aa3ec;
  --tip-bg: #11291d;  --tip-border: #4cc285;
  --warn-bg: #2e2412; --warn-border: #e0a948;
  --danger-bg: #331a1a; --danger-border: #f07a7a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 6px 20px rgba(0,0,0,.45);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;          /* 17 px: cómodo para leer documentación */
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-strong); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; border-radius: 4px; }
code, kbd {
  font-family: var(--mono); font-size: .88em;
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: .08em .4em;
}
kbd { box-shadow: inset 0 -1px 0 var(--border); }
mark { background: #fff3a3; color: #1a1a1a; padding: 0 .2em; border-radius: 3px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }

/* Enlace para saltar al contenido (teclado y lectores de pantalla) */
.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  background: var(--brand); color: #fff; padding: var(--s-2) var(--s-4); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--s-2); color: #fff; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Iconos SVG en línea (Lucide, trazo) */
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-4);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; color: var(--text); min-height: 44px; }
.brand:hover { color: var(--text); }
/* Logotipo oficial en línea: el texto usa currentColor y cambia con el tema */
.brand-logo { height: 34px; width: auto; color: var(--text); flex: none; }
.brand .brand-sub { border-left: 1px solid var(--border); padding-left: var(--s-3); line-height: 1.2; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: #195097; color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; letter-spacing: .14em; font-size: .95rem; }
.brand-sub { font-size: .78rem; color: var(--text-muted); }

.header-search { flex: 1; max-width: 520px; margin-left: auto; position: relative; }
.header-actions { display: flex; align-items: center; gap: var(--s-2); }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--brand); }
.btn-cms {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px;
  padding: 0 var(--s-4); border-radius: 10px; font-weight: 700; font-size: .92rem;
  background: #195097; color: #fff; text-decoration: none; white-space: nowrap;
  transition: background-color .2s;
}
.btn-cms:hover { background: #0f3a73; color: #fff; }
.menu-toggle { display: none; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- Buscador ---------- */
.search-field { position: relative; display: flex; align-items: center; }
.search-field .icon { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; }
.search-input {
  width: 100%; min-height: 44px; padding: 0 70px 0 42px;
  font: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .2s, background-color .2s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-ring) 30%, transparent); }
.search-kbd { position: absolute; right: 10px; font-size: .75rem; color: var(--text-muted); }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
  max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: var(--s-2); margin: 0; list-style: none;
}
.search-results[hidden] { display: none; }
.search-results a {
  display: block; padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text);
}
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--brand-soft); }
.search-results .r-title { font-weight: 700; display: block; }
.search-results .r-path { font-size: .8rem; color: var(--text-muted); display: block; }
.search-results .r-empty { padding: var(--s-3); color: var(--text-muted); }

/* ---------- Estructura de 3 columnas ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1440px; margin: 0 auto;
}
.layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

/* Barra lateral de navegación */
.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: var(--s-5) var(--s-3) var(--s-7) var(--s-4);
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
}
.nav-group { margin-bottom: var(--s-5); }
.nav-group-title {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); margin: 0 0 var(--s-2) var(--s-2);
}
.nav-group-title .icon { width: 16px; height: 16px; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: 7px var(--s-3); margin: 1px 0; min-height: 36px;
  border-radius: var(--radius-sm); border-left: 3px solid transparent;
  color: var(--text); text-decoration: none; font-size: .94rem; line-height: 1.35;
  transition: background-color .2s, color .2s;
}
.nav-list a:hover { background: var(--surface-2); }
.nav-list a[aria-current="page"] {
  background: var(--brand-soft); color: var(--brand); font-weight: 700;
  border-left-color: var(--brand);
}

/* Contenido principal */
.content { padding: var(--s-6) var(--s-6) var(--s-8); min-width: 0; }
.content-inner { max-width: var(--content-max); margin: 0 auto; }
.is-home .content-inner { max-width: 1080px; }
.home-hero > *:not(.hero-mark) { position: relative; }

.breadcrumb { font-size: .85rem; color: var(--text-muted); margin-bottom: var(--s-4); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-1); margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: var(--s-1); color: var(--border); }
.breadcrumb a { color: var(--text-muted); }

.page-header { margin-bottom: var(--s-6); padding-bottom: var(--s-5); border-bottom: 1px solid var(--border); }
.page-eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand); margin-bottom: var(--s-2);
}
h1, h2, h3, h4 { line-height: 1.25; color: var(--text); text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.35rem); margin: 0 0 var(--s-3); letter-spacing: -.01em; }
.lead { font-size: 1.15rem; color: var(--text-muted); margin: 0; }
.prose h2 {
  font-size: 1.45rem; margin: var(--s-7) 0 var(--s-3); padding-top: var(--s-2);
}
.prose h3 { font-size: 1.15rem; margin: var(--s-5) 0 var(--s-2); }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--s-4); }
.prose li { margin-bottom: var(--s-2); }
.prose li > ul, .prose li > ol { margin-top: var(--s-2); }
.prose section:first-of-type h2 { margin-top: var(--s-5); }

/* Enlace ancla junto a cada h2 (copiar enlace a la sección) */
.anchor-link {
  margin-left: var(--s-2); font-size: .85em; color: var(--text-muted); text-decoration: none;
  opacity: 0; transition: opacity .2s;
}
h2:hover .anchor-link, .anchor-link:focus { opacity: 1; }

/* Pasos numerados */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 44px; min-height: 32px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  font-weight: 700; font-size: .9rem;
}

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 0 var(--s-5); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--surface); }
th, td { text-align: left; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; }
tr:last-child td { border-bottom: 0; }

/* Avisos */
.callout {
  display: flex; gap: var(--s-3); padding: var(--s-4); margin: 0 0 var(--s-5);
  border-radius: var(--radius); border: 1px solid; border-left-width: 4px;
}
.callout .icon { margin-top: 3px; }
.callout > div > :last-child { margin-bottom: 0; }
.callout-title { display: block; font-weight: 700; margin-bottom: var(--s-1); }
.callout-info   { background: var(--info-bg);   border-color: var(--info-border); }
.callout-tip    { background: var(--tip-bg);    border-color: var(--tip-border); }
.callout-warn   { background: var(--warn-bg);   border-color: var(--warn-border); }
.callout-danger { background: var(--danger-bg); border-color: var(--danger-border); }
.callout-info .icon   { color: var(--info-border); }
.callout-tip .icon    { color: var(--tip-border); }
.callout-warn .icon   { color: var(--warn-border); }
.callout-danger .icon { color: var(--danger-border); }

/* Capturas e infografías */
.figure { margin: var(--s-5) 0; }
.figure a { display: inline-block; border-radius: var(--radius); }
.figure img {
  display: block; border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); background: #fff;
}
.figure figcaption { font-size: .88rem; color: var(--text-muted); margin-top: var(--s-2); }
.figure-row { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-start; }

/* Glosario de términos (CMS en español ↔ inglés) */
dl.terms { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-5); margin: 0 0 var(--s-5); }
dl.terms dt { font-weight: 700; }
dl.terms dd { margin: 0; color: var(--text-muted); }

/* Navegación anterior / siguiente */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-8); }
.pager a {
  display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; color: var(--text); transition: border-color .2s, box-shadow .2s;
}
.pager a:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.pager .p-label { font-size: .8rem; color: var(--text-muted); }
.pager .p-title { font-weight: 700; color: var(--brand); }
.pager .next { text-align: right; grid-column: 2; }

.page-meta { margin-top: var(--s-6); font-size: .85rem; color: var(--text-muted); }

/* Índice de la página (columna derecha) */
.toc {
  position: sticky; top: var(--header-h); align-self: start;
  max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: var(--s-6) var(--s-4) var(--s-6) 0; font-size: .88rem;
}
.toc-title { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 var(--s-3); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a {
  display: block; padding: 5px var(--s-3); margin-left: -1px; border-left: 2px solid transparent;
  color: var(--text-muted); text-decoration: none; line-height: 1.35;
}
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--brand); border-left-color: var(--brand); font-weight: 700; }

/* Índice plegable dentro del contenido (pantallas medianas/pequeñas) */
.toc-inline { display: none; margin: 0 0 var(--s-5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.toc-inline summary { cursor: pointer; padding: var(--s-3) var(--s-4); font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.toc-inline ol { margin: 0; padding: 0 var(--s-4) var(--s-4) var(--s-6); }
.toc-inline li { margin: var(--s-1) 0; }

/* ---------- Portada ---------- */
.home-hero {
  position: relative;            /* sin overflow:hidden para no recortar los resultados del buscador */
  background: linear-gradient(135deg, #102f5c 0%, #195097 55%, #2a6bbf 100%);
  color: #fff; border-radius: 20px; padding: var(--s-8) var(--s-6);
  margin-bottom: var(--s-7);
}
.hero-mark {                     /* capa decorativa recortada con las esquinas del bloque */
  position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none;
}
.hero-mark::after {             /* marca de agua sutil, decorativa */
  content: "SHINING"; position: absolute; right: -10px; bottom: -28px;
  font-size: clamp(4rem, 12vw, 9rem); font-weight: 700; letter-spacing: .12em;
  color: rgba(255,255,255,.06); pointer-events: none; line-height: 1;
}
.home-hero h1 { color: #fff; font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); max-width: 18ch; }
.home-hero p { color: #dce8f7; font-size: 1.15rem; max-width: 60ch; margin: 0 0 var(--s-5); }
.home-hero .search-field { max-width: 560px; }
.home-hero .search-input { background: #fff; color: #0f1b2d; border-color: transparent; min-height: 52px; font-size: 1rem; }
.home-hero .search-input::placeholder { color: #4a5868; }
.home-hero .search-results { color: var(--text); }
.hero-badges { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-5); }
.hero-badges span { font-size: .82rem; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.14); color: #fff; }

.home-section-title { font-size: 1.35rem; margin: 0 0 var(--s-4); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s-4); margin-bottom: var(--s-7); }
.card {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-5); border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); text-decoration: none; color: var(--text);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); color: var(--text); }
.card-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.card-icon .icon { width: 22px; height: 22px; }
.card h3 { margin: var(--s-2) 0 0; font-size: 1.1rem; }
.card p { margin: 0; color: var(--text-muted); font-size: .95rem; }
.card .card-links { margin-top: auto; padding-top: var(--s-2); font-size: .88rem; color: var(--brand); font-weight: 700; }

.quick-list { list-style: none; padding: 0; margin: 0 0 var(--s-7); display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-2) var(--s-4); }
.quick-list a { display: flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); text-decoration: none; }
.quick-list a:hover { background: var(--brand-soft); }

.support-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-5); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
}
.support-cta h2 { margin: 0 0 var(--s-1); font-size: 1.2rem; }
.support-cta p { margin: 0; color: var(--text-muted); }

/* ---------- Pie ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: var(--s-6) var(--s-4); font-size: .88rem; color: var(--text-muted);
}
.site-footer .inner { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-7); justify-content: space-between; }
.site-footer p { margin: 0 0 var(--s-2); max-width: 70ch; }

/* Botón volver arriba */
.to-top {
  position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 30;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  box-shadow: var(--shadow-md);
}
.to-top.is-visible { opacity: 1; pointer-events: auto; }

/* Fondo oscurecido del menú móvil */
.backdrop { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .layout, .layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .toc-inline { display: block; }
}
@media (max-width: 899px) {
  :root { --header-h: 60px; }
  .layout, .layout.no-toc { grid-template-columns: minmax(0, 1fr); }
  .menu-toggle { display: inline-grid; }
  .brand-sub { display: none; }
  .brand-logo { height: 24px; }
  .btn-cms span { display: none; }       /* en móvil el botón queda solo con icono */
  .btn-cms { padding: 0 var(--s-3); }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 50;
    width: min(86vw, 320px); height: auto; align-self: stretch;  /* align-self:start (escritorio) encogería el panel fijo */
    background: var(--surface);
    transform: translateX(-100%); transition: transform .25s ease-out;
    box-shadow: var(--shadow-md);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .backdrop { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 45; background: rgba(8, 15, 28, .45); }
  .content { padding: var(--s-5) var(--s-4) var(--s-7); }
  .home-hero { padding: var(--s-7) var(--s-5); border-radius: 16px; }
}
@media (max-width: 599px) {
  .header-search { display: none; }       /* en móvil se usa el buscador del menú */
  .site-header { gap: var(--s-2); }
  .header-actions { margin-left: auto; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  dl.terms { grid-template-columns: 1fr; }
  dl.terms dd { margin-bottom: var(--s-2); }
}
.sidebar-search { display: none; margin-bottom: var(--s-5); position: relative; }
@media (max-width: 599px) { .sidebar-search { display: block; } }

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

/* Impresión: solo el contenido */
@media print {
  .site-header, .sidebar, .toc, .toc-inline, .pager, .to-top, .site-footer, .anchor-link { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  a { color: inherit; }
  .callout { break-inside: avoid; }
}

/* Bloques de código / esquemas */
pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s-4); overflow-x: auto; margin: 0 0 var(--s-5); line-height: 1.5;
}
pre code { background: none; border: 0; padding: 0; font-size: .88rem; }

/* ---------- Valoración de la página ---------- */
.feedback {
  margin-top: var(--s-6); padding: var(--s-4) var(--s-5);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.feedback fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.feedback legend { float: left; font-weight: 700; margin-right: var(--s-2); }
.fb-buttons { display: flex; gap: var(--s-2); }
.fb-btn, .fb-send {
  min-height: 44px; min-width: 72px; padding: 0 var(--s-4); cursor: pointer;
  font: inherit; font-weight: 700; color: var(--brand);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  transition: background-color .2s, border-color .2s;
}
.fb-btn:hover, .fb-send:hover { border-color: var(--brand); background: var(--brand-soft); }
.fb-btn[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.fb-btn:disabled:not([aria-pressed="true"]) { opacity: .5; cursor: default; }
.fb-more { margin-top: var(--s-4); display: grid; gap: var(--s-2); }
.fb-more[hidden] { display: none; }
.fb-more textarea {
  font: inherit; color: var(--text); background: var(--bg); width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--s-3);
}
.fb-more textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-ring) 30%, transparent); }
.fb-send { justify-self: start; }
.fb-opt { color: var(--text-muted); font-weight: 400; font-size: .9em; }
.fb-msg { margin: var(--s-2) 0 0; color: var(--text-muted); }
.fb-msg:empty { display: none; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media print { .feedback { display: none; } }

/* Datos de contacto en la portada */
.support-list { list-style: none; padding: 0; margin: var(--s-2) 0 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.support-list a { font-weight: 700; }
