/* ══════════════════════════════════════════════════════════════════
   BASE — tokens de diseño, reset, tipografía y utilidades globales
   Paleta: fondo azul-noche profundo + acentos menta/cian/violeta.
   ══════════════════════════════════════════════════════════════════ */

/* ---------- Fuentes autoalojadas (variables → un solo archivo) ---------- */
@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/SpaceGrotesk-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/JetBrainsMono-Variable.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Colores */
  --bg-0: #05080f;
  --bg-1: #0a101c;
  --bg-2: #0e1626;
  --panel: rgba(14, 22, 38, 0.55);
  --panel-solid: #0c1322;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);

  --txt-1: #e8eef7;
  --txt-2: #a5b4cb;
  --txt-3: #64748b;

  --mint: #00e5a0;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --err: #f87171;
  --warn: #fbbf24;

  --grad: linear-gradient(120deg, var(--mint) 0%, var(--cyan) 100%);
  --grad-soft: linear-gradient(120deg, rgba(0, 229, 160, 0.16), rgba(34, 211, 238, 0.16));

  /* Tipografía */
  --font-sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  /* Layout */
  --container: 1140px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-gap: clamp(5rem, 12vh, 8.5rem);

  /* Radios y sombras */
  --r-sm: 10px;
  --r-md: 16px;
  --r-full: 999px;
  --shadow-1: 0 10px 40px rgba(0, 0, 0, 0.45);
  --glow-mint: 0 0 24px rgba(0, 229, 160, 0.35);

  /* Capas */
  --z-nav: 100;
  --z-progress: 120;
  --z-chat: 500;
  --z-toast: 600;
  --z-noise: 900;
  --z-preloader: 1000;
  --z-cursor: 1100;

  /* Transiciones */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  background: var(--bg-0);
  color: var(--txt-2);
  line-height: 1.7;
  font-size: 1rem;
  overflow-x: hidden;
  min-height: 100vh;
}

img, svg, video, canvas { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
strong { color: var(--txt-1); font-weight: 600; }

h1, h2, h3, h4 {
  color: var(--txt-1);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

::selection { background: rgba(0, 229, 160, 0.28); color: #fff; }

/* Scrollbar personalizada (WebKit + Firefox) */
html { scrollbar-width: thin; scrollbar-color: #22304a var(--bg-0); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: #1c2940; border-radius: 8px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: #2a3c5c; }

/* Foco visible accesible */
:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Utilidades ---------- */
.mono { font-family: var(--font-mono); }

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

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

.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: -100%;
  left: 1rem;
  z-index: 2000;
  padding: 0.6rem 1rem;
  background: var(--mint);
  color: #04281c;
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* ---------- Secciones ---------- */
.section { padding-block: var(--section-gap); position: relative; }

.section-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(2rem, 5vh, 3.25rem);
}
.section-head__num {
  color: var(--mint);
  font-size: 0.95rem;
  font-weight: 500;
}
.section-head__num::before { content: '/'; color: var(--txt-3); margin-right: 2px; }
.section-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); white-space: nowrap; }
.section-head__line {
  height: 1px;
  flex: 1;
  max-width: 340px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
  margin-top: 4px;
}

.section-intro {
  max-width: 620px;
  margin: -1.25rem 0 2.5rem;
  color: var(--txt-2);
}

/* ---------- Fondo decorativo global ---------- */
.bg-scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; }

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.bg-glow--1 {
  width: 55vw; height: 55vw;
  top: -20vw; right: -18vw;
  background: radial-gradient(circle, rgba(0, 229, 160, 0.10), transparent 65%);
  animation: glow-drift 26s ease-in-out infinite alternate;
}
.bg-glow--2 {
  width: 48vw; height: 48vw;
  bottom: -22vw; left: -16vw;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.09), transparent 65%);
  animation: glow-drift 32s ease-in-out infinite alternate-reverse;
}
.bg-glow--3 {
  width: 34vw; height: 34vw;
  top: 42%; left: 58%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.07), transparent 65%);
  animation: glow-drift 38s ease-in-out infinite alternate;
}
@keyframes glow-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, 3vw, 0) scale(1.12); }
}

/* Grano de película muy sutil sobre toda la página */
.bg-noise {
  position: fixed;
  inset: -50%;
  z-index: var(--z-noise);
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Animaciones de aparición (scroll reveal) ----------
   Solo se ocultan si JS está activo (html.js) → sin JS la página
   es 100% visible. scrollfx.js añade .revealed al entrar en viewport. */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
}
html.js [data-reveal].revealed { opacity: 1; transform: none; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.25s, border-color 0.25s, color 0.25s;
  will-change: transform;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; transition: transform 0.25s var(--ease); }

.btn--primary {
  background: var(--grad);
  color: #03271b;
  box-shadow: 0 6px 22px rgba(0, 229, 160, 0.22);
}
.btn--primary:hover {
  box-shadow: 0 10px 30px rgba(0, 229, 160, 0.38);
  transform: translateY(-2px);
}
.btn--primary:hover svg { transform: translateX(3px); }

.btn--ghost {
  border: 1px solid var(--line-strong);
  color: var(--txt-1);
  background: rgba(14, 22, 38, 0.35);
  backdrop-filter: blur(6px);
}
.btn--ghost:hover {
  border-color: rgba(0, 229, 160, 0.55);
  color: var(--mint);
  transform: translateY(-2px);
}

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: rgba(14, 22, 38, 0.5);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--txt-2);
  letter-spacing: 0.02em;
  transition: border-color 0.25s, color 0.25s, transform 0.25s;
}
.chip:hover { border-color: rgba(0, 229, 160, 0.45); color: var(--txt-1); transform: translateY(-1px); }

.chip__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px rgba(0, 229, 160, 0.8);
  flex-shrink: 0;
}

/* ---------- Tarjetas con brillo que sigue al ratón ----------
   scrollfx.js actualiza --mx / --my con la posición del puntero. */
.card-glow {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  backdrop-filter: blur(10px);
  transition: border-color 0.3s, transform 0.3s var(--ease), box-shadow 0.3s;
  overflow: hidden;
}
.card-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
              rgba(0, 229, 160, 0.07), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.card-glow:hover { border-color: rgba(0, 229, 160, 0.3); }
.card-glow:hover::before { opacity: 1; }

/* ---------- Keyframes compartidos ---------- */
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 229, 160, 0.55); }
  60%      { box-shadow: 0 0 0 7px rgba(0, 229, 160, 0); }
}
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Movimiento reducido ----------
   Ojo: en Windows es muy habitual tener los "efectos de animación" del
   sistema apagados, y eso activa prefers-reduced-motion en el navegador.
   El antiguo bloque `* { animation-duration: 0.01ms }` congelaba TODA la
   web (typing, marquee, 3D, cursor…). Ahora solo se calma el movimiento
   grande y automático; las animaciones sutiles de marca siguen vivas. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* los reveals pasan de deslizarse a un simple fundido */
  html.js [data-reveal] { transform: none; transition-duration: 0.45s; }
  /* los brillos de fondo dejan de derivar */
  .bg-glow { animation: none; }
}
