/* ==========================================================================
   BASE — reset mínimo, tipografía y utilidades de página.
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bnav-h) + 6px);
}

@media (min-width: 900px) {
  body { padding-bottom: 0; }
}

img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; }

h1, h2, h3, h4, .num { font-family: var(--font-d); letter-spacing: -.01em; }
h1 { font-size: 2.1rem; line-height: 1.12; font-weight: 700; }
h2 { font-size: 1.65rem; line-height: 1.2; font-weight: 700; margin-bottom: .6rem; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }

::selection { background: var(--bg3); color: var(--text); }

/* Foco visible propio del sistema, nunca el azul del navegador. */
:where(a, button, input, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--azure);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Contenedores --- */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--sp-5); }
.narrow { max-width: 720px; }
section { padding: 56px 0; }
.lead { font-size: 1.05rem; max-width: 560px; }

/* Cabecera de página interior. Va en el MISMO elemento que .wrap, así que hay
   que tocar solo el eje vertical: con el atajo `padding` se perdía el margen
   lateral de .wrap y en móvil el texto quedaba pegado al borde. */
.pg { padding-block: 28px 60px; }
.pg-head { margin-bottom: 22px; }
.pg-head p { max-width: 600px; }

/* `flex-wrap`: el título de sección y su distintivo («1 clase gratis», «Ver
   todo») compartían línea a la fuerza. En móvil el distintivo acababa pegado al
   borde y, con un título largo, estrujado hasta partirse. Si no caben juntos,
   el distintivo baja. */
.sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--sp-2) var(--sp-4); }
.sec-head > :first-child { min-width: 0; }
.sec-head a { color: var(--blue-txt); font-weight: 600; font-size: .9rem; white-space: nowrap; }

/* --- Iconos (Lucide) --- */
.icono { flex: none; display: block; }

/* --- Textos que se acortan en pantallas angostas ---
   En la cabecera de móvil el espacio se lo queda el logotipo completo, así que
   la acción principal se queda en icono. Sigue teniendo nombre accesible y
   justo debajo, en la portada, está el mismo botón con todas sus letras. */
.solo-ancho-txt { display: none; }
@media (min-width: 600px) {
  .solo-ancho-txt { display: inline; }
}

/* --- Botón cuadrado solo-icono y selector de tema ---
   Viven aquí, y no en componentes.css, porque los usan tanto el sitio público
   como el panel, y el panel no carga componentes.css. */
.btn-icono {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--rs);
  background: var(--card); color: var(--muted);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.btn-icono:hover { color: var(--blue-txt); border-color: var(--azure); }

.tema [data-estado] { display: none; }
:root[data-theme="light"] .tema [data-estado="claro"],
:root[data-theme="dark"] .tema [data-estado="oscuro"],
:root:not([data-theme]) .tema [data-estado="auto"] { display: block; }

/* --- Desplazamiento sin barra a la vista ---
   La barra del sistema es cromo del navegador y ensucia tiras de pestañas,
   filtros y menús. Se oculta, pero el contenedor SIGUE desplazándose: con
   rueda, con gesto táctil y con teclado. El contenido cortado en el borde es
   el que avisa de que hay más.

   No se usa en tablas de datos: ahí la barra es información, no adorno. */
.sin-barra { scrollbar-width: none; -ms-overflow-style: none; }
.sin-barra::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* --- Enlace de salto para lectores de pantalla y teclado --- */
.salto {
  position: absolute;
  left: var(--sp-4);
  top: -60px;
  z-index: 100;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 10px 16px;
  font-weight: 600;
  transition: top .15s;
}
.salto:focus { top: var(--sp-4); }

.vo {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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