/* ============================================================================
   VIDGLASS — RESET + PRIMITIVAS TIPOGRÁFICAS Y DE LAYOUT
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  /* scroll-padding evita que el header fijo tape el título de la sección
     al navegar por anclas. Equivale a la altura del header + aire. */
  scroll-padding-top: calc(var(--header-h, 72px) + var(--sp-6));
}

/* El scroll suave se activa por CSS, pero se anula si el usuario pidió
   menos movimiento (ver bloque de accesibilidad al final). */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  letter-spacing: var(--tracking-normal);
  color: var(--text-1);
  background: var(--surface-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  /* Espacio para el dock de acciones fijo en mobile. */
  padding-bottom: env(safe-area-inset-bottom);
}

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

/* <picture> es sólo un selector de formato, no una caja: display:contents lo
   saca del layout para que el <img> siga siendo hijo directo de la figura y
   los selectores de componente (.figure img, .segment img…) sigan aplicando. */
picture { display: contents; }

img, video {
  height: auto;
  /* Evita CLS mientras carga: el navegador reserva la caja por el aspect-ratio
     derivado de width/height del atributo HTML. */
}

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

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

ul[role='list'], ol[role='list'] { list-style: none; padding: 0; }

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

:where(p, li) { text-wrap: pretty; }

/* ---------- Escala tipográfica ------------------------------------------- */

.t-display, .t-h1, .t-h2, .t-h3 {
  font-weight: var(--fw-semi);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

.t-display {
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
}
.t-h1 { font-size: var(--fs-h1); line-height: 1.05; letter-spacing: var(--tracking-display); }
.t-h2 { font-size: var(--fs-h2); }
.t-h3 { font-size: var(--fs-h3); letter-spacing: var(--tracking-normal); }
.t-h4 {
  font-size: var(--fs-h4);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-normal);
  line-height: 1.3;
}

.t-lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-relaxed);
  color: var(--text-2);
  font-weight: var(--fw-regular);
}

.t-body  { font-size: var(--fs-body); line-height: var(--lh-relaxed); color: var(--text-2); }
.t-sm    { font-size: var(--fs-sm); line-height: 1.55; color: var(--text-2); }
.t-xs    { font-size: var(--fs-xs); line-height: 1.5; color: var(--text-3); }

/* Etiqueta de sección. Rasgo tipográfico recurrente del sistema:
   mayúsculas, tracking amplio, precedida por una línea corta. */
.t-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent);
}
.t-eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: .55;
}
.t-eyebrow--center::before { display: none; }

/* Números grandes (stats, pasos). Tabular para que no "bailen" al animarse. */
.t-numeral {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  letter-spacing: var(--tracking-display);
}

.t-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .02em;
}

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

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

.container--narrow { max-width: 960px; }
.container--wide   { max-width: 1560px; }

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

/* Cabecera de sección reutilizable. */
.section-head { max-width: var(--container-text); margin-bottom: clamp(2.5rem, 4vw, 4.5rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .t-eyebrow { justify-content: center; }
.section-head > * + * { margin-top: var(--sp-5); }

/* Grilla de 12 columnas: los componentes se colocan con span, no con anchos
   arbitrarios. Colapsa a 1 columna en mobile. */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--grid-gap);
}

/* Auto-grid para colecciones de cards: sin media queries, se acomoda solo. */
.autogrid {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: repeat(auto-fit, minmax(min(var(--col, 280px), 100%), 1fr));
}

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

.hairline { height: 1px; background: var(--hairline); border: 0; }

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

.u-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.u-center-text { text-align: center; }
.u-measure { max-width: var(--container-text); }
.u-relative { position: relative; }
.u-no-scroll { overflow: hidden; }

/* ---------- Foco visible ------------------------------------------------- */
/* Un solo anillo, consistente en todo el sitio, visible sobre claro y oscuro. */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

/* Salto al contenido para usuarios de teclado y lectores de pantalla. */
.skip-link {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: var(--z-toast);
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-ink-950);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  transform: translateY(-160%);
  transition: transform var(--dur-base) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- Selección ---------------------------------------------------- */
::selection { background: var(--c-edge-300); color: var(--c-ink-950); }

/* ---------- Scrollbar (sólo desktop, discreta) --------------------------- */
@media (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: var(--c-ink-300) transparent; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb {
    background: var(--c-ink-200);
    border-radius: var(--r-full);
    border: 3px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--c-ink-300); background-clip: content-box; }
}
