/* ==========================================================================
   base.css — Variables de diseño, reset, tipografía, utilidades y botones.
   Tema oscuro inspirado en interfaces fintech: fondo navy profundo,
   superficies escalonadas, degradado de marca magenta → violeta → azul.
   Ver docs/guia-de-estilo.md.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Fondo y superficies (de más profundo a más elevado) */
  --color-bg: #070B1A;
  --color-surface-1: #0C1226;
  --color-surface-2: #121A33;
  --color-surface-3: #1A2340;
  --color-border: #222C4D;

  /* Texto */
  --color-ink: #F4F6FC;            /* títulos */
  --color-text: #D3D8EA;           /* párrafos */
  --color-muted: #939BB8;          /* secundario */
  --color-white: #FFFFFF;

  /* Marca */
  --color-primary: #5B6CFF;        /* azul eléctrico (derivado del navy de marca) */
  --color-primary-soft: #8D99FF;
  --color-accent: #CC3366;         /* magenta Tendencia */
  --color-accent-dark: #B02A57;
  --color-accent-soft: #FF6A9C;    /* magenta legible sobre fondo oscuro */
  --color-violet: #9B6BFF;

  /* Estados */
  --color-success: #2FD08F;
  --color-error: #FF5A6E;
  --color-focus: #FF6A9C;

  /* Degradados */
  --gradient-brand: linear-gradient(135deg, #CC3366 0%, #9B4DCC 50%, #5B6CFF 100%);
  --gradient-text: linear-gradient(120deg, #FF6A9C 0%, #B07BFF 50%, #7C8CFF 100%);
  --gradient-hero: radial-gradient(120% 90% at 50% 0%, #161C45 0%, #070B1A 60%);
  --gradient-surface: linear-gradient(160deg, #0F1630 0%, #080C1C 100%);
  --gradient-card: linear-gradient(150deg, rgb(204 51 102 / 0.14) 0%, rgb(91 108 255 / 0.05) 45%, transparent 100%);

  /* Tipografía */
  --font-display: 'Sora', 'Inter', system-ui, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: clamp(1.2rem, 1.1rem + 0.4vw, 1.375rem);
  --fs-xl: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  --fs-2xl: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  --fs-3xl: clamp(2.2rem, 1.4rem + 3.6vw, 3.5rem);

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.06;
  --lh-snug: 1.3;
  --lh-base: 1.65;
  --tracking-tight: -0.025em;

  /* Espaciados (escala de 4px) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --section-space: clamp(4rem, 3rem + 4vw, 7rem);

  /* Layout */
  --container: 1240px;
  --container-narrow: 820px;
  --gutter: 1.25rem;
  --header-height: 72px;

  /* Radios */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* Sombras: base oscura + brillo interno superior + halo de color al elevar */
  --shadow-soft: 0 1px 2px rgb(2 4 12 / 0.4), 0 12px 32px -12px rgb(2 4 12 / 0.7);
  --shadow-lift: 0 2px 4px rgb(2 4 12 / 0.4), 0 28px 60px -24px rgb(204 51 102 / 0.45);
  --shadow-inset: inset 0 1px 0 0 rgb(255 255 255 / 0.05);
  --shadow-glow: 0 10px 30px -8px rgb(204 51 102 / 0.65);

  /* Movimiento */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 160ms var(--ease);
  --transition: 280ms var(--ease);
  --transition-slow: 700ms var(--ease);

  /* Capas */
  --z-header: 100;
  --z-float: 200;
}

@media (min-width: 768px) {
  :root {
    --gutter: 2rem;
  }
}

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

*,
*::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-height) + var(--space-4));
  background: var(--color-bg);
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

img {
  height: auto;
}

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

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

p,
h1,
h2,
h3,
h4 {
  overflow-wrap: break-word;
}

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

a {
  color: var(--color-accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-ink);
}

::selection {
  background: rgb(204 51 102 / 0.45);
  color: var(--color-white);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

[hidden] {
  display: none !important;
}

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

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
  text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); line-height: 1.12; }
h3 { font-size: var(--fs-lg); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-md); }

p {
  text-wrap: pretty;
}

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

