/* ==========================================================================
   BASE.CSS
   Reset ligero + estilos por defecto de elementos HTML.
   No contiene componentes ni layout de secciones — solo el "piso" sobre
   el que se construye todo lo demás.
   ========================================================================== */

/* --- Reset ------------------------------------------------------------ */

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

* {
  margin: 0;
}

html {
  /* Permite que 1rem = 16px por defecto, pero respeta configuración
     de accesibilidad del usuario (zoom de texto del navegador) */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Quita el scroll suave si el usuario prefiere menos movimiento */
@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;
  }
}

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

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

button {
  cursor: pointer;
  background: none;
  border: none;
}

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

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

/* --- Documento base ----------------------------------------------------- */

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Tipografía por defecto --------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  /* "inherit" y no un color fijo: así cada encabezado respeta el
     color que ya define su contenedor (body = tinta oscura por
     defecto; .card--inverse, .hero, .metodologia, .plataforma,
     .industrias, .casos = texto claro sobre fondo navy). Antes esta
     regla fijaba var(--color-text) sin condiciones, y una declaración
     explícita sobre el propio elemento SIEMPRE gana sobre el color
     heredado del contenedor, sin importar la especificidad de este
     último — por eso los títulos quedaban oscuros dentro de
     cualquier tarjeta oscura del sitio. Corrección sistémica de raíz,
     no un parche por componente. */
  color: inherit;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  max-width: 68ch; /* longitud de línea legible para párrafos largos */
}

small {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Texto en fuente utilitaria (mono) — usar para eyebrows, badges,
   etiquetas de dato. Clase de utilidad, no un elemento HTML por defecto. */
.text-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* --- Accesibilidad: foco visible ---------------------------------------
   Nunca se elimina el outline de foco sin reemplazarlo — requisito de
   piso de calidad del sitio (navegación por teclado). */
:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Oculta contenido visualmente pero lo deja disponible para lectores
   de pantalla — usar en textos de apoyo (ej. "abrir submenú") */
.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;
}

/* Enlace "saltar al contenido" — primer elemento enfocable del sitio,
   visible solo cuando recibe foco por teclado */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-modal);
  padding: var(--space-3) var(--space-5);
  background: var(--qa-navy-950);
  color: var(--color-text-inverse);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  transition: top var(--duration-fast) var(--ease-standard);
}

.skip-link:focus {
  top: var(--space-4);
}

/* --------------------------------------------------------------------
   SISTEMA DE REVELADO AL HACER SCROLL
   Contraparte visual de [data-reveal] (ver assets/js/main.js). El
   elemento arranca oculto y desplazado; main.js agrega .is-revealed
   cuando entra en el viewport. Si JS está deshabilitado, la regla de
   abajo (@media sin JS no se puede detectar por CSS puro) se resuelve
   con .no-js en <html> — ver nota en index.html.
   -------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-entrance),
              transform var(--duration-slow) var(--ease-entrance);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Salvaguarda: si por cualquier motivo JS no llegó a ejecutar (error,
   bloqueado, etc.), el contenido no debe quedar invisible para
   siempre. html.no-js se agrega solo si JS falla en cargar (ver script
   inline mínimo en <head> de cada página). */
.no-js [data-reveal] {
  opacity: 1;
  transform: none;
  transition: none;
}
