/* ============================================================
   TRAZO — Tokens, reset y tipografía base
   Paleta y escala definidas tras la reunión con Isabela.
   ============================================================ */

:root {
  /* --- Paleta oficial --- */
  --hueso: #F2EFEB;        /* fondo predominante */
  --taupe: #BFB0A1;        /* superficies secundarias, bordes, etiquetas */
  --lima: #E8F0A7;         /* acento puntual: nunca dominante */
  --oliva: #A6A69C;        /* líneas, decoración, baja jerarquía */
  --tinta: #1C2120;        /* negro verdoso: texto, títulos, navegación */

  /* Componentes RGB para transparencias */
  --tinta-rgb: 28 33 32;
  --hueso-rgb: 242 239 235;
  --taupe-rgb: 191 176 161;
  --lima-rgb: 232 240 167;
  --oliva-rgb: 166 166 156;

  /* Derivados. Las opacidades de texto están calibradas sobre hueso y taupe
     para superar 4.5:1; ver la auditoría de contraste del QA. */
  --papel: var(--hueso);
  --papel-alto: #FAF8F5;
  --texto-2: rgb(var(--tinta-rgb) / 0.78);
  --texto-3: rgb(var(--tinta-rgb) / 0.74);
  /* Derivados oficiales del taupe para texto. El taupe puro (#BFB0A1) sobre hueso
     se queda en 1.8:1 y no es legible: estos dos son sus versiones oscurecidas.
     --taupe-texto para trazos y detalles; --taupe-texto-sm para numerales y texto. */
  --taupe-texto: #8A7F72;
  --taupe-texto-sm: #6F665C;
  --linea: rgb(var(--tinta-rgb) / 0.13);
  --linea-media: rgb(var(--taupe-rgb) / 0.85);

  /* --- Tipografía --- */
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-firma: "Caveat", "Segoe Script", "Bradley Hand", cursive;

  --fs-eyebrow: 0.8125rem;   /* 13px: suelo de legibilidad */
  --fs-small: 0.9375rem;     /* 15px */
  --fs-body: 1.0625rem;
  --fs-body-lg: clamp(1.125rem, 0.45vw + 1.03rem, 1.375rem);
  --fs-h3: clamp(1.15rem, 0.6vw + 1rem, 1.45rem);
  --fs-h2: clamp(1.95rem, 2.9vw + 1.1rem, 3.5rem);
  --fs-h1: clamp(2.7rem, 5vw + 0.9rem, 5.25rem);
  --fs-display: clamp(3.5rem, 13vw, 11rem);   /* palabra-recurso a gran escala */

  /* --- Ritmo y medidas --- */
  --ancho-max: 1240px;
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --espacio-seccion: clamp(4.5rem, 8.5vw, 8.5rem);
  --radio: 2px;
  --radio-lg: 4px;

  /* --- Movimiento (lento y discreto) --- */
  --t-suave: 400ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-lento: 850ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset acotado ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  /* Hueso + grano de papel muy tenue: materialidad sin efectos pesados */
  background-color: var(--papel);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
  color: var(--tinta);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Sin overflow-x aquí: tanto `hidden` como `clip` en el body lo convierten en
     contenedor de scroll (window.scrollTo deja de funcionar, scrollY queda en 0 y
     los anclajes se pasan de largo). Cada sección que sangra recorta lo suyo. */
}

img,
svg { display: block; max-width: 100%; }

img { height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 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;
}

::selection {
  background: var(--lima);
  color: var(--tinta);
}

/* ---------- Foco visible y consistente ---------- */
:focus-visible {
  outline: 2px solid var(--tinta);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Sobre fondo oscuro, un anillo en «tinta» es invisible. Cualquier bloque que
   se pinte con el fondo oscuro declara `--foco` y el anillo lo respeta. */
:focus-visible { outline-color: var(--foco, var(--tinta)); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--tinta);
  color: var(--hueso);
  font-size: var(--fs-small);
  border-radius: var(--radio);
  transition: top var(--t-suave);
}
.skip-link:focus { top: 1rem; }

/* Bloqueo de scroll. Hace falta en html y en body: la propagación del overflow
   del body al viewport no es fiable con scrollbar-gutter activo. */
html.is-locked,
body.is-locked { overflow: hidden; }

/* `overflow: hidden` deja de ser contenedor de scroll y anula scrollbar-gutter,
   así que la página saltaría el ancho de la barra. Se compensa con padding. */
html.is-locked body,
html.is-locked .nav { padding-right: var(--ancho-barra, 0px); }

/* ---------- Tipografía de uso ---------- */
.h2 {
  font-size: var(--fs-h2);
  font-weight: 600;
}

.h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* Etiqueta editorial: versalitas espaciadas */
.etiqueta {
  margin: 0;
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--texto-3);
}

/* Numeral grande de sección: recurso editorial, no decorativo puro */
.folio {
  display: block;
  font-size: clamp(2.75rem, 5vw, 4.25rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: var(--taupe-texto-sm);
}

.lede,
.body-lg {
  font-size: var(--fs-body-lg);
  line-height: 1.62;
  font-weight: 300;
  color: var(--texto-2);
  max-width: 46ch;
}

/* Segundo párrafo de un bloque introductorio */
.p-sec {
  margin-top: 1rem;
  font-weight: 300;
  color: var(--texto-2);
}

.mt-lede { margin-top: 1.5rem; }

.section__sub {
  margin-top: 1.1rem;
  max-width: 50ch;
  color: var(--texto-3);
  font-size: var(--fs-small);
}

/* Anotación manuscrita: nota al margen, secundaria */
.nota {
  font-family: var(--font-firma);
  font-size: clamp(1.15rem, 1vw + 0.95rem, 1.5rem);
  font-weight: 500;
  line-height: 1.25;
  color: var(--texto-2);
}

/* Palabra resaltada con marcador lima. box-decoration-break reparte el fondo
   línea a línea: sin él, al envolver, el bloque se escalona. */
.marca {
  background:
    linear-gradient(to bottom, transparent 58%, var(--lima) 58% 94%, transparent 94%);
  padding-inline: 0.08em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Frase de cierre de sección */
.statement {
  position: relative;
  margin: clamp(2.75rem, 5vw, 4.5rem) 0 0;
  max-width: 24ch;
  font-size: clamp(1.45rem, 1.9vw + 1rem, 2.2rem);
  font-weight: 500;
  line-height: 1.24;
  letter-spacing: -0.025em;
}

.statement__rule {
  display: block;
  width: 46px;
  height: 6px;
  margin-bottom: 1.35rem;
  background: var(--lima);
}

/* Puntada / regla discontinua */
.stitch {
  display: block;
  height: 1px;
  background: repeating-linear-gradient(
    to right,
    var(--linea-media) 0 7px,
    transparent 7px 15px
  );
}

/* ---------- Aparición al hacer scroll ----------
   Sólo se oculta si hay JS (clase .js): sin JS el contenido se ve siempre. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--t-lento),
    transform var(--t-lento);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

.js [data-reveal-delay="1"] { transition-delay: 100ms; }
.js [data-reveal-delay="2"] { transition-delay: 200ms; }
.js [data-reveal-delay="3"] { transition-delay: 300ms; }

/* ---------- Preferencia de movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
