/* =============================================================
   BASE (base.css)
   Reset moderno + tipografía fluida + accesibilidad base.
   Mobile First. Depende de variables.css.
   ============================================================= */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px; /* compensa el header sticky en anclas */
  overflow-x: hidden; /* evita scroll horizontal por el truco full-bleed (100vw) del header/footer */
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

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

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

/* ---------- Tipografía ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--color-text);
  text-wrap: balance;
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p { max-width: 65ch; }

a {
  color: var(--color-primary-dark);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-cta); }

ul, ol { padding-left: 1.25rem; }

strong { font-weight: var(--fw-semibold); }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

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

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

.section--alt { background-color: var(--color-surface-alt); }

/* ---------- Accesibilidad ---------- */

/* Foco visible y consistente en todo el sitio */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Enlace "saltar al contenido" para lectores de pantalla / teclado */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-modal);
  padding: var(--space-2xs) var(--space-xs);
  background: var(--color-text);
  color: var(--color-text-invert);
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

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

/* Respeta la preferencia de reducir movimiento */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
