/* =============================================================
   BASE — reset, tipografia y elementos globales
   ============================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Compensa la navbar fija al saltar a un ancla */
  scroll-padding-top: calc(var(--header-h-scrolled) + 1.5rem);
}

body {
  margin: 0;
  background-color: var(--c-white);
  color: var(--c-ink);
  font-family: var(--f-sans);
  font-size: var(--t-base);
  font-weight: 400;
  line-height: var(--lh-body);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Ninguna composicion debe generar scroll lateral */
  overflow-x: hidden;
}

/* Bloquea el scroll con el menu movil abierto */
body.is-locked {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--f-serif);
  font-weight: var(--w-serif-mid);
  font-optical-sizing: auto;
  line-height: var(--lh-title);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--t-h1);
  line-height: var(--lh-tight);
}
h2 {
  font-size: var(--t-h2);
}
h3 {
  font-size: var(--t-h3);
}

p,
blockquote,
figure,
dl,
dd {
  margin: 0;
}

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

/* Contenido de respaldo sin JavaScript */
noscript dl dt {
  margin-top: 2rem;
  font-family: var(--f-serif);
  font-size: var(--t-xl);
}

noscript dl dd {
  max-width: 62ch;
  margin-top: 0.5rem;
  color: var(--c-grey-700);
}

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

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

img {
  height: auto;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

address {
  font-style: normal;
}

::selection {
  background: var(--c-ink);
  color: var(--c-white);
}

/* ---------- Foco visible y accesible en toda la web ---------- */
:focus-visible {
  outline: 2px solid var(--c-ink);
  outline-offset: 3px;
  border-radius: 1px;
}

.on-dark :focus-visible,
.footer :focus-visible {
  outline-color: var(--c-white);
}

/* ---------- Utilidades ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 200;
  transform: translate(-50%, -140%);
  padding: 0.75rem 1.5rem;
  background: var(--c-ink);
  color: var(--c-white);
  font-size: var(--t-sm);
  transition: transform var(--d-fast) var(--ease);
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
  outline-color: var(--c-white);
  outline-offset: -6px;
}

/* ---------- Movimiento reducido ---------- */
@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;
    scroll-behavior: auto !important;
  }
}
