/* ═══════════════════════════════════════════════════════════════════
   BASE — reset, tipografía global y utilidades.
   ═══════════════════════════════════════════════════════════════════ */

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

html {
  scroll-behavior: smooth;
  /* Compensa la barra fija al saltar a un ancla */
  scroll-padding-top: 5.5rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { line-height: var(--lh-tight); font-weight: var(--fw-bold); letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }

p { color: var(--text-dim); }

ul { list-style: none; }

/* Foco visible y consistente en todo lo interactivo */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

::selection { background: var(--accent); color: var(--on-accent); }

/* ── Utilidades de layout ───────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container-narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--section-gap); }

/* Solo para lectores de pantalla */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.accent { color: var(--accent); }

/* ── Animación de entrada al hacer scroll (js/reveal.js) ──────
   Mejora progresiva: los bloques solo se ocultan si el JS está activo y
   va a poder mostrarlos (la clase .js la agrega el script en línea de
   index.html). Sin JS, la página se ve completa. */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--t-med), transform var(--t-med);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
