/* ==========================================================================
   Manual de usuario Katu — hoja de estilos
   Sin dependencias. Modo claro/oscuro, responsive e impresión.
   ========================================================================== */

:root {
  --brand: #0e7490;          /* texto y enlaces (contraste AA sobre blanco) */
  --brand-strong: #0b5c73;
  --brand-soft: #e0f2f7;
  --navy: #0e2a3b;
  --accent: var(--brand);    /* cada perfil redefine su acento */
  --accent-soft: color-mix(in oklab, var(--accent) 10%, transparent);

  --bg: #ffffff;
  --bg-alt: #f5f8fa;
  --surface: #ffffff;
  --line: #e2e8ee;
  --text: #1c2b36;
  --muted: #566573;
  --code-bg: #eef3f6;

  --ok: #047857;  --ok-bg: #e7f6ef;
  --info: #0e7490; --info-bg: #e3f3f8;
  --warn: #9a5b00; --warn-bg: #fff4de;
  --danger: #b42318; --danger-bg: #fdeceb;

  --radius: 12px;
  --shadow: 0 1px 2px rgb(16 40 56 / .06), 0 4px 16px rgb(16 40 56 / .06);
  --shadow-lg: 0 12px 40px rgb(16 40 56 / .18);
  --header-h: 64px;
  --font: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #4cc3dd;
  --brand-strong: #7dd6ea;
  --brand-soft: #123240;
  --bg: #0b1820;
  --bg-alt: #0f202b;
  --surface: #11242f;
  --line: #22394a;
  --text: #e6eef3;
  --muted: #9db0bd;
  --code-bg: #162d3a;
  --ok: #4ade9c;  --ok-bg: #0f2c22;
  --info: #5fd0e8; --info-bg: #0f2e3a;
  --warn: #f5b950; --warn-bg: #33270d;
  --danger: #ff8f86; --danger-bg: #381a18;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
  --shadow-lg: 0 12px 40px rgb(0 0 0 / .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 20px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }

body {
  margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.65;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
/* Los iconos en línea no traen tamaño propio: se fija aquí según el contexto. */
.cabecera svg, .btn svg, .etiqueta svg, .ir svg, .boton-buscar svg { width: 20px; height: 20px; flex: none; }
.nav-principal svg { width: 16px; height: 16px; }
.marca-logo svg { width: 20px; height: 20px; }
.btn svg, .ir svg { width: 18px; height: 18px; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid color-mix(in oklab, var(--accent) 60%, white); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in oklab, var(--accent) 28%, transparent); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; transition: top .15s; }
.skip:focus { top: 12px; color: #fff; }

/* ---------- Barra de lectura ---------- */
.progreso { position: fixed; inset: 0 auto auto 0; height: 3px; width: 0; background: var(--accent); z-index: 120; }

/* ---------- Cabecera ---------- */
.cabecera {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.cabecera-in { max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 14px; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 19px; letter-spacing: -.01em; }
.marca:hover { color: var(--text); }
.marca-logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #1a9cb7, #0e2a3b); color: #fff; }
.marca small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1; margin-top: 2px; }
.nav-principal { display: flex; align-items: center; gap: 2px; margin-left: 18px; }
.nav-principal a, .nav-principal button {
  font: inherit; font-size: 15px; font-weight: 500; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.nav-principal a:hover, .nav-principal button:hover, .nav-principal a[aria-current="page"] { color: var(--text); background: var(--bg-alt); }
.espaciador { flex: 1; }

.menu-perfiles { position: relative; }
.menu-perfiles-lista {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 300px; padding: 8px; display: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-perfiles[data-abierto="true"] .menu-perfiles-lista { display: block; }
.menu-perfiles-lista a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; width: 100%; color: var(--text); }
.menu-perfiles-lista a small { display: block; color: var(--muted); font-weight: 400; line-height: 1.2; }
.punto { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }

.boton-buscar {
  display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-alt); color: var(--muted); font: inherit; font-size: 15px;
}
.boton-buscar:hover { border-color: var(--accent); }
.boton-buscar kbd { margin-left: auto; font: 12px var(--mono); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface); }
.icono-boton { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.icono-boton:hover { background: var(--bg-alt); color: var(--text); }
.solo-movil { display: none; }

/* ---------- Estructura ---------- */
.estructura { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 270px minmax(0, 1fr) 230px; gap: 0 36px; padding: 0 20px; }
.estructura.sin-lateral { display: block; max-width: 1180px; }

.lateral { position: sticky; top: var(--header-h); align-self: start; height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 28px 4px 40px 0; font-size: 15.5px; }
.lateral h2 { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 22px 0 6px 12px; font-weight: 600; }
.lateral h2:first-child { margin-top: 0; }
.lateral ul { list-style: none; margin: 0; padding: 0; }
.lateral a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; color: var(--text); text-decoration: none; }
.lateral a:hover { background: var(--bg-alt); }
.lateral a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
:root[data-theme="dark"] .lateral a[aria-current="page"] { color: var(--text); }
.lateral .icono { width: 18px; height: 18px; flex: none; color: var(--accent); }

.toc { position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 32px 0 40px; font-size: 14.5px; }
.toc p { margin: 0 0 8px; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--text); }
.toc a.activo { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
:root[data-theme="dark"] .toc a.activo { color: var(--text); }
.toc li.sub a { padding-left: 28px; font-size: 13.5px; }

/* ---------- Artículo ---------- */
.articulo { min-width: 0; padding: 36px 0 60px; max-width: 820px; }
.migas { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.migas a { color: var(--muted); text-decoration: none; }
.migas a:hover { color: var(--accent); text-decoration: underline; }

.portada-perfil {
  position: relative; overflow: hidden; border-radius: 18px; padding: 34px 34px 30px; margin-bottom: 36px; color: #fff;
  background: radial-gradient(900px 300px at 100% 0, color-mix(in oklab, var(--accent) 55%, #fff 0%), transparent 70%), linear-gradient(135deg, var(--navy), color-mix(in oklab, var(--accent) 70%, #000));
  box-shadow: var(--shadow);
}
.portada-perfil .etiqueta { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; background: rgb(255 255 255 / .16); border: 1px solid rgb(255 255 255 / .25); padding: 4px 12px; border-radius: 999px; }
.portada-perfil h1 { font-size: clamp(30px, 4.4vw, 44px); line-height: 1.1; letter-spacing: -.02em; margin: 14px 0 10px; font-weight: 600; }
.portada-perfil .resumen { font-size: 19px; line-height: 1.5; max-width: 62ch; margin: 0; opacity: .92; }
.portada-perfil .ficha { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 24px 0 0; padding: 0; list-style: none; }
.portada-perfil .ficha li { background: rgb(255 255 255 / .12); border: 1px solid rgb(255 255 255 / .18); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.4; }
.portada-perfil .ficha .k { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; margin-bottom: 2px; font-weight: 600; }
.portada-perfil a { color: #fff; }

.articulo h2 { font-size: 30px; line-height: 1.2; letter-spacing: -.015em; margin: 56px 0 14px; font-weight: 600; padding-top: 6px; position: relative; }
.articulo h2:first-of-type { margin-top: 8px; }
.articulo h2 .num { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-right: 10px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 18px; vertical-align: 3px; }
.articulo h3 { font-size: 21px; margin: 34px 0 8px; font-weight: 600; letter-spacing: -.01em; }
.articulo h4 { font-size: 17px; margin: 18px 0 4px; }
.articulo h2 .ancla, .articulo h3 .ancla { opacity: 0; margin-left: 8px; font-size: .75em; text-decoration: none; color: var(--muted); }
.articulo h2:hover .ancla, .articulo h3:hover .ancla, .ancla:focus { opacity: 1; }
.articulo p { margin: 0 0 14px; }
.articulo ul, .articulo ol { margin: 0 0 16px; padding-left: 24px; }
.articulo li { margin: 5px 0; }
.articulo li::marker { color: var(--accent); }
.articulo strong { font-weight: 600; }
.articulo hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.articulo code { font: .88em var(--mono); background: var(--code-bg); padding: 2px 6px; border-radius: 6px; }
.lead { font-size: 19px; color: var(--muted); }

/* Elementos de interfaz citados en el texto */
.ui { display: inline-block; font-weight: 600; font-size: .9em; padding: 0 8px; border-radius: 6px; background: var(--accent-soft); border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent); white-space: nowrap; }
.ruta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-weight: 500; font-size: .93em; padding: 2px 10px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--line); }
.ruta .sep { color: var(--muted); }

/* Estados de pedido */
.estado { display: inline-block; font-size: .82em; font-weight: 600; padding: 1px 10px; border-radius: 999px; white-space: nowrap; }
.estado.ambar { background: #fdebc8; color: #7a4a00; } .estado.cielo { background: #d8eefb; color: #0a4a75; }
.estado.indigo { background: #e2e5fb; color: #2b2f8f; } .estado.violeta { background: #ece4fb; color: #55259e; }
.estado.verde { background: #d6f3e5; color: #05603f; } .estado.gris { background: #e5e8eb; color: #3a4650; }
.estado.rosa { background: #fbe0e8; color: #8d1c47; } .estado.rojo { background: #fbe0de; color: #8d1f16; }
:root[data-theme="dark"] .estado { filter: brightness(.95); }

/* Avisos */
.aviso { margin: 22px 0; padding: 14px 18px 14px 16px; border-radius: var(--radius); border: 1px solid; border-left-width: 5px; display: grid; grid-template-columns: 26px 1fr; gap: 0 12px; }
.aviso > svg { width: 24px; height: 24px; margin-top: 2px; }
.aviso .aviso-t { margin: 0 0 2px; font-weight: 600; }
.aviso .aviso-c > :last-child { margin-bottom: 0; }
.aviso .aviso-c { font-size: 16.5px; }
.aviso-consejo { background: var(--ok-bg); border-color: var(--ok); color: var(--text); } .aviso-consejo > svg, .aviso-consejo .aviso-t { color: var(--ok); }
.aviso-nota { background: var(--info-bg); border-color: var(--info); } .aviso-nota > svg, .aviso-nota .aviso-t { color: var(--info); }
.aviso-importante { background: var(--warn-bg); border-color: var(--warn); } .aviso-importante > svg, .aviso-importante .aviso-t { color: var(--warn); }
.aviso-cuidado { background: var(--danger-bg); border-color: var(--danger); } .aviso-cuidado > svg, .aviso-cuidado .aviso-t { color: var(--danger); }

/* Pasos numerados */
.pasos { list-style: none; counter-reset: paso; padding: 0 !important; margin: 18px 0 22px; }
.pasos > li { counter-increment: paso; position: relative; padding: 2px 0 14px 54px; margin: 0; min-height: 44px; }
.pasos > li::before { content: counter(paso); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 16px; }
.pasos > li::after { content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; background: var(--line); }
.pasos > li:last-child::after { display: none; }
.pasos > li > :last-child { margin-bottom: 0; }

/* Figuras */
.figura { margin: 26px 0 30px; }
.figura a { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--bg-alt); cursor: zoom-in; position: relative; }
.figura a::after { content: "Ampliar"; position: absolute; right: 12px; bottom: 12px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: rgb(14 42 59 / .85); color: #fff; opacity: 0; transition: opacity .15s; }
.figura a:hover::after, .figura a:focus-visible::after { opacity: 1; }
.figura img { display: block; width: 100%; height: auto; aspect-ratio: 1360 / 860; object-fit: cover; object-position: top; }
.figura figcaption { font-size: 14.5px; color: var(--muted); margin-top: 8px; padding-left: 4px; }
.figura figcaption::before { content: "Figura · "; font-weight: 600; color: var(--accent); }
:root[data-theme="dark"] .figura img { filter: brightness(.92); }

/* Tarjetas */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 20px 0 26px; }
.tarjeta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tarjeta h4 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.tarjeta h4 svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.tarjeta p { margin: 0; font-size: 15.5px; color: var(--muted); }
.tarjeta ul { margin: 6px 0 0; padding-left: 20px; font-size: 15.5px; }

.puede-nopuede { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0 26px; }
.puede-nopuede > div { border-radius: var(--radius); padding: 14px 18px 8px; border: 1px solid; }
.puede-nopuede h4 { margin: 0 0 6px; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.puede-nopuede ul { list-style: none; padding: 0 !important; }
.puede-nopuede li { padding-left: 24px; position: relative; font-size: 16px; }
.puede-nopuede li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.puede { background: var(--ok-bg); border-color: color-mix(in oklab, var(--ok) 40%, transparent); } .puede h4 { color: var(--ok); } .puede li::before { content: "✓"; color: var(--ok); }
.nopuede { background: var(--danger-bg); border-color: color-mix(in oklab, var(--danger) 35%, transparent); } .nopuede h4 { color: var(--danger); } .nopuede li::before { content: "✕"; color: var(--danger); }

/* Lista de control */
.control { list-style: none; padding: 0 !important; margin: 14px 0 22px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.control li { margin: 0; padding: 11px 16px 11px 48px; position: relative; border-bottom: 1px solid var(--line); }
.control li:last-child { border-bottom: 0; }
.control li::before { content: ""; position: absolute; left: 16px; top: 15px; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--accent); }

/* Tablas */
.tabla-wrap { overflow-x: auto; margin: 18px 0 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.articulo table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.articulo th, .articulo td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.articulo th { background: var(--bg-alt); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; white-space: nowrap; }
.articulo tr:last-child td { border-bottom: 0; }
.articulo td.c, .articulo th.c { text-align: center; }
.si { color: var(--ok); font-weight: 700; } .no { color: var(--muted); opacity: .6; } .pronto { color: var(--warn); font-size: 13px; font-weight: 600; }

details { border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0; background: var(--surface); }
summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--accent); transition: transform .15s; }
details[open] summary::after { transform: rotate(45deg); }
details[open] summary { border-bottom: 1px solid var(--line); }
details > :not(summary) { padding: 0 18px; }
details > p:first-of-type { margin-top: 14px; }
details > :last-child { margin-bottom: 16px; }

/* Anterior / siguiente */
.pag-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 60px; padding-top: 28px; border-top: 1px solid var(--line); }
.pag-nav a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); background: var(--surface); }
.pag-nav a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.pag-nav small { display: block; color: var(--muted); font-size: 13px; }
.pag-nav strong { font-size: 17px; font-weight: 600; }
.pag-nav .sig { text-align: right; grid-column: 2; }

/* ---------- Portada del manual ---------- */
.heroe { background: radial-gradient(1000px 420px at 85% -10%, #1a9cb7 0%, transparent 60%), linear-gradient(160deg, #0e2a3b, #0a1c28 70%); color: #fff; }
.heroe-in { max-width: 1180px; margin: 0 auto; padding: 72px 20px 84px; }
.heroe .sobre { display: inline-block; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; padding: 5px 14px; border-radius: 999px; background: rgb(255 255 255 / .12); border: 1px solid rgb(255 255 255 / .22); }
.heroe h1 { font-size: clamp(36px, 6vw, 62px); line-height: 1.04; letter-spacing: -.03em; margin: 18px 0 16px; font-weight: 600; max-width: 18ch; }
.heroe p { font-size: 21px; line-height: 1.5; max-width: 56ch; margin: 0 0 30px; color: rgb(255 255 255 / .86); }
.heroe .boton-buscar { max-width: 520px; width: 100%; background: rgb(255 255 255 / .96); color: #566573; border-color: transparent; padding: 14px 18px; font-size: 17px; border-radius: 14px; box-shadow: var(--shadow-lg); }
.heroe .acciones { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 11px; font-weight: 600; font-size: 16px; text-decoration: none; border: 1px solid transparent; }
.btn-primario { background: #fff; color: #0e2a3b; } .btn-primario:hover { background: #e0f2f7; color: #0e2a3b; }
.btn-secundario { color: #fff; border-color: rgb(255 255 255 / .35); } .btn-secundario:hover { background: rgb(255 255 255 / .12); color: #fff; }

.seccion { max-width: 1180px; margin: 0 auto; padding: 64px 20px 8px; }
.seccion > h2 { font-size: 32px; letter-spacing: -.02em; margin: 0 0 8px; font-weight: 600; }
.seccion > .lead { margin: 0 0 28px; max-width: 64ch; }
.perfiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.perfil-card { --accent: var(--brand); display: flex; flex-direction: column; gap: 10px; padding: 22px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.perfil-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent); }
.perfil-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); color: var(--text); }
.perfil-card .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.perfil-card .ico svg { width: 26px; height: 26px; }
.perfil-card h3 { margin: 4px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.perfil-card p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.5; }
.perfil-card ul { margin: 4px 0 0; padding-left: 20px; font-size: 15.5px; }
.perfil-card ul li::marker { color: var(--accent); }
.perfil-card .ir { margin-top: auto; padding-top: 8px; font-weight: 600; color: var(--accent); display: inline-flex; gap: 6px; align-items: center; }
:root[data-theme="dark"] .perfil-card .ir { color: var(--text); }

.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.trio .tarjeta { padding: 20px; }
.trio .num { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 600; margin-bottom: 10px; }
:root[data-theme="dark"] .trio .num { background: var(--brand); color: #04222b; }

/* ---------- Pie ---------- */
.pie { margin-top: 70px; border-top: 1px solid var(--line); background: var(--bg-alt); }
.pie-in { max-width: 1440px; margin: 0 auto; padding: 28px 20px; display: flex; flex-wrap: wrap; gap: 14px 30px; justify-content: space-between; font-size: 14.5px; color: var(--muted); }
.pie a { color: var(--muted); }

/* ---------- Búsqueda ---------- */
.busqueda { position: fixed; inset: 0; z-index: 300; display: none; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; background: rgb(7 20 28 / .6); backdrop-filter: blur(3px); }
.busqueda[data-abierto="true"] { display: flex; }
.busqueda-caja { width: min(680px, 100%); max-height: 78vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.busqueda-caja input { width: 100%; padding: 18px 20px; font: inherit; font-size: 18px; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--line); outline: none; }
.busqueda-res { overflow-y: auto; padding: 8px; }
.busqueda-res a { display: block; padding: 10px 14px; border-radius: 10px; text-decoration: none; color: var(--text); }
.busqueda-res a[aria-selected="true"], .busqueda-res a:hover { background: var(--accent-soft); }
.busqueda-res small { display: block; color: var(--muted); font-size: 13px; }
.busqueda-res b { font-weight: 600; } .busqueda-res mark { background: color-mix(in oklab, #f5b950 55%, transparent); color: inherit; border-radius: 3px; }
.busqueda-res p { margin: 2px 0 0; font-size: 14.5px; color: var(--muted); line-height: 1.4; }
.busqueda-vacio { padding: 26px; text-align: center; color: var(--muted); }
.busqueda-pie { padding: 8px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; gap: 16px; }

/* ---------- Visor de imágenes ---------- */
.visor { position: fixed; inset: 0; z-index: 400; display: none; place-items: center; background: rgb(7 20 28 / .88); padding: 24px; cursor: zoom-out; }
.visor[data-abierto="true"] { display: grid; }
.visor img { max-width: min(1500px, 100%); max-height: 100%; border-radius: 10px; box-shadow: var(--shadow-lg); }
.visor p { position: fixed; bottom: 14px; left: 0; right: 0; text-align: center; color: #d5e2ea; font-size: 14px; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .estructura { grid-template-columns: 250px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 920px) {
  .solo-movil { display: grid; }
  .nav-principal, .boton-buscar .txt, .boton-buscar kbd { display: none; }
  .boton-buscar { min-width: 0; padding: 0; width: 40px; height: 40px; justify-content: center; border-radius: 10px; }
  .estructura { display: block; }
  .lateral { position: fixed; z-index: 150; inset: var(--header-h) auto 0 0; width: min(310px, 86vw); height: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px 40px; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body[data-menu="abierto"] .lateral { transform: none; }
  body[data-menu="abierto"]::after { content: ""; position: fixed; inset: var(--header-h) 0 0 0; background: rgb(7 20 28 / .5); z-index: 140; }
  .articulo { padding-top: 24px; }
  .puede-nopuede { grid-template-columns: 1fr; }
  .portada-perfil { padding: 24px 20px; }
  .heroe-in { padding: 48px 20px 56px; }
  .heroe p { font-size: 18px; }
}
@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .articulo h2 { font-size: 26px; }
  .pag-nav { grid-template-columns: 1fr; } .pag-nav .sig { grid-column: auto; }
  .perfiles { grid-template-columns: 1fr; }
  .marca small { display: none; }
}

/* ---------- Impresión ---------- */
@media print {
  :root { --bg: #fff; --text: #000; --muted: #333; }
  body { font-size: 11.5pt; background: #fff; }
  .cabecera, .lateral, .toc, .progreso, .busqueda, .visor, .pie, .pag-nav, .heroe .acciones, .boton-buscar, .skip, .ancla { display: none !important; }
  .estructura { display: block; padding: 0; max-width: none; }
  .articulo { max-width: none; padding: 0; }
  .portada-perfil { background: #fff !important; color: #000; border: 2px solid var(--accent); box-shadow: none; }
  .portada-perfil .ficha li { background: #f4f4f4; border-color: #ccc; color: #000; }
  .portada-perfil .etiqueta { background: #eee; color: #000; border-color: #ccc; }
  .figura, .aviso, .tarjeta, tr, details { break-inside: avoid; }
  .figura a { box-shadow: none; }
  .figura a::after { display: none; }
  details { display: block; } details > * { display: block; }
  a { color: #000; text-decoration: none; }
  h2, h3 { break-after: avoid; }
}
