/* =========================================================================
   base.css — Reset ligero, tipografía base, fuentes y utilidades globales.
   ========================================================================= */

/* ---- Fuentes locales (coloca los .woff2 en assets/fonts/). ----
   Si aún no están, el sistema usa la pila de reserva definida en variables.css.
   Ver README → «Fuentes». */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/montserrat-600.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/montserrat-700.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/montserrat-800.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
}

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

* {
  margin: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-ink);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* =========================================================================
   Barra de desplazamiento corporativa (solo CSS, sin JS).
   Track = azul oscuro de marca · thumb = azul cian de marca · ~10 px · redondeada.
   Estándar/Firefox con scrollbar-color/width; WebKit con pseudo-elementos.
   En sistemas con scrollbar overlay (móvil/macOS) se respeta lo nativo;
   en forced-colors (alto contraste) se deja el scrollbar del sistema.
   ========================================================================= */
/* Estándar (Firefox y navegadores sin ::-webkit-scrollbar) */
@supports not selector(::-webkit-scrollbar) {
  html {
    scrollbar-width: thin;
    scrollbar-color: #fff var(--color-deep-blue); /* thumb blanco, track igual */
  }
}
/* WebKit (Chrome, Edge, Safari). Track = azul oscuro (sin cambios); thumb = blanco.
   Al hacer hover o arrastrarlo (:active) el thumb engorda ligeramente (menos borde),
   con transición suave; el ancho de la barra no cambia (sin reflow). */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--color-deep-blue); }
::-webkit-scrollbar-thumb {
  background: #fff;
  border-radius: var(--radius-pill);
  border: 3px solid var(--color-deep-blue); /* deja un carril del color del track */
  background-clip: padding-box;
  transition: border-width 0.18s ease, background-color 0.18s ease;
}
::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
  border-width: 1px;                         /* thumb más grueso al interactuar */
  background: #fff;
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: var(--color-deep-blue); }
/* Accesibilidad: en alto contraste se respeta el scrollbar del sistema */
@media (forced-colors: active) {
  html { scrollbar-color: auto; }
  ::-webkit-scrollbar-track,
  ::-webkit-scrollbar-thumb,
  ::-webkit-scrollbar-corner { background: canvas; border: 0; }
}

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

svg {
  fill: currentColor;
}

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

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

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--color-deep-blue);
}

/* ---- Tipografía ---- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
  color: var(--color-ink);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--fs-h2);
}

/* Separación vertical MÍNIMA de 24px entre un h2 y el elemento inmediatamente
   siguiente. Se aplica como margin-bottom del h2 SOLO si tiene hermano siguiente
   (:has(+ *)); al colapsar con el margin-top del siguiente, el hueco resultante
   es max(24px, separación existente) → nunca reduce espaciados ya mayores y no
   toca el margen superior del h2 ni la separación entre párrafos. Los componentes
   que fijan su propio margin-bottom de h2 (p. ej. .article-toc/.post-faq, cargados
   después) mantienen su valor por cascada = excepciones respetadas. */
h2:has(+ *) {
  margin-bottom: 1.5rem;
}

h3 {
  font-size: var(--fs-h3);
}

h4 {
  font-size: var(--fs-h4);
}

p {
  text-wrap: pretty;
}

strong,
b {
  font-weight: var(--fw-semibold);
}

/* ---- Accesibilidad: foco visible ---- */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -100px;
  z-index: var(--z-toast);
  background: var(--color-primary-strong);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: var(--fw-semibold);
  transition: top var(--dur-base) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-md);
  color: #fff;
}

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

.no-scroll {
  overflow: hidden;
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-small);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-primary);
}

.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: var(--radius-pill);
}

/* Titular VISUAL de sección que ya NO es un heading: por SEO, la etiqueta <h2>
   semántica pasa al antetítulo (.eyebrow) y el titular grande se maqueta con
   .section-title (un <div>), reproduciendo EXACTAMENTE el aspecto de un <h2>.
   Se usa <div> (no <p>) para no heredar `.section-head p`. */
.section-title {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  color: var(--color-ink);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}
.section-title:has(+ *) { margin-bottom: 1.5rem; }        /* = h2:has(+ *) */
.bg-deep .section-title,
.bg-gradient .section-title { color: var(--color-on-dark); }  /* = .bg-deep h2 */

/* El antetítulo pasa a <h2>: anula el margin-bottom que h2:has(+ *) le añadiría,
   para que siga pegado al titular (hueco original = 0). Solo afecta a los .eyebrow
   que son <h2> (los de la portada); el resto siguen siendo <span>. */
h2.eyebrow { margin: 0; }

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