/* ============================================================================
   BASE.CSS — Reset, tipografía global y utilidades de layout
   ============================================================================
   No contiene decisiones de marca: solo consume los tokens. Rara vez tendrás
   que editar este archivo.
   ========================================================================== */

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

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Compensa el header sticky al saltar a un #ancla */
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  /* `clip` en vez de `hidden`: hidden convierte el body en contenedor de
     scroll y eso ROMPE todos los position:sticky de la página (la pila de
     tarjetas y el navbar). clip recorta igual pero no crea scroll. */
  overflow-x: clip;
}

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

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

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

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

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

/* Accesibilidad: anillo de foco visible solo con teclado */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--blueberry-200); color: var(--oat-500); }

/* --- Tipografía ------------------------------------------------------------ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  text-wrap: balance;   /* evita huérfanas en titulares */
}

h1 { font-size: var(--text-h1); line-height: var(--leading-h1); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--text-h2); line-height: var(--leading-h2); letter-spacing: var(--tracking-display); }
h3 { font-size: var(--text-h3); line-height: var(--leading-h3); letter-spacing: var(--tracking-display); }
h4 { font-size: var(--text-h4); line-height: var(--leading-h4); }
h5 { font-size: var(--text-h5); line-height: var(--leading-h4); }
h6 { font-size: var(--text-h6); line-height: var(--leading-h4); }

p { text-wrap: pretty; }

/* El reset pone `margin: 0` en todo, así que un titular seguido de un párrafo
   quedaría pegado. En vez de dar margen a los titulares (rompería los
   componentes que separan con `gap`), se lo damos al párrafo que va detrás:
   solo actúa donde realmente hace falta. */
h1 + p, h2 + p, h3 + p, h4 + p { margin-top: var(--space-4); }

/* Eyebrow: el "kicker" en mono + mayúsculas que Clay pone sobre cada H2 */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-eyebrow);
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 1.5em;   /* en em: escala con el propio eyebrow */
}

.lead {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 46ch;
}

/* Titular bicolor: la segunda mitad de la frase en gris. Es el recurso que
   Clay usa para marcar el concepto clave sin cambiar de tamaño ni de peso.
   Uso: <h2>Consigue datos del <span class="headline-accent">marketplace más
   completo</span></h2> */
.headline-accent { color: var(--color-text-muted); }

.text-muted { color: var(--color-text-muted); }
.text-mono  { font-family: var(--font-mono); }
.text-serif { font-family: var(--font-serif); font-weight: var(--weight-regular); }
.text-center { text-align: center; }

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--narrow { max-width: 68rem; }
.container--prose  { max-width: 46rem; }

.section { padding-block: var(--section-pad); position: relative; }
.section--lg    { padding-block: var(--section-pad-lg); }
.section--tight { padding-block: calc(var(--section-pad) * 0.6); }
.section--subtle { background: var(--color-bg-subtle); }
/* Isla oscura: redefine TODOS los tokens de color dentro de sí misma, para
   que cualquier componente que metas dentro (cards, botones, bordes) se
   adapte solo. Ojo: hay que invertir también --color-bg y
   --color-text-invert, o en modo oscuro el texto sale negro sobre negro y
   los .btn--primary blancos sobre blanco. */
.section--ink {
  background: var(--oat-500);
  color: var(--oat-100);
  --color-bg: var(--oat-500);
  --color-bg-subtle: #26251f;
  --color-text: var(--oat-100);
  --color-text-invert: var(--oat-500);
  --color-text-muted: #a3a09a;
  --color-border: #302f2c;
  --color-surface: #1c1b19;
}

/* Cabecera de sección reutilizable (eyebrow + h2 + lead) */
.section-head { max-width: 46rem; margin-bottom: var(--space-7); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .lead { margin-inline: auto; }
.section-head .lead { margin-top: var(--space-4); }

/* Grids de utilidad */
.grid { display: grid; gap: var(--grid-gap); }
.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)); }

/* Breakpoints unificados en todo el proyecto: 64rem (tablet) y 38rem (móvil).
   No introduzcas valores intermedios o el layout dejará de ser predecible. */
@media (max-width: 64rem) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 38rem) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

.stack   { display: flex; flex-direction: column; gap: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

.divider { border: 0; border-top: var(--border-thin); }

/* Solo para lectores de pantalla */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Salto al contenido — primer tabulable de la página */
.skip-link {
  position: absolute; top: -100%; left: var(--space-4); z-index: 999;
  background: var(--color-text); color: var(--color-bg);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
}
.skip-link:focus { top: var(--space-3); }
