/* ==========================================================================
   base.css — Tokens de marca, reset, tipografía y utilidades
   Fuente de verdad: Manual de Marca habilPay (paleta, tipografía, valores)
   Enfoque mobile-first: los estilos base son móviles; se escala con min-width.
   ========================================================================== */

:root {
  /* Paleta oficial */
  --habil-blue: #0046ff;
  --habil-cream: #c8bea0;
  --habil-white: #f5f5f5;

  /* Apoyos derivados del degradado del manual (azul → azul profundo) y texto */
  --habil-navy: #1c3468;
  --habil-ink: #0e1b3d;
  --habil-text: #4a4a4a;
  --habil-text-soft: #5f5f5f; /* texto secundario: ≥5,8:1 sobre blanco y #f5f5f5 */
  --habil-line: rgb(14 27 61 / 14%);

  /* Tipografía: Expanded para marca/títulos, Pro para textos (ver README) */
  --font-display: "SF Pro Expanded", "Archivo", "Arial", sans-serif;
  --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;

  /* Escala fluida */
  --fs-body: 1rem;
  --fs-lead: clamp(1.0625rem, 0.95rem + 0.5vw, 1.3125rem);
  --fs-title: clamp(2rem, 1.2rem + 3.6vw, 4.25rem);
  --fs-display: clamp(2.5rem, 1.4rem + 5vw, 5.75rem);

  /* Espaciado y forma */
  --gutter: 1.25rem;
  --section-y: clamp(4.5rem, 3rem + 7vw, 9rem);
  --radius-sm: 0.875rem;
  --radius-md: 1.5rem;
  --radius-lg: 2.25rem;
  --header-h: 4.5rem;
  --max-w: 80rem;

  /* Movimiento (equivalente al "osmo-ease" del sitio de referencia) */
  --ease-out: cubic-bezier(0.625, 0.05, 0, 1);
}

@media (min-width: 48em) {
  :root {
    --gutter: 2.5rem;
    --header-h: 5rem;
  }
}

/* Reset moderno y mínimo */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto; /* el desplazamiento suave lo gestiona Lenis */
  scroll-padding-top: var(--header-h); /* anclas nativas respetan el header fijo */
}

/* Requisitos de Lenis */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.is-loading,
body.menu-open {
  overflow: hidden;
}

body {
  min-height: 100vh;
  background: var(--habil-white);
  color: var(--habil-text);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

strong {
  font-weight: 600;
}

/* Foco de dos tonos: el blanco se ve sobre los azules de la marca y el azul
   sobre los fondos claros, así que el foco es visible en cualquier sección. */
:focus-visible {
  outline: 3px solid var(--habil-white);
  outline-offset: 0;
  box-shadow: 0 0 0 6px var(--habil-blue);
  border-radius: 4px;
}

/* Destinos que reciben el foco por código (contenido principal, secciones,
   confirmación del formulario): el foco se mueve, pero sin dibujar un anillo. */
[data-focus-target]:focus {
  outline: none;
  box-shadow: none;
}

/* Tipografía de marca: ligero + negrita dentro del mismo título */
.display,
.title {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.display {
  font-size: var(--fs-display);
}

.title {
  font-size: var(--fs-title);
  color: var(--habil-blue);
}

.display strong,
.title strong {
  font-weight: 800;
}

.title--light {
  color: var(--habil-white);
}

.eyebrow {
  margin-bottom: 1rem;
  color: var(--habil-blue);
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow--light {
  color: var(--habil-white);
  opacity: 0.85;
}

/* Utilidades */
.container {
  width: min(100% - var(--gutter) * 2, var(--max-w));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--habil-blue);
  color: var(--habil-white);
  transform: translateY(-200%);
  transition: transform 0.2s;
}

.skip-link:focus {
  transform: none;
}

/* Estados iniciales de animación: solo si JS está activo y se permite movimiento.
   Si GSAP no carga, main.js quita la clase .js y todo queda visible. */
.js [data-reveal],
.js [data-hero-item],
.js [data-hero-title],
.js [data-split] {
  opacity: 0;
}

.js .is-split {
  opacity: 1;
}

/* Salvavidas: si los scripts no arrancan en 5 s (CDN lento o caído, un error
   de JS), el contenido se muestra igual. main.js añade .js-ready al arrancar
   y con eso desactiva este salvavidas. */
@keyframes hp-failsafe-show {
  to {
    opacity: 1;
  }
}

.js:not(.js-ready) [data-reveal],
.js:not(.js-ready) [data-hero-item],
.js:not(.js-ready) [data-hero-title],
.js:not(.js-ready) [data-split] {
  animation: hp-failsafe-show 0s 5s forwards;
}

/* Impresión: sin capas de efectos y con todo el contenido visible */
@media print {
  .preloader,
  .scroll-progress,
  .cursor,
  .menu,
  .menu-toggle,
  .skip-link,
  .grid-reveal,
  .footer__wordmark,
  .ticker__toggle,
  .cform__captcha {
    display: none !important;
  }

  .header,
  .step,
  .toc,
  .contact__aside {
    position: static !important;
  }

  [data-reveal],
  [data-hero-item],
  [data-hero-title],
  [data-hero-title] *,
  [data-split],
  [data-split] * {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
