/* ============================================================================
   ZENITH 360 — base.css
   Reinicio, tipografía por defecto, accesibilidad y elementos HTML desnudos.
   Sin componentes y sin layout: eso vive en components.css y layout.css.
   Depende de tokens.css, que debe cargarse antes.
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;   /* para que el nav fijo no tape el destino del ancla */
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;   /* red de seguridad: ningún elemento decorativo puede sangrar el body */
}

/* ---------- Titulares ---------- */
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 500; }
h1, h2 {
  font-family: var(--font-display);
  letter-spacing: var(--ls-title);
  line-height: var(--lh-title);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 {
  font-family: var(--font-ui);
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.25;
}
h4, h5, h6 { font-family: var(--font-ui); font-weight: 600; line-height: 1.3; }

p { margin: 0 0 var(--s-4); max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

/* ---------- Cifras: SIEMPRE en la sans, SIEMPRE tabulares ---------- */
.num, [data-num], time, output {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* ---------- Eyebrow numerado ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 0 var(--s-4);
  font-family: var(--font-ui);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  max-width: none;
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.on-dark .eyebrow { color: var(--text-on-dark-mut); }
.on-dark .eyebrow::after { background: var(--rule-on-dark); }

.lead { font-size: var(--fs-lead); line-height: 1.45; color: var(--text-muted); }
.on-dark .lead { color: var(--text-on-dark-mut); }
.micro { font-size: var(--fs-micro); line-height: var(--lh-micro); color: var(--text-muted); }
/* --text-muted es tinta oscura: sobre fondo azul da 1.36:1 y el texto
   desaparece. Sobre oscuro, el gris apagado tiene que ser el claro. */
.on-dark .micro, .on-dark p, .on-dark li, .on-dark dd { color: var(--text-on-dark-mut); }
.on-dark strong, .on-dark b { color: var(--paper-50); }

/* ---------- Enlaces ---------- */
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--brand-600); }

/* ---------- Foco: una sola regla para todo el sitio ---------- */
:focus { outline: none; }               /* solo se anula porque focus-visible lo repone */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
.on-dark :focus-visible { outline-color: var(--focus-on-dark); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 999;
  padding: var(--s-3) var(--s-4);
  background: var(--brand-900);
  color: var(--paper-50);
  font-size: var(--fs-micro);
  font-weight: 600;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out-expo);
}
.skip-link:focus-visible { top: var(--s-4); }

/* ---------- Medios: CLS = 0 ---------- */
img, svg, video, picture { display: block; max-width: 100%; }
img { height: auto; }
/* El navegador le pone a <figure> un margen lateral de 40px por defecto.
   Sin esto, cada foto pierde 80px de ancho dentro de su columna. */
figure, figcaption { margin: 0; }
.media {
  position: relative;
  overflow: hidden;
  background: var(--bg-sunken);
  border-radius: var(--r-md);
}
.media > img, .media > svg { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Listas ---------- */
ul, ol { margin: 0; padding: 0; }
.list-plain { list-style: none; }
.list-marked { list-style: none; }
.list-marked li {
  position: relative;
  padding-left: var(--s-6);
  margin-bottom: var(--s-3);
  max-width: var(--measure);
}
.list-marked li::before {
  content: "";
  position: absolute;
  left: 0; top: .7em;
  width: 12px; height: 1px;
  background: var(--rule-strong);
}

/* ---------- Tablas ---------- */
table { border-collapse: collapse; width: 100%; }
caption { text-align: left; }
th { text-align: left; font-weight: 600; }
th, td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--rule); vertical-align: top; }

/* ---------- Formularios: solo lo desnudo ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }

/* ---------- Utilidades ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.hairline { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.on-dark .hairline { border-top-color: var(--rule-on-dark); }
[hidden] { display: none !important; }

/* Grano: se aplica sobre bloques de color sólido, nunca sobre texto */
.grain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  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='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Texto sobre fondos oscuros */
.on-dark { color: var(--text-on-dark); }
.on-dark h1, .on-dark h2, .on-dark h3 { color: var(--paper-50); }

::selection { background: var(--proof-200); color: var(--ink-900); }

/* ---------- Movimiento reducido: obligatorio, no opcional ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Impresión ---------- */
@media print {
  .site-nav, .wa-float, .reading-progress, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
}
