/* =====================================================================
   Páginas y Sistemas — base.css
   Tokens, fuentes, reset, tipografía y retícula. Ver /_SISTEMA.md
   ===================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Color: papel de patrón + tinta + gis de sastre */
  --paper: #f1ece3;
  --paper-2: #e8e1d4;
  --paper-3: #ddd3c2;
  --ink: #141210;
  --ink-2: #1f1c19;
  --ink-3: #35302a;
  --mute: #6e665c;          /* texto secundario sobre papel (4.8:1) */
  --mute-dark: #a39b8f;     /* texto secundario sobre tinta (6.8:1) */
  --chalk: #ff4a1c;         /* color señal: gis de sastre */
  --chalk-deep: #b8300c;    /* gis legible sobre papel (5.1:1) */
  --chalk-soft: #ffd9cc;
  --line: rgba(20, 18, 16, .16);
  --line-strong: rgba(20, 18, 16, .42);
  --line-dark: rgba(241, 236, 227, .16);
  --line-dark-strong: rgba(241, 236, 227, .4);

  /* Tipografía */
  --f-sans: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-serif: "Instrument Serif", "Times New Roman", Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --fs-display: clamp(2.9rem, 9.2vw, 10.5rem);
  --fs-h1: clamp(2.5rem, 7.2vw, 7.6rem);
  --fs-h2: clamp(2.1rem, 5.2vw, 5.4rem);
  --fs-h3: clamp(1.3rem, 1.9vw, 1.85rem);
  --fs-lead: clamp(1.12rem, 1.45vw, 1.45rem);
  --fs-body: clamp(1rem, .95rem + .2vw, 1.125rem);
  --fs-small: .9rem;
  --fs-mono: clamp(.68rem, .64rem + .12vw, .78rem);

  /* Espaciado y retícula */
  --gutter: clamp(16px, 4.2vw, 72px);
  --section: clamp(84px, 11vw, 196px);
  --max: 1680px;
  --measure: 62ch;
  --radius: 4px;
  --header-h: 72px;

  /* Movimiento */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.76, 0, .24, 1);
  --t-fast: .25s;
  --t-med: .6s;

  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 400;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  min-height: 100svh;
}
img, svg, video, canvas, picture { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
:where(ul[role="list"], ol[role="list"], .list-reset) { list-style: none; padding: 0; margin: 0; }
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
[hidden] { display: none !important; }
::selection { background: var(--chalk); color: var(--ink); }
:focus-visible { outline: 2px solid var(--chalk); outline-offset: 3px; border-radius: 2px; }
.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 1000; padding: 12px 18px;
  background: var(--ink); color: var(--paper); font-family: var(--f-mono); font-size: .8rem;
}
.skip-link:focus { top: 12px; }
.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;
}

/* ---------- Tipografía ---------- */
.display, .h1, .h2, .h3, h1, h2, h3 {
  font-family: var(--f-sans);
  font-weight: 800;
  line-height: .92;
  letter-spacing: -.025em;
  font-variation-settings: "wdth" var(--wdth, 100);
  text-wrap: balance;
}
.display { font-size: var(--fs-display); line-height: .86; letter-spacing: -.04em; }
h1, .h1 { font-size: var(--fs-h1); }
h2, .h2 { font-size: var(--fs-h2); }
h3, .h3 { font-size: var(--fs-h3); line-height: 1.08; letter-spacing: -.012em; font-weight: 700; }
h4, .h4 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.condensed { --wdth: 72; }
.wide { --wdth: 118; }
.serif, em.serif, .accent {
  font-family: var(--f-serif);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -.01em;
  font-variation-settings: normal;
}
.accent { color: var(--chalk-deep); }
.on-ink .accent, .accent.on-ink { color: var(--chalk); }
.lead { font-size: var(--fs-lead); line-height: 1.45; max-width: 40ch; text-wrap: pretty; }
.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1em; }
.prose p, p { text-wrap: pretty; }
.mono, .label {
  font-family: var(--f-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.4;
}
.label { display: inline-flex; align-items: center; gap: .6em; color: var(--mute); }
.label::before {
  content: ""; width: 1.6em; height: 1px; background: currentColor; flex: none;
}
.label--chalk { color: var(--chalk-deep); }
.on-ink .label { color: var(--mute-dark); }
.on-ink .label--chalk { color: var(--chalk); }
.small { font-size: var(--fs-small); }
.muted { color: var(--mute); }
.on-ink .muted { color: var(--mute-dark); }
strong, b { font-weight: 700; }

/* ---------- Retícula ---------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--narrow { max-width: 1120px; }
.section { padding-block: var(--section); position: relative; }
.section--tight { padding-block: calc(var(--section) * .6); }
.on-ink, .section--ink { background: var(--ink); color: var(--paper); }
.section--paper-2 { background: var(--paper-2); }
.section--chalk { background: var(--chalk); color: var(--ink); }
.grid-12 {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(12px, 1.6vw, 28px);
}
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }
.on-ink .rule { background: var(--line-dark); }

/* Plano técnico: retícula fina de fondo */
.blueprint {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
}
.on-ink.blueprint, .on-ink .blueprint {
  background-image:
    linear-gradient(rgba(241,236,227,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(241,236,227,.06) 1px, transparent 1px);
}

/* Grano de papel (SVG inline, sin petición extra) */
.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0 0.06 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Ocultos hasta que JS anime (sólo con <html class="js">) */
.js [data-reveal]:not(.is-in) { opacity: 0; }
.js [data-reveal="up"]:not(.is-in) { transform: translateY(40px); }
.js [data-reveal="mask"]:not(.is-in) { clip-path: inset(0 0 100% 0); opacity: 1; }
.js [data-reveal="stitch"]:not(.is-in) { clip-path: inset(0 100% 0 0); opacity: 1; }
.js:not(.no-motion) [data-stagger]:not(.is-in) > * { opacity: 0; }
/* Red de seguridad: si core.js no llega a cargar (html sin .ps-on), todo aparece a los 3 s */
.js:not(.ps-on) [data-reveal]:not(.is-in),
.js:not(.ps-on) [data-stagger]:not(.is-in) > * { animation: ps-failsafe .6s ease 3s forwards; }
@keyframes ps-failsafe { to { opacity: 1; transform: none; clip-path: none; } }
.ch { font-variation-settings: "wdth" var(--wdth, 100); }
.split-line { padding-bottom: .06em; margin-bottom: -.06em; }
.no-motion [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}

/* Nada se sale a lo ancho (clip no rompe position: sticky) */
main > section, main > div, .site-footer { overflow-x: clip; }

/* lenis.css (incluido aquí para ahorrar una petición) */
html.lenis,html.lenis body{height:auto}.lenis:not(.lenis-autoToggle).lenis-stopped{overflow:clip}.lenis.lenis-smooth [data-lenis-prevent]{overscroll-behavior:contain}.lenis.lenis-smooth iframe{pointer-events:none}.lenis.lenis-autoToggle{transition-property:overflow;transition-duration:1ms;transition-behavior:allow-discrete}
