/* ============================================================
   hero-cx.css — Hero animado ASCII (PREVIEW) · Computintas Digital
   Todo está aislado bajo .cx-hero y body.has-cx-hero para no
   afectar otros módulos. Variables de progreso las escribe
   assets/js/hero-cx.js:
     --cx-copy  0→1  desplazamiento del bloque de texto
     --cx-tag   0→1  aparición del tagline superior
     --cx-hint  1→0  indicador de scroll
     --cx-fade  1→0  opacidad del bloque de texto central
     --cx-shift px   distancia para centrar el texto en estado limpio
   ============================================================ */

:root {
  --cx-bg: #030814;
  --cx-bg-2: #06122b;
  --cx-blue: #0a6cff;
  --cx-cyan: #2ec5ff;
  --cx-ink: #eaf3ff;
  --cx-ink-soft: rgba(214, 228, 255, 0.78);
  --cx-header-h: 76px;
}

/* styles.css pone overflow-x:hidden en html y body; en body eso crea un
   contenedor de scroll que anula position:sticky (header y escenario del hero).
   `clip` recorta igual el desbordamiento horizontal sin crear ese contenedor. */
body.has-cx-hero {
  overflow-x: clip;
}

/* El logo con texto blanco trae fondo negro: `screen` lo funde con el header oscuro */
body.has-cx-hero .brand img {
  mix-blend-mode: screen;
}

/* ---------- Header: transparente arriba, oscuro translúcido al bajar ---------- */
body.has-cx-hero .site-header {
  background: transparent !important;
  border-bottom: 1px solid transparent !important;
  transition: background-color 0.35s ease, border-color 0.35s ease,
    backdrop-filter 0.35s ease, box-shadow 0.35s ease;
}

body.has-cx-hero .site-header.cx-solid,
body.has-cx-hero .site-header:has(.mobile-nav.open) {
  background: rgba(4, 10, 26, 0.74) !important;
  border-bottom-color: rgba(70, 150, 255, 0.16) !important;
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

body.has-cx-hero .desktop-nav a {
  color: rgba(226, 236, 255, 0.86) !important;
}

body.has-cx-hero .desktop-nav a:hover,
body.has-cx-hero .desktop-nav a.active {
  color: #5cc2ff !important;
}

body.has-cx-hero .desktop-nav a:focus-visible,
body.has-cx-hero .header-actions a:focus-visible,
body.has-cx-hero .brand:focus-visible,
body.has-cx-hero .menu-toggle:focus-visible,
body.has-cx-hero .mobile-nav a:focus-visible {
  outline: 2px solid #5cc2ff;
  outline-offset: 4px;
  border-radius: 6px;
}

body.has-cx-hero .menu-toggle {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

body.has-cx-hero .menu-toggle span,
body.has-cx-hero .menu-toggle::before,
body.has-cx-hero .menu-toggle::after {
  background: #ffffff;
}

body.has-cx-hero .mobile-nav {
  background: rgba(4, 10, 26, 0.97) !important;
  border-top: 1px solid rgba(70, 150, 255, 0.16) !important;
}

body.has-cx-hero .mobile-nav a {
  color: rgba(226, 236, 255, 0.86) !important;
}

body.has-cx-hero .mobile-nav a:hover,
body.has-cx-hero .mobile-nav a.active {
  color: #5cc2ff !important;
  background: rgba(92, 194, 255, 0.08);
}

/* ---------- Estructura del Hero ---------- */
.cx-hero {
  position: relative;
  /* El hero se mete bajo el header sticky para que este sea transparente encima */
  margin-top: calc(var(--cx-header-h) * -1);
  height: 230vh; /* 100vh visibles + ~130vh de recorrido de animación */
  background: var(--cx-bg);
  color: var(--cx-ink);
}

.cx-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 45% at 50% 38%, rgba(10, 108, 255, 0.16), transparent 70%),
    radial-gradient(ellipse 90% 60% at 50% 115%, rgba(46, 197, 255, 0.10), transparent 70%),
    linear-gradient(180deg, #02060f 0%, var(--cx-bg) 45%, var(--cx-bg-2) 100%);
}

.cx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Oscurece el centro detrás del texto para garantizar contraste */
.cx-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 34% 30% at 50% 66%, rgba(3, 8, 20, 0.78), transparent 75%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* Línea de horizonte inferior, como en el mockup */
.cx-stage::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -62vh;
  height: 70vh;
  border-radius: 50%;
  border-top: 1px solid rgba(92, 194, 255, 0.35);
  box-shadow: 0 -18px 60px rgba(10, 108, 255, 0.18);
  pointer-events: none;
}

.cx-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding-top: var(--cx-header-h);
  padding-bottom: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none; /* el canvas recibe el cursor; los enlaces lo reactivan */
}

.cx-tagline {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: rgba(214, 228, 255, 0.72);
  opacity: var(--cx-tag, 0);
  transform: translateY(calc((1 - var(--cx-tag, 0)) * 12px));
  padding-left: 0.55em; /* compensa el letter-spacing final */
}

.cx-tagline .cx-sep { margin: 0 0.6em; color: var(--cx-cyan); }

.cx-brand-title {
  margin: 0;
  width: 100%;
  height: clamp(120px, 30vh, 330px);
}

