/* ==========================================================================
   PARCHE CAMALEÓN — BASE
   Reset, tipografía por defecto, foco, y accesibilidad transversal.
   Depende de tokens.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1 · RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

/* `hidden` en html y `clip` en body: `overflow-x: hidden` en body lo
   convierte en contenedor de scroll y los eventos dejan de propagar a
   window. `clip` recorta sin crear ese contenedor. Diagnóstico de Fase 2,
   vigente en producción. */
/* [04/11/2026] El sitio es de un solo tema: que el navegador no lo oscurezca
   por su cuenta (Chrome en Android con el modo oscuro del sistema). Cristian
   lo vio en la revisión. Va también como <meta>, para que no parpadee. */
:root { color-scheme: only light; }

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  /* Compensa la barra fija al saltar a un ancla */
  scroll-padding-top: calc(var(--nav-height) + var(--space-6));
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: clip;
  min-height: 100svh;
  background: var(--surface-base);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

img,
video { height: auto; }

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

button { background: none; border: none; }

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

/* --------------------------------------------------------------------------
   2 · TIPOGRAFÍA POR DEFECTO
   Los elementos nacen con la escala correcta: una sección no debería
   necesitar declarar tamaño salvo que se salga del sistema.
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-weight: var(--fw-bold);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-title-hero);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-display);
  letter-spacing: var(--tracking-display);
}

h2 {
  font-size: var(--fs-title-section);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-heading);
}

h3 {
  font-size: var(--fs-title-card);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tight);
}

p { text-wrap: pretty; }

strong,
b { font-weight: var(--fw-semibold); }

/* Highlight de marca: SemiBold Italic (DS §2.3) */
em.highlight,
.u-highlight {
  font-style: italic;
  font-weight: var(--fw-semibold);
}

/* Antetítulo de sección. Excepción de accesibilidad documentada (DS §2.4):
   13px SemiBold en clay da 4,27:1 sobre cream, 3,69:1 sobre mint y 3,63:1
   sobre peach — por debajo del umbral de texto. Se acepta porque es un
   rótulo de una línea con tracking amplio que NUNCA carga información
   única: el dato siempre se repite en el titular que le sigue. Por eso va
   marcado `aria-hidden` cuando duplica literalmente el h2. */
.eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-eyebrow);
}

a {
  color: inherit;
  text-decoration-color: var(--color-orange-ui);
  text-underline-offset: 4px;
}

/* [21/09/2026] Solo con cursor — regla dura 20: en táctil el toque deja
   `:hover` pegado y el enlace se quedaba naranja. */
@media (hover: hover) {
  a:hover { color: var(--color-orange-deep); }
}

/* orange-deep es el único naranja que soporta texto encima: 4,81:1 */
::selection {
  background: var(--color-orange-deep);
  color: var(--color-cream);
}

/* --------------------------------------------------------------------------
   3 · FOCO — WCAG 2.4.7
   Un solo anillo para todo el sitio. Ningún componente puede anularlo:
   si un control necesita otro tratamiento, redefine --focus-ring, no el
   outline. La regla `:focus-visible` no alcanza sola — Safari <15.4 y los
   controles con `all: unset` pierden el indicador nativo.
   -------------------------------------------------------------------------- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* Sobre fondos oscuros el anillo forest desaparece: se invierte a peach */
.section--dark :where(a, button, input, select, textarea, [tabindex]):focus-visible,
.u-on-dark    :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline-color: var(--focus-ring-on-dark);
}

/* --------------------------------------------------------------------------
   4 · SALTO AL CONTENIDO — WCAG 2.4.1
   Primer elemento tabulable del documento.
   -------------------------------------------------------------------------- */
.skip-link {
  /* `fixed`, no `absolute`: con `absolute` el enlace se va con el scroll y
     deja de ser alcanzable en cuanto la página no está arriba del todo. */
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 200;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--surface-dark);
  color: var(--text-on-dark);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transform: translateY(calc(-100% - var(--space-4)));
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--text-on-dark);
  outline-color: var(--focus-ring-on-dark);
}

/* --------------------------------------------------------------------------
   5 · UTILIDADES DE ACCESIBILIDAD
   -------------------------------------------------------------------------- */

/* Visible solo para tecnología asistiva */
.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Área táctil mínima 44×44 sin alterar el tamaño visual del control */
.u-target::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}

/* --------------------------------------------------------------------------
   6 · MOVIMIENTO REDUCIDO — WCAG 2.3.3
   El contenido aparece completo y sin desplazamiento. Se conserva un
   remanente de 1ms en vez de 0 para que los eventos `transitionend` de los
   que depende la lógica sigan disparando.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   7 · IMPRESIÓN
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .skip-link,
  [data-motion] { display: none !important; }

  /* Tinta negra, no color de marca: `black` en vez de un hex suelto
     mantiene la regla de «ningún hexadecimal fuera de tokens.css». */
  body { background: none; color: black; }
}
