/* ============================================================================
   Recomendly - base: reset, elementos, accesibilidad, utilidades.
   ============================================================================ */

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

/* El atributo [hidden] siempre gana sobre reglas de display de autor. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  tab-size: 4;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-body);
  line-height: var(--lh-body);
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

/* Imágenes/medios */
img, svg, video, canvas { display: block; max-width: 100%; height: auto; }

/* Titulares */
h1, h2, h3, h4 {
  font-weight: var(--weight-display);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
  color: var(--ink);
}
h1 { font-size: var(--h1); line-height: var(--lh-tight); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--h2); line-height: var(--lh-snug); letter-spacing: var(--tracking-display); }
h3 { font-size: var(--h3); font-weight: var(--weight-bold); }
h4 { font-size: var(--text-lg); font-weight: var(--weight-semibold); letter-spacing: 0; }

p { text-wrap: pretty; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:root[data-theme='dark'] a:hover { color: var(--accent-hover); }

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

ul, ol { padding-left: 1.2em; }

/* Formularios heredan la fuente */
button, input, select, textarea { font: inherit; color: inherit; }

/* Números tabulares para datos */
.tnum, [data-tnum] { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* ---------------------------- Accesibilidad ------------------------------ */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
/* no quitar nunca el foco por defecto sin reemplazo */

.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;
}

.skip-link {
  position: fixed; top: 0; left: 50%; transform: translate(-50%, -120%);
  z-index: var(--z-toast);
  background: var(--accent); color: var(--on-accent);
  padding: 0.6rem 1rem; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: var(--weight-semibold); text-decoration: none;
  transition: transform var(--dur) var(--ease-out);
}
.skip-link:focus-visible { transform: translate(-50%, 0); color: var(--on-accent); }

/* ------------------------------ Layout ----------------------------------- */
.container {
  width: 100%; max-width: var(--container);
  margin-inline: auto; padding-inline: var(--gutter);
}
.container-wide { max-width: var(--container-wide); }
.prose { max-width: var(--container-prose); }

.section { padding-block: var(--section-y); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.lead {
  font-size: var(--text-lg);
  line-height: var(--lh-relaxed);
  color: var(--ink-muted);
  max-width: 44rem;
}

/* --------------------- Revelado en entrada (progresivo) ------------------ */
/* El contenido es visible por defecto; la animación sólo mejora. */
[data-reveal] { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--dur-slow) var(--ease-out),
      transform var(--dur-slow) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
}

/* Páginas legales (términos, privacidad, reembolsos) */
.legal { padding-block: var(--space-3xl) var(--space-4xl); min-height: 60vh; }
.legal .kicker { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--ink-subtle); }
.legal h1 { margin-top: var(--space-sm); font-size: var(--h2); }
.legal .legal-lede {
  margin-top: var(--space-lg); color: var(--ink-muted);
  font-size: var(--text-lg); line-height: var(--lh-relaxed);
}
.legal .legal-note {
  margin-top: var(--space-xl); padding: var(--space-lg) var(--space-xl);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--ink-muted); font-size: var(--text-base); line-height: var(--lh-relaxed);
}
/* Cuerpo del documento legal */
.legal h2 { font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: 0; margin-top: var(--space-2xl); }
.legal h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin-top: var(--space-xl); }
.legal p { margin-top: var(--space-md); color: var(--ink-muted); font-size: var(--text-base); line-height: var(--lh-relaxed); }
.legal p strong { color: var(--ink); }
.legal ul, .legal ol { margin-top: var(--space-md); padding-left: 1.3em; display: grid; gap: 0.5rem; color: var(--ink-muted); font-size: var(--text-base); line-height: var(--lh-relaxed); }
.legal ul li::marker { color: var(--ink-subtle); }
.legal a { color: var(--link); }
.legal .legal-version {
  margin-top: var(--space-2xl); padding-top: var(--space-lg); border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-subtle); letter-spacing: 0.01em;
}
.legal .back { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: var(--space-xl); color: var(--link); text-decoration: none; font-weight: var(--weight-medium); font-size: var(--text-sm); }
.legal .back:hover { text-decoration: underline; }

/* Páginas de estado del flujo (verificando / midiendo) */
.flow { min-height: calc(100dvh - 68px); display: grid; place-items: center; padding: var(--space-3xl) 0; }
.flow-card {
  max-width: 34rem; text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: clamp(1.75rem, 4vw, 2.75rem);
}
.flow-card .flow-icon {
  width: 3rem; height: 3rem; margin: 0 auto var(--space-lg); display: grid; place-items: center;
  border-radius: var(--radius-pill); background: var(--accent-wash); color: var(--accent);
}
.flow-card .flow-icon svg { width: 1.5rem; height: 1.5rem; }
.flow-card h1 { font-size: var(--h3); }
.flow-card p { margin-top: var(--space-md); color: var(--ink-muted); font-size: var(--text-base); line-height: var(--lh-relaxed); }
.flow-card .flow-sub { margin-top: var(--space-lg); font-size: var(--text-sm); color: var(--ink-subtle); }
.flow-card .btn { margin-top: var(--space-xl); }
/* Puntos de progreso (midiendo): sólo decorativo, se detiene con reduced-motion */
.flow-dots { display: inline-flex; gap: 0.4rem; margin-top: var(--space-md); }
.flow-dots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); opacity: 0.35; }
@media (prefers-reduced-motion: no-preference) {
  .flow-dots i { animation: flow-pulse 1.1s var(--ease-in-out) infinite; }
  .flow-dots i:nth-child(2) { animation-delay: 0.18s; }
  .flow-dots i:nth-child(3) { animation-delay: 0.36s; }
}
@keyframes flow-pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* Utilidades menores */
.text-muted { color: var(--ink-muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