.cx-copy {
  max-width: 720px;
  transform: translateY(calc(var(--cx-shift, 0px) * (1 - var(--cx-copy, 0))));
  opacity: var(--cx-fade, 1); /* ligada al scroll: sin `transition` para no ir con retraso */
  will-change: transform, opacity;
}

/* Totalmente transparente: sin clics ni foco de teclado (visibility retira los enlaces del tabulado) */
.cx-copy.cx-copy--hidden {
  visibility: hidden;
}

.cx-kicker {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cx-cyan);
}

body.has-cx-hero .cx-title {
  margin: 0 0 14px;
  color: #ffffff;
  font-size: clamp(30px, min(4.3vw, 6.4vh), 58px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

.cx-accent {
  background: linear-gradient(90deg, #2ec5ff 0%, #4f9dff 60%, #2ec5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cx-pillars {
  margin: 0 auto 22px;
  font-size: clamp(15px, 1.25vw, 18px);
  color: var(--cx-ink-soft);
}

.cx-pillars .cx-sep { margin: 0 0.55em; color: var(--cx-cyan); }

.cx-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  pointer-events: auto;
}

.cx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.cx-btn-primary {
  background: linear-gradient(135deg, #0052ff 0%, #00a2ff 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(46, 197, 255, 0.25), 0 12px 32px rgba(0, 110, 255, 0.45);
}

.cx-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(46, 197, 255, 0.45), 0 16px 40px rgba(0, 130, 255, 0.6);
}

.cx-btn-primary .arrow { transition: transform 0.25s ease; }
.cx-btn-primary:hover .arrow { transform: translateX(4px); }

.cx-btn-ghost {
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: rgba(3, 8, 20, 0.4);
}

.cx-btn-ghost:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.cx-btn:focus-visible {
  outline: 2px solid #5cc2ff;
  outline-offset: 4px;
}

.cx-checks {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  gap: 8px 22px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: rgba(214, 228, 255, 0.7);
}

.cx-checks li::before {
  content: "✓";
  margin-right: 7px;
  color: var(--cx-cyan);
  font-weight: 700;
}

.cx-scroll-hint {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgba(214, 228, 255, 0.6);
  opacity: var(--cx-hint, 1);
  pointer-events: none;
  white-space: nowrap;
}

.cx-mouse {
  width: 20px;
  height: 32px;
  border: 1.5px solid rgba(214, 228, 255, 0.6);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.cx-mouse span {
  width: 2px;
  height: 7px;
  border-radius: 2px;
  background: var(--cx-cyan);
  animation: cxWheel 1.8s ease-in-out infinite;
}

@keyframes cxWheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(9px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

.cx-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Tablet ---------- */
@media (max-width: 920px) {
  .cx-hero { height: 210vh; }
  .cx-brand-title { height: clamp(100px, 22vh, 230px); }
  .cx-tagline { letter-spacing: 0.35em; font-size: 11px; }
}

/* ---------- Móvil ---------- */
@media (max-width: 720px) {
  :root { --cx-header-h: 64px; }
  .cx-hero { height: 190vh; }
  .cx-content { padding-bottom: 64px; }
  .cx-brand-title { height: clamp(90px, 17vh, 160px); }
  .cx-tagline { font-size: 10px; letter-spacing: 0.25em; padding-left: 0.25em; }
  .cx-kicker { font-size: 11.5px; letter-spacing: 0.16em; }
  body.has-cx-hero .cx-title { font-size: clamp(28px, 8.4vw, 38px); }
  .cx-pillars { font-size: 14.5px; margin-bottom: 18px; }
  .cx-pillars .cx-sep { margin: 0 0.35em; }
  .cx-actions { flex-direction: column; align-items: stretch; max-width: 320px; margin: 0 auto; gap: 10px; }
  .cx-checks { font-size: 12.5px; margin-top: 14px; }
  .cx-scroll-hint { bottom: 14px; font-size: 10px; letter-spacing: 0.2em; }
  .cx-vignette {
    background:
      radial-gradient(ellipse 70% 32% at 50% 62%, rgba(3, 8, 20, 0.82), transparent 78%),
      radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
  }
}

/* Pantallas bajas (portátiles 1366×650, etc.): ceder espacio al nombre de marca */
@media (max-height: 740px) {
  .cx-content { padding-bottom: 44px; }
  .cx-brand-title { flex-shrink: 0; height: clamp(110px, 27vh, 200px); }
  .cx-checks { display: none; }
  .cx-kicker { margin-bottom: 6px; }
  .cx-pillars { margin-bottom: 16px; }
  .cx-scroll-hint { bottom: 10px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .cx-brand-title { height: 70px; }
  .cx-checks, .cx-scroll-hint { display: none; }
}

/* ---------- Movimiento reducido: composición completa, sin recorrido largo ---------- */
@media (prefers-reduced-motion: reduce) {
  .cx-hero { height: auto; }
  .cx-stage { position: relative; min-height: 100vh; height: auto; }
  .cx-content { position: relative; min-height: 100vh; }
  .cx-copy { transform: none !important; opacity: 1 !important; visibility: visible !important; }
  .cx-tagline { opacity: 1; transform: none; }
  .cx-scroll-hint { display: none; }
  .cx-mouse span { animation: none; }
}
