/* Reset y tokens de diseño */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Tipografía */
  --ff: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Helvetica, Arial, sans-serif;
  --ff-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  /* Escala de espaciado */
  --s1: 0.25rem;  --s2: 0.5rem;   --s3: 0.75rem;  --s4: 1rem;
  --s5: 1.25rem;  --s6: 1.5rem;   --s8: 2rem;     --s10: 2.5rem;
  --s12: 3rem;    --s16: 4rem;    --s20: 5rem;    --s24: 6rem;

  /* Radios */
  --r-sm: 4px;  --r-md: 8px;  --r-lg: 12px;  --r-xl: 16px;
  --r-2xl: 24px;  --r-full: 9999px;

  /* Transiciones */
  --t-fast: 150ms ease;
  --t-base: 250ms ease;
  --t-slow: 400ms ease;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgb(0 0 0 / .08), 0 1px 2px rgb(0 0 0 / .06);
  --shadow-md: 0 4px 12px rgb(0 0 0 / .10), 0 2px 4px rgb(0 0 0 / .06);
  --shadow-lg: 0 10px 30px rgb(0 0 0 / .12), 0 4px 8px rgb(0 0 0 / .06);
  --shadow-xl: 0 20px 50px rgb(0 0 0 / .15), 0 8px 16px rgb(0 0 0 / .08);

  /* Layout */
  --max-w: 1280px;
  --gutter: clamp(1rem, 5vw, 2rem);
  --header-h: 64px;
}

html {
  font-family: var(--ff);
  font-size: 16px;
  line-height: 1.65;
  color: var(--c-text);
  background-color: var(--c-bg);
  transition: background-color var(--t-base), color var(--t-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--c-bg);
}

main { flex: 1; }

/* Enlace de salto para accesibilidad */
.skip-link {
  position: absolute;
  top: -999px;
  left: var(--s2);
  padding: var(--s2) var(--s4);
  background: var(--c-primary);
  color: var(--c-primary-fg);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
}
.skip-link:focus { top: var(--s2); }

/* Tipografía base */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--c-text);
}

h1 { font-size: clamp(1.875rem, 4vw + 1rem, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3vw + 0.5rem, 2.25rem); }
h3 { font-size: clamp(1.125rem, 2vw + 0.25rem, 1.5rem); }
h4 { font-size: 1.125rem; }

p { color: var(--c-text-2); max-width: 70ch; }

a { color: var(--c-primary); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--c-primary-2); }

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

ul, ol { list-style: none; }

button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* Foco visible accesible */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

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