/* ==========================================================================
   NVT — Base: reset, tipografía, layout y utilidades
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--on-light);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Red de seguridad contra el desplazamiento horizontal en móvil.
   Se aplica a html y no solo a body: en Safari de iOS, declararlo únicamente
   en body no impide el desplazamiento, y además oculta el problema de las
   herramientas de medición. `clip` es preferible a `hidden` porque no
   convierte el elemento en un contenedor de scroll, lo que romperia
   position:sticky del índice lateral. */
html, body { overflow-x: clip; }

/* Ninguna palabra larga —una URL, un nombre de producto— debe forzar el
   ancho de su contenedor. */
p, li, td, th, h1, h2, h3, h4 { overflow-wrap: break-word; }

body.is-locked { overflow: hidden; }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  margin: 0 0 var(--sp-4);
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); letter-spacing: -0.01em; }
h4 { font-size: var(--fs-h4); line-height: var(--lh-snug); letter-spacing: 0; }

p { margin: 0 0 var(--sp-4); color: var(--text-muted); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

strong { color: var(--text); font-weight: 600; }

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--accent-2); }

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.15rem; color: var(--text-muted); }
li { margin-bottom: var(--sp-2); }
li::marker { color: var(--accent); }

code, kbd { font-family: var(--font-mono); font-size: .875em; }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-10) 0; }

::selection { background: var(--teal); color: #04121A; }

:focus-visible {
  outline: 2px solid var(--teal-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--wide   { max-width: var(--maxw-wide); }
.wrap--narrow { max-width: var(--maxw-narrow); }

.section {
  position: relative;
  padding-block: var(--section-y);
  background: var(--surface);
  color: var(--text);
}
.section--tight  { padding-block: calc(var(--section-y) * .6); }
.section--flush-top { padding-top: 0; }

.section--dark  { background: var(--ink-850); }
.section--dark2 { background: var(--ink-800); }
.section--light { background: var(--paper); }
.section--alt   { background: var(--paper-2); }

/* Hairline superior para separar dos secciones del mismo tono */
.section--rule { border-top: 1px solid var(--border); }

.grid { display: grid; gap: var(--sp-6); }

/* Los hijos de una grilla tienen min-width:auto por defecto, así que la
   columna no puede encogerse por debajo del ancho mínimo de su contenido.
   Sin esto, un elemento ancho —una tabla con min-width, un bloque de código—
   estira su columna y desborda la página completa en móvil. */
.grid > * { min-width: 0; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: 240px minmax(0, 1fr); gap: var(--sp-12); align-items: start; }
.grid--split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }

@media (max-width: 980px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--sidebar { grid-template-columns: 1fr; gap: var(--sp-8); }
  .grid--split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

.stack > * + * { margin-top: var(--sp-4); }

/* --- Tipografía de apoyo -------------------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-4);
}
.eyebrow::before {
  content: "";
  width: 22px; height: 2px;
  background: var(--grad-brand);
  border-radius: 2px;
}

.lead { font-size: var(--fs-lead); line-height: 1.6; color: var(--text-muted); }

.section-head { max-width: 720px; margin-bottom: clamp(2.5rem, 4vw, 3.75rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .eyebrow { justify-content: center; }

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mono-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .04em;
  color: var(--text-faint);
}

/* --- Utilidades ----------------------------------------------------------- */

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 50%; top: 0;
  transform: translate(-50%, -120%);
  z-index: 200;
  background: var(--ink-800); color: var(--on-dark);
  padding: .7rem 1.2rem; border-radius: 0 0 var(--r-md) var(--r-md);
  font-size: var(--fs-sm); font-weight: 600;
  transition: transform var(--t-base) var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* --- Revelado por scroll -------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Las reglas de movimiento reducido viven al final de components.css: deben
   cargarse después de los componentes para poder anularlos, porque una media
   query no aporta especificidad adicional. */
