/* Reset + fundamentos. Mobile-first. Modo oscuro por defecto (la marca es negra). */

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

/* figure trae un margen del user-agent (~1em arriba/abajo, 40px a los lados, igual que
   blockquote) que nunca se reseteaba acá — dentro de un grid (.gallery, .sobre-grid,
   .servicio-detalle) eso comía 80px del ancho real de la columna sin que ninguna otra regla lo
   explicara. Encontrado al depurar el recorte de la galería de home, pero el mismo reset general
   evita que reaparezca en cualquier otro figure de la plantilla. */
figure {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 400;
  line-height: 1;
}

p {
  margin: 0;
}

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

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

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

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

/* Foco visible (AA): nunca se suprime el outline, solo se estiliza. */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

/* Skip link — primer elemento del body, visible solo al enfocar */
.skip-link {
  position: absolute;
  z-index: 100;
  top: -100%;
  left: var(--space-4);
  /* --color-accent-button, no --color-accent: mismo problema de contraste que .btn--accent
     (ver components.css) — texto blanco encima, por debajo de "texto grande" AA. */
  background: var(--color-accent-button);
  color: #fff;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* El header es fixed (alto variable: --header-h en tokens.css, depende del tamaño del
   logo): todo el contenido empieza debajo salvo el hero, que lo compensa con un margen
   negativo (ver .hero en components.css) para poder ocupar toda la pantalla. */
main {
  padding-top: var(--header-h);
}

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

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

h1,
.h1,
h2,
.h2 {
  font-family: var(--font-impact);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

h1,
.h1 {
  font-size: var(--text-h1);
}

h2,
.h2 {
  font-size: var(--text-h2);
  margin-bottom: var(--space-8);
}

h3,
.h3 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-h3);
  text-transform: none;
}

.lead {
  font-family: var(--font-display);
  font-size: var(--text-lead);
  color: var(--color-text-secondary);
  max-width: 62ch;
}

.muted {
  color: var(--color-text-secondary);
}

.accent {
  color: var(--color-accent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Landmarks: separación mínima entre secciones consecutivas */
main > section + section {
  border-top: 1px solid var(--color-border);
}

/* ---------- Utilidades de espaciado/ratio ----------
 * Sustituyen los style="" inline puntuales que había en las plantillas (margin y aspect-ratio):
 * con estas clases, style-src en la CSP (scripts/build.js buildHeadersFile) ya no necesita
 * 'unsafe-inline'. Set cerrado, no un framework de utilidades: solo los valores que de verdad
 * se usan (ver template/*.njk y template/lib/render-helpers.js picture()). */
.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mt-12 {
  margin-top: var(--space-12);
}

.m-0 {
  margin: 0;
}

.ratio-1-1 {
  aspect-ratio: 1 / 1;
}

.ratio-4-3 {
  aspect-ratio: 4 / 3;
}

.ratio-4-5 {
  aspect-ratio: 4 / 5;
}

.ratio-16-9 {
  aspect-ratio: 16 / 9;
}

.ratio-5-3 {
  aspect-ratio: 5 / 3;
}
