/* ============================================
   BASE — Reset + tipografía base + reglas globales
   ============================================ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--type-body);
  font-size: var(--size-base);
  font-weight: var(--weight-regular);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "ss01";
  font-kerning: normal;
  position: relative;
  overflow-x: hidden;
}

/* Grain canvas sutil de fondo — textura sin distraer */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.15  0 0 0 0 0.1  0 0 0 0 0.05  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.4'/></svg>");
}

main, header, footer {
  position: relative;
  z-index: 1;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

/* ============================================
   Tipografía editorial
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--type-display);
  font-weight: var(--weight-medium);
  line-height: 1.08;
  letter-spacing: -0.012em;
  color: var(--text-primary);
}

h1 {
  font-size: var(--size-display);
  line-height: 0.98;
  letter-spacing: -0.025em;
  font-weight: var(--weight-medium);
}

h2 {
  font-size: var(--size-4xl);
  line-height: 1.05;
  letter-spacing: -0.018em;
  font-weight: var(--weight-medium);
}

h3 {
  font-size: var(--size-2xl);
  line-height: 1.12;
  letter-spacing: -0.015em;
  font-weight: var(--weight-medium);
}

h4 {
  font-size: var(--size-xl);
  line-height: 1.2;
  font-weight: var(--weight-medium);
}

h5 {
  font-size: var(--size-lg);
  line-height: 1.3;
  font-weight: var(--weight-semi);
  font-family: var(--type-body);
}

p {
  max-width: var(--measure-base);
  line-height: 1.65;
}

p + p {
  margin-top: var(--sp-md);
}

strong, b {
  font-weight: var(--weight-semi);
  color: var(--text-primary);
}

em, i {
  font-style: italic;
}

/* Cita editorial */
blockquote {
  position: relative;
  font-family: var(--type-display);
  font-size: var(--size-2xl);
  font-style: italic;
  font-weight: var(--weight-regular);
  line-height: 1.28;
  letter-spacing: -0.012em;
  color: var(--text-primary);
  max-width: 38ch;
}

blockquote cite {
  display: block;
  margin-top: var(--sp-md);
  font-family: var(--type-body);
  font-size: var(--size-sm);
  font-style: normal;
  font-weight: var(--weight-medium);
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

cite { font-style: normal; }

/* Listas */
ul, ol {
  padding-left: var(--sp-lg);
  max-width: var(--measure-base);
}

li {
  margin-bottom: var(--sp-xs);
  line-height: 1.55;
}

li::marker {
  color: var(--text-tertiary);
}

/* Selección */
::selection {
  background: var(--c-cacao-200);
  color: var(--text-primary);
}

/* Focus visible accesible */
:focus-visible {
  outline: 2px solid var(--c-cacao-600);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================================
   Utilidades
   ============================================ */

.eyebrow {
  display: inline-block;
  font-family: var(--type-body);
  font-size: var(--size-xs);
  font-weight: var(--weight-semi);
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.lede {
  font-family: var(--type-body);
  font-size: clamp(1.125rem, 1.5vw, 1.375rem);
  font-weight: var(--weight-regular);
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 48ch;
}

.numeral {
  font-family: var(--type-numeral);
  font-size: var(--size-numeral);
  font-weight: var(--weight-medium);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  font-variant-numeric: lining-nums;
}

.tabular {
  font-variant-numeric: tabular-nums lining-nums;
}

.accent-line {
  display: block;
  width: 2.5rem;
  height: 1px;
  background: var(--text-accent);
  margin: var(--sp-md) 0;
}

/* Estructura de página */
.shell {
  width: 100%;
  max-width: var(--section-max-width);
  margin: 0 auto;
  padding-left: var(--section-padding-x);
  padding-right: var(--section-padding-x);
}

.section {
  padding-top: var(--sp-section);
  padding-bottom: var(--sp-section);
}

.section--tight {
  padding-top: var(--sp-3xl);
  padding-bottom: var(--sp-3xl);
}

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