/* =====================================================================
   base.css — reset, tipografía de 4 niveles, formularios nativos, utilidades
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--fuente);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--c-texto);
  background: var(--c-fondo);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img, svg, video, canvas, picture { display: block; max-width: 100%; }
img { height: auto; }
a > svg, button > svg, span > svg, p > svg, li > svg, label > svg { display: inline-block; }

h1, h2, h3 {
  margin: 0 0 var(--sp-3);
  line-height: var(--lh-titulo);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4, h5, h6 { margin: 0 0 var(--sp-2); font-size: var(--fs-md); line-height: var(--lh-titulo); }

p { margin: 0 0 var(--sp-3); }
ul, ol { margin: 0 0 var(--sp-3); padding-left: var(--sangria-lista); }
/* Una lista con clase es un componente de interfaz: arranca sin viñetas, margen ni sangría (cada componente pone lo suyo).
   .lista-marcas le devuelve viñetas o números a una lista con clase que sí es texto con puntos. */
:where(ul, ol)[class] { list-style: none; margin: 0; padding: 0; }
.lista-marcas { list-style: revert; margin: 0 0 var(--sp-3); padding-left: var(--sangria-lista); }
small { font-size: var(--fs-xs); }
strong, b { font-weight: 700; }
hr { border: 0; border-top: var(--borde); margin: var(--sp-4) 0; }

a {
  color: var(--c-enlace);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--c-foco);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: var(--control-alto);
  padding: var(--sp-em-3) var(--sp-em-4) var(--sp-em-3) var(--control-pad-izq, var(--sp-em-4)); /* --control-pad-izq: espacio para un icono dentro del campo */
  border: 1px solid var(--c-borde-fuerte);
  border-radius: var(--r-2);
  background-color: var(--c-superficie-hundida);
  color: var(--c-texto);
  font-size: var(--fs-md);
  line-height: 1.35;
  transition: border-color var(--transicion), box-shadow var(--transicion);
}
textarea { min-height: 6.5em; resize: vertical; }
select { padding-right: var(--hueco-control); }
input::placeholder, textarea::placeholder { color: var(--c-texto-suave); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--c-texto-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--c-foco);
  outline-offset: 0;
  border-color: var(--c-foco);
}
input:disabled, select:disabled, textarea:disabled {
  border-color: var(--c-borde);
  color: var(--c-texto-suave);
  cursor: not-allowed;
}
input[type="checkbox"], input[type="radio"] {
  width: 1.15em;
  height: 1.15em;
  margin: 0;
  accent-color: var(--c-acento-solido);
  flex: none;
}
input[type="range"] { width: 100%; accent-color: var(--c-acento-solido); }
input[type="number"] { font-variant-numeric: tabular-nums; }

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; margin-bottom: var(--sp-2); }
label { cursor: default; }
details > summary { cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
dialog { color: inherit; }

[hidden] { display: none !important; }

/* ---------- Utilidades ---------- */
.visualmente-oculto {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.saltar-contenido {
  position: absolute;
  left: var(--sp-2);
  top: -10rem;
  z-index: var(--z-toast);
  display: inline-flex;
  align-items: center;
  min-height: var(--tactil);
  padding: var(--sp-2) var(--sp-3);
  background: var(--c-acento-solido);
  color: var(--c-sobre-solido);
  border-radius: var(--r-2);
}
.saltar-contenido:focus { top: var(--sp-2); }

.contenedor {
  width: min(var(--ancho-max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.pila { display: flex; flex-direction: column; gap: var(--pila-espacio, var(--sp-4)); }
.pila--sm { --pila-espacio: var(--sp-2); }
.pila--lg { --pila-espacio: var(--sp-6); }
.fila { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fila-espacio, var(--sp-2)); }
.fila--entre { justify-content: space-between; }
.fila--arriba { align-items: flex-start; }
.crece { flex: 1 1 auto; min-width: 0; }
.pantalla-centrada { display: grid; place-items: center; min-height: 100dvh; padding: var(--gutter); } /* ingreso y páginas de error */

.texto-suave { color: var(--c-texto-suave); }
.texto-sm { font-size: var(--fs-sm); }
.texto-xs { font-size: var(--fs-xs); }
.texto-centro { text-align: center; }
.texto-derecha { text-align: right; }
.negrita { font-weight: 700; }
.numero { font-variant-numeric: tabular-nums; }
.sin-margen { margin: 0; }
.truncar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mono { font-family: var(--fuente-mono); }
.texto-ok { color: var(--c-ok); }
.texto-peligro { color: var(--c-peligro); }
.texto-alerta { color: var(--c-alerta); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body { background: var(--doc-papel); }
}
