/* ==========================================================================
   02 · BASE
   Reinicio, tipografía y elementos HTML sin clases.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* Rejilla técnica muy tenue, como el plano de un taller */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}

main { flex: 1; padding-bottom: var(--sp-8); }
.page-flush main { padding-bottom: 0; }

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

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--accent-text-hover); }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .005em;
  margin: 0 0 .5em;
  color: var(--text);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }

small { font-size: var(--fs-sm); }

code, kbd, pre { font-family: var(--font-mono); font-size: .88em; }
code {
  background: var(--surface-3);
  border: 1px solid var(--line);
  padding: .05em .4em;
  border-radius: var(--radius);
}

hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }

ul, ol { padding-left: 1.2em; }

table { border-collapse: collapse; width: 100%; }

button { font: inherit; color: inherit; }

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

:focus-visible {
  outline: 2px solid var(--ion);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* Desplazamiento */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* Accesibilidad */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: var(--sp-2) var(--sp-4);
  font-weight: 600;
}
.skip-link:focus { top: var(--sp-3); color: var(--accent-ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
