/* ============================================================
   base.css — reset, fuentes autohospedadas, tipografía,
   elementos nativos. Sección 4.2 de la especificación.
   ============================================================ */

/* ---------- Fuentes autohospedadas -------------------------
   Solo el subset latino, que es lo único que necesita el
   español, y recortadas a los ejes que la página usa de verdad
   (sección 4.2). Las variables completas de Google pesan 254 kB
   entre las tres; así quedan en 131 kB.

   Los rangos de font-weight y font-stretch de acá abajo tienen
   que coincidir con los de herramientas/instanciar_fuentes.py.
   Si pedís un peso fuera de rango, el navegador lo sintetiza y
   se nota.
   ----------------------------------------------------------- */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fuentes/bricolage-grotesque-latin-var.woff2") format("woff2");
  font-weight: 700 800;
  font-stretch: 90% 100%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Archivo";
  src: url("../fuentes/archivo-latin-var.woff2") format("woff2");
  font-weight: 400 600;
  font-stretch: 100%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Martian Mono";
  src: url("../fuentes/martian-mono-latin-var.woff2") format("woff2");
  font-weight: 500;
  font-stretch: 100%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Reset ------------------------------------------ */

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

* {
  margin: 0;
}

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

body {
  min-height: 100svh;
  background-color: var(--tinta);
  color: var(--papel);
  font-family: var(--f-cuerpo);
  font-size: var(--t-cuerpo);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
}

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

button {
  background: none;
  border: none;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

/* Evita que una URL larga o un nombre sin espacios rompa el layout */
p,
h1,
h2,
h3,
h4,
li,
figcaption {
  overflow-wrap: break-word;
}

/* ---------- Escala tipográfica (sección 4.2) ---------------- */

.t-display {
  font-family: var(--f-display);
  font-size: var(--t-display);
  font-weight: 800;
  /* Ancho expandido: el máximo del eje wdth de Bricolage. */
  font-variation-settings: "wdth" 100, "opsz" 96;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.t-seccion {
  font-family: var(--f-display);
  font-size: var(--t-seccion);
  font-weight: 700;
  /* Ancho normal, un escalón por debajo del titular. */
  font-variation-settings: "wdth" 90, "opsz" 40;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.t-tarjeta {
  font-family: var(--f-cuerpo);
  font-size: var(--t-tarjeta);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.t-cuerpo {
  font-size: var(--t-cuerpo);
  line-height: 1.65;
}

.t-chico {
  font-size: var(--t-chico);
  line-height: 1.6;
}

.t-etiqueta {
  font-family: var(--f-mono);
  font-size: var(--t-etiqueta);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.08em;
  color: var(--papel-tenue);
}

/* Encabezados nativos: heredan de las clases, nunca del navegador */
h1,
h2,
h3,
h4 {
  font-family: var(--f-display);
  font-weight: 700;
  text-wrap: balance;
}

/* Ancho máximo de línea en párrafos (sección 4.2) */
p {
  max-width: 65ch;
  color: var(--papel-tenue);
}

/* ---------- Elementos nativos ------------------------------ */

a {
  color: var(--violeta-alto);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-rapida) var(--ease);
}

a:hover {
  color: var(--papel);
}

strong,
b {
  font-weight: 600;
  color: var(--papel);
}

hr {
  border: none;
  border-top: 1px solid var(--tinta-borde);
}

::selection {
  background: var(--violeta);
  color: var(--papel);
}

/* ---------- Foco visible (sección 8, obligatorio) ----------- */

:focus-visible {
  outline: 2px solid var(--violeta-alto);
  outline-offset: 2px;
  border-radius: 2px;
}

/* No remover nunca. Solo se apaga el anillo por mouse, no por teclado. */
:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- Utilidades ------------------------------------- */

/* Texto solo para lectores de pantalla */
.solo-lectores {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Saltar al contenido (sección 10) */
.saltar {
  position: absolute;
  top: var(--e-4);
  left: var(--e-4);
  z-index: 200;
  padding: var(--e-3) var(--e-5);
  background: var(--tinta-alta);
  border: 1px solid var(--violeta);
  border-radius: var(--radio-pildora);
  color: var(--papel);
  font-family: var(--f-mono);
  font-size: var(--t-etiqueta);
  letter-spacing: 0.08em;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-rapida) var(--ease);
}

.saltar:focus-visible {
  transform: translateY(0);
}

/* ---------- Movimiento reducido (sección 8) ----------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
