/* ciso-ui · base: tokens, tipografía y reinicio.
 *
 * Los colores van como tripletes RGB («132 90 223») para poder pedir transparencias con
 * rgb(var(--cu-primario) / .1), que es como se construyen todas las variantes suaves.
 *
 * Atributos en <html> (los pone <ProveedorTema>):
 *   data-cu-tema="claro|oscuro"          data-cu-menu="oscuro|claro|color|degradado|transparente"
 *   data-cu-cabecera="claro|oscuro|color|degradado|transparente"
 *   data-cu-navegacion="vertical|horizontal"  data-cu-lateral="abierto|plegado"
 *   data-cu-ancho="completo|caja"         data-cu-pagina="normal|clasica|moderna"
 *   data-cu-empresa="…"                   dir="ltr|rtl"
 */

:root {
  /* Paleta */
  --cu-primario: 132 90 223;
  --cu-secundario: 35 183 229;
  --cu-aviso: 245 184 73;
  --cu-info: 73 182 245;
  --cu-exito: 38 191 148;
  --cu-peligro: 230 83 60;
  --cu-claro: 243 246 248;
  --cu-oscuro: 35 35 35;
  --cu-naranja: 255 165 5;
  --cu-rosa: 231 145 188;
  --cu-turquesa: 18 194 194;
  --cu-morado: 137 32 173;
  --cu-rojo: 208 61 70;
  --cu-azul: 43 62 101;
  --cu-verde: 29 216 113;
  --cu-cian: 0 209 209;
  --cu-indigo: 77 93 219;
  --cu-gris: 134 153 163;
  --cu-amarillo: 255 193 2;

  /* Superficies y tinta */
  --cu-fondo: 240 241 247;
  --cu-superficie: 255 255 255;
  --cu-fondo-suave: 247 248 249;
  --cu-hover: 245 246 247;
  --cu-texto: 51 51 53;
  --cu-titulo: 35 35 35;
  /* La referencia usa 140 144 151 (3,1:1 sobre blanco). Aquí, uno que pasa AA (4,9:1). */
  --cu-apagado: 101 107 118;
  --cu-borde: 243 243 243;
  --cu-borde-entrada: 233 237 246;
  --cu-entrada-fondo: 255 255 255;
  --cu-velo: 0 0 0;

  /* Menú lateral y cabecera (los cambia data-cu-menu / data-cu-cabecera) */
  --cu-menu-fondo: 17 28 67;
  --cu-menu-texto: 163 174 209;
  --cu-menu-activo: 255 255 255;
  --cu-menu-borde: 255 255 255 / .1;
  --cu-menu-hover: 255 255 255 / .05;
  --cu-cabecera-fondo: 255 255 255;
  --cu-cabecera-texto: 83 100 133;
  --cu-cabecera-borde: 243 243 243;
  --cu-cabecera-hover: 83 100 133 / .06;
  /* Ojo: los tokens que ya llevan «/ alfa» (bordes, textos de menú y cabecera, hover) se usan tal cual,
     rgb(var(--x)); no admiten otra transparencia encima. */

  /* Tipografía */
  --cu-fuente: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cu-fuente-titulos: "Montserrat", "Inter", system-ui, sans-serif;
  --cu-fuente-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --cu-t-base: .8125rem;

  /* Medidas */
  --cu-ancho-menu: 15rem;
  --cu-ancho-menu-plegado: 5rem;
  --cu-alto-cabecera: 3.75rem;
  --cu-radio: .5rem;
  --cu-radio-sm: .25rem;
  --cu-radio-control: .35rem;
  --cu-sombra-caja: 0 .125rem 0 rgb(10 10 10 / .04);
  --cu-sombra-flotante: 0 .25rem 1.5rem rgb(0 0 0 / .1);
  --cu-sombra-grande: 0 1rem 3rem rgb(0 0 0 / .175);
  --cu-transicion: .2s ease;

  color-scheme: light;
}

/* ─── Tema oscuro ─────────────────────────────────────────────────────────────────────────── */
:root[data-cu-tema="oscuro"] {
  --cu-fondo: 26 28 30;
  --cu-superficie: 37 39 41;
  --cu-fondo-suave: 43 46 49;
  --cu-hover: 43 46 49;
  --cu-texto: 222 224 228;
  --cu-titulo: 245 246 248;
  --cu-apagado: 160 165 175;
  --cu-borde: 255 255 255 / .1;
  --cu-borde-entrada: 255 255 255 / .1;
  --cu-entrada-fondo: 35 38 40;
  --cu-claro: 43 46 49;
  --cu-oscuro: 240 245 248;
  --cu-menu-fondo: 37 39 41;
  --cu-cabecera-fondo: 37 39 41;
  --cu-cabecera-texto: 200 205 215;
  --cu-cabecera-borde: 255 255 255 / .1;
  --cu-cabecera-hover: 255 255 255 / .06;
  --cu-sombra-caja: 0 .125rem 0 rgb(0 0 0 / .2);
  --cu-sombra-flotante: 0 .25rem 1.5rem rgb(0 0 0 / .45);
  color-scheme: dark;
}

