/* ==========================================================================
   base.css — Capa 2: Reset y elementos HTML desnudos
   --------------------------------------------------------------------------
   Solo selectores de elemento. Nada de clases: eso vive en components.css.
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  /* Compensa el header fijo al saltar a un ancla */
  scroll-padding-top: calc(var(--header-height) + var(--space-sm));
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text-body);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Red de seguridad contra desbordes horizontales en pantallas estrechas */
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  color: var(--color-text-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

h4 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: normal;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-color: var(--color-accent-line);
  text-underline-offset: 0.2em;
}

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

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

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

strong {
  color: var(--color-text-heading);
  font-weight: var(--weight-semibold);
}

address {
  font-style: normal;
}

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

:focus:not(:focus-visible) {
  outline: none;
}

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

/* Respeto por quien pide menos movimiento.
   Las duraciones se neutralizan en tokens.css sobrescribiendo los tokens de
   movimiento: así no hace falta un solo !important en toda la hoja. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