.lead {
  font-size: var(--fs-md);
  color: var(--color-muted);
}

/* Etiqueta tipo píldora sobre los títulos de sección */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: 0.3rem 0.8rem;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-soft);
  background: rgb(204 51 102 / 0.07);
  border: 1px solid rgb(255 106 156 / 0.22);
  border-radius: var(--radius-pill);
}

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

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

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-white);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-white);
}

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

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

/* Cuadrícula de 64px que se desvanece desde arriba */
.bg-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgb(34 44 77 / 0.55) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(34 44 77 / 0.55) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 40%, transparent 100%);
}

/* Mancha de luz difusa detrás de bloques destacados */
.glow {
  position: absolute;
  left: 50%;
  pointer-events: none;
  border-radius: 50%;
  transform: translateX(-50%);
  filter: blur(140px);
  opacity: 0.9;
}

.glow--accent { background: rgb(204 51 102 / 0.22); }
.glow--primary { background: rgb(91 108 255 / 0.2); }

/* Superficie estándar: tarjetas, paneles */
.card-surface {
  background: var(--color-surface-1);
  border: 1px solid rgb(34 44 77 / 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft), var(--shadow-inset);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

/* Superficie de vidrio: vistas previas, CTA */
.card-glass {
  background: var(--gradient-card), rgb(12 18 38 / 0.6);
  border: 1px solid rgb(34 44 77 / 0.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lift), var(--shadow-inset);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

.surface-muted {
  background: rgb(18 26 51 / 0.6);
  border: 1px solid rgb(34 44 77 / 0.6);
  border-radius: var(--radius-lg);
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0.7em 1.4em;
  font-size: 0.9375rem;
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Acción principal: magenta sólido con halo */
.btn--accent {
  background: var(--color-accent);
  color: var(--color-white);
  box-shadow: var(--shadow-glow), inset 0 1px 0 rgb(255 255 255 / 0.18);
}

.btn--accent:hover {
  background: var(--color-accent-dark);
  color: var(--color-white);
  box-shadow: 0 14px 36px -8px rgb(204 51 102 / 0.8), inset 0 1px 0 rgb(255 255 255 / 0.18);
}

/* Acción principal alternativa: degradado de marca */
.btn--primary {
  background: var(--gradient-brand);
  color: var(--color-white);
  box-shadow: 0 10px 30px -10px rgb(91 108 255 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.18);
}

.btn--primary:hover {
  color: var(--color-white);
  box-shadow: 0 14px 36px -8px rgb(155 77 204 / 0.7), inset 0 1px 0 rgb(255 255 255 / 0.18);
}

/* Secundario: superficie con borde (también para fondos oscuros) */
.btn--outline,
.btn--outline-light {
  background: rgb(18 26 51 / 0.7);
  border-color: var(--color-border);
  color: var(--color-ink);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.btn--outline:hover,
.btn--outline-light:hover {
  background: var(--color-surface-3);
  border-color: rgb(141 153 255 / 0.4);
  color: var(--color-white);
}

.btn--ghost {
  color: var(--color-muted);
  padding-inline: var(--space-3);
}

.btn--ghost:hover {
  color: var(--color-ink);
}

.btn--lg {
  min-height: 52px;
  padding: 0.85em 1.75em;
  font-size: var(--fs-base);
}

.btn--sm {
  min-height: 36px;
  padding: 0.45em 1em;
  font-size: var(--fs-sm);
}

/* --------------------------------------------------------------------------
   Animaciones reutilizables
   -------------------------------------------------------------------------- */

/* Entrada al cargar (hero). Escalonar con style="--delay: 120ms" */
.rise-in {
  animation: rise-in 0.9s var(--ease) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgb(47 208 143 / 0.6); }
  70% { box-shadow: 0 0 0 8px rgb(47 208 143 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(47 208 143 / 0); }
}

@keyframes seam-flow {
  from { background-position: 0% 50%; }
  to { background-position: 200% 50%; }
}

@keyframes swap-pulse {
  0%, 100% { transform: translateY(0); opacity: 0.9; }
  50% { transform: translateY(3px); opacity: 1; }
}