/* ─── Colores del menú lateral ───────────────────────────────────────────────────────────── */
:root[data-cu-menu="claro"] {
  --cu-menu-fondo: var(--cu-superficie);
  --cu-menu-texto: 83 100 133;
  --cu-menu-activo: var(--cu-primario);
  --cu-menu-borde: var(--cu-borde);
  --cu-menu-hover: var(--cu-primario) / .05;
}
:root[data-cu-tema="oscuro"][data-cu-menu="claro"] { --cu-menu-texto: 190 195 205; }
:root[data-cu-menu="color"] {
  --cu-menu-fondo: var(--cu-primario);
  --cu-menu-texto: 255 255 255 / .75;
  --cu-menu-activo: 255 255 255;
}
:root[data-cu-menu="degradado"] {
  --cu-menu-texto: 255 255 255 / .75;
  --cu-menu-activo: 255 255 255;
}
:root[data-cu-menu="transparente"] {
  --cu-menu-fondo: var(--cu-fondo);
  --cu-menu-texto: 83 100 133;
  --cu-menu-activo: var(--cu-primario);
  --cu-menu-borde: var(--cu-borde);
  --cu-menu-hover: var(--cu-primario) / .05;
}
:root[data-cu-tema="oscuro"][data-cu-menu="transparente"] { --cu-menu-texto: 190 195 205; }

/* ─── Colores de la cabecera ─────────────────────────────────────────────────────────────── */
:root[data-cu-cabecera="oscuro"], :root[data-cu-cabecera="color"], :root[data-cu-cabecera="degradado"] {
  --cu-cabecera-hover: 255 255 255 / .1;
}
:root[data-cu-cabecera="oscuro"] {
  --cu-cabecera-fondo: 17 28 67;
  --cu-cabecera-texto: 255 255 255 / .8;
  --cu-cabecera-borde: 255 255 255 / .1;
}
:root[data-cu-tema="oscuro"][data-cu-cabecera="oscuro"] { --cu-cabecera-fondo: 37 39 41; }
:root[data-cu-cabecera="color"] {
  --cu-cabecera-fondo: var(--cu-primario);
  --cu-cabecera-texto: 255 255 255 / .9;
  --cu-cabecera-borde: 255 255 255 / .1;
}
:root[data-cu-cabecera="degradado"] {
  --cu-cabecera-texto: 255 255 255 / .9;
  --cu-cabecera-borde: 255 255 255 / .1;
}
:root[data-cu-cabecera="transparente"] {
  --cu-cabecera-fondo: var(--cu-fondo);
}

/* ─── Reinicio y tipografía ──────────────────────────────────────────────────────────────── */
/* Los valores por defecto de los elementos van con :where(.cu-raiz), que no suma especificidad: así cualquier
   clase (u-fs-16, cu-caja-titulo…) gana a «h1 mide 2,5 rem» sin !important. */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body.cu, .cu-raiz {
  margin: 0;
  font-family: var(--cu-fuente);
  font-size: var(--cu-t-base);
  font-weight: 400;
  line-height: 1.5;
  color: rgb(var(--cu-texto));
  background: rgb(var(--cu-fondo));
  -webkit-font-smoothing: antialiased;
}
:where(.cu-raiz) h1, :where(.cu-raiz) h2, :where(.cu-raiz) h3, :where(.cu-raiz) h4, :where(.cu-raiz) h5, :where(.cu-raiz) h6 {
  margin: 0 0 .5rem; font-weight: 600; line-height: 1.2; color: rgb(var(--cu-titulo));
}
:where(.cu-raiz) h1 { font-size: 2.5rem; } :where(.cu-raiz) h2 { font-size: 2rem; } :where(.cu-raiz) h3 { font-size: 1.75rem; }
:where(.cu-raiz) h4 { font-size: 1.5rem; } :where(.cu-raiz) h5 { font-size: 1.25rem; } :where(.cu-raiz) h6 { font-size: 1rem; }
:where(.cu-raiz) p { margin: 0 0 1rem; }
:where(.cu-raiz) p:last-child { margin-bottom: 0; }
:where(.cu-raiz) a { color: rgb(var(--cu-primario)); text-decoration: none; }
:where(.cu-raiz) a:hover { color: rgb(var(--cu-primario) / .85); }
:where(.cu-raiz) img, :where(.cu-raiz) svg { vertical-align: middle; }
:where(.cu-raiz) img { max-width: 100%; }
:where(.cu-raiz) hr { border: 0; border-top: 1px solid rgb(var(--cu-borde)); margin: 1rem 0; }
:where(.cu-raiz) ::selection { background: rgb(var(--cu-primario) / .2); }
:where(.cu-raiz) :focus-visible { outline: 2px solid rgb(var(--cu-primario) / .5); outline-offset: 2px; }
:where(.cu-raiz) code { font-family: var(--cu-fuente-mono); font-size: .8125em; color: rgb(var(--cu-rosa)); }
:where(.cu-raiz) pre { font-family: var(--cu-fuente-mono); font-size: .75rem; background: rgb(var(--cu-fondo-suave)); padding: 1rem; border-radius: var(--cu-radio); overflow: auto; }
:where(.cu-raiz) kbd { font: 500 .75rem/1 var(--cu-fuente-mono); padding: .2rem .4rem; border-radius: .25rem; background: rgb(var(--cu-oscuro)); color: rgb(var(--cu-superficie)); }
:where(.cu-raiz) mark { background: rgb(var(--cu-aviso) / .3); color: inherit; padding: 0 .2em; }
:where(.cu-raiz) small { font-size: .875em; }
:where(.cu-raiz) ul, :where(.cu-raiz) ol { padding-inline-start: 1.25rem; margin: 0 0 1rem; }

/* Barras de desplazamiento finas, como en la referencia */
:where(.cu-raiz) ::-webkit-scrollbar { width: .35rem; height: .35rem; }
:where(.cu-raiz) ::-webkit-scrollbar-thumb { background: rgb(var(--cu-apagado) / .3); border-radius: 1rem; }
:where(.cu-raiz) ::-webkit-scrollbar-track { background: transparent; }

.cu-solo-lectores {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  :where(.cu-raiz) *, :where(.cu-raiz) *::before, :where(.cu-raiz) *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
