/* =====================================================================
   Base: reset, tipografía, layout primitivo y utilidades de movimiento.
   ===================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Deja aire bajo la cabecera fija al saltar a un ancla. */
  scroll-padding-top: 6rem;
}

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Capa de grano sobre toda la página. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  background-image: var(--grain);
  opacity: 0.30;
  mix-blend-mode: overlay;
  pointer-events: none;
}

body[data-grain="0"]::after { display: none; }

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

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

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

:target { scroll-margin-top: 7rem; }

/* ---------------------------------------------------------------------
   Tipografía
   --------------------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  font-variation-settings: var(--wonk-on);
  text-wrap: balance;
}

h1 { font-size: var(--step-6); }
h2 { font-size: var(--step-5); }
h3 { font-size: var(--step-3); }
h4 { font-size: var(--step-2); letter-spacing: -0.01em; }

p { text-wrap: pretty; }

strong, b { font-weight: 700; }

/* Kicker/antetítulo: mono, versalitas, con guion decorativo. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.eyebrow::before {
  content: '';
  width: 2.2rem;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.eyebrow--plain::before { display: none; }

/* Palabra destacada dentro de un titular. */
.accento {
  color: var(--accent);
  font-style: italic;
  font-variation-settings: 'SOFT' 60, 'WONK' 1;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--paper-dim);
  max-width: 46ch;
}

.muted { color: var(--paper-mute); }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------- */

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.shell--narrow { width: var(--shell-narrow); }

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }

.section__head {
  display: grid;
  gap: 1.1rem;
  max-width: 54rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

/* Cabecera partida: título a la izquierda, texto y enlace a la derecha. */
.section__head--split {
  max-width: none;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: end;
  gap: clamp(1.5rem, 4vw, 4rem);
}

@media (max-width: 860px) {
  .section__head--split { grid-template-columns: 1fr; align-items: start; }
}

.stack > * + * { margin-top: var(--stack-gap, 1rem); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, 1rem);
}

/* Línea divisoria con un rombo centrado. */
.rule {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ink-line) 18%, var(--ink-line) 82%, transparent);
}

.rule::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  translate: -50% -50%;
  rotate: 45deg;
  background: var(--accent);
}

/* ---------------------------------------------------------------------
   Accesibilidad
   --------------------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% -120%;
  z-index: var(--z-toast);
  padding: 0.85rem 1.5rem;
  background: var(--accent);
  color: var(--cream);
  font-weight: 600;
  border-radius: 0 0 var(--radius) var(--radius);
  transition: translate var(--fast) var(--ease-out);
}

.skip-link:focus-visible { translate: -50% 0; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* Solo para elementos que ya dibujan su propio foco. */
.focus-none:focus-visible { outline: none; }

/* ---------------------------------------------------------------------
   Revelado al hacer scroll

   Se usa animation-timeline donde el navegador lo soporta; si no,
   reveal.js añade .is-visible con IntersectionObserver.
   --------------------------------------------------------------------- */

.reveal {
  --reveal-shift: 24px;
  opacity: 0;
  translate: 0 var(--reveal-shift);
  transition:
    opacity var(--slow) var(--ease-out),
    translate var(--slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-visible,
.no-js .reveal {
  opacity: 1;
  translate: none;
}

/* Si no hay JS que marque .js en <html>, todo queda visible. */
html:not(.js) .reveal { opacity: 1; translate: none; }

@supports (animation-timeline: view()) {
  html.js .reveal:not(.is-visible) {
    animation: reveal-in linear both;
    animation-timeline: view();
    animation-range: entry 8% cover 26%;
    opacity: 1;
    translate: none;
  }
}

@keyframes reveal-in {
  from { opacity: 0; translate: 0 var(--reveal-shift); }
  to   { opacity: 1; translate: none; }
}

/* ---------------------------------------------------------------------
   Respeto por prefers-reduced-motion: se quita todo lo decorativo,
   nunca la visibilidad del contenido.
   --------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

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

  .reveal { opacity: 1 !important; translate: none !important; }
}

/* ---------------------------------------------------------------------
   Impresión: la carta debe poder imprimirse de forma legible.
   --------------------------------------------------------------------- */

@media print {
  body { background: #fff; color: #000; }
  body::after { display: none; }
  .site-header, .site-footer, .hero, .no-print { display: none !important; }
  .section { padding-block: 1rem; }
  a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 0.8em; }
}
