/* ==========================================================================
   Hero · "El siguiente nivel digital"
   Text left (≈55%), scene right. Copy is plain HTML; the scene is decorative.
   Entrance (≈1.9 s): atmosphere → logo → headline (word masks) → lead → actions → fx.
   ========================================================================== */

@property --nx-sheen { syntax: '<percentage>'; inherits: false; initial-value: -40%; }

:root { --header-h: 91px; }
@media (max-width: 767px) { :root { --header-h: 77px; } }

.nx-hero {
  --nx-ease: cubic-bezier(.16, 1, .3, 1);
  --nx-ink: #f4f0fa;
  --nx-muted: #b9b0c7;
  position: relative;
  isolation: isolate;
  overflow: clip;
  margin-top: calc(-1 * var(--header-h));
  padding-top: var(--header-h);
  min-height: max(640px, 100svh);
  display: grid;
  align-items: center;
  background:
    radial-gradient(ellipse 55% 60% at 72% 46%, rgba(76, 38, 140, .26), transparent 70%),
    linear-gradient(180deg, #0b080f 0%, #120c17 58%, #0d0a11 100%);
}

/* Header blends into the hero, turns solid once the hero leaves (main.js .is-scrolled). */
.has-hero .site-header { transition: background-color 300ms var(--ease-out), border-color 300ms; }
.has-hero .site-header:not(.is-scrolled) { background: transparent; }
.has-hero .site-header.is-scrolled { background: rgba(12, 9, 16, .9); }
@supports (backdrop-filter: blur(1px)) {
  .has-hero .site-header.is-scrolled { background: rgba(12, 9, 16, .76); backdrop-filter: blur(14px) saturate(1.15); }
}

/* ── Atmosphere: overhead light beams + floor horizon (from the reference video) ── */
.nx-hero__atmosphere { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.nx-hero__beam {
  position: absolute;
  top: -12%;
  height: 92%;
  /* Blur the already-shaped child: clipping a blurred element itself leaves a hard cone. */
  filter: blur(18px);
  opacity: 0;
  animation: nx-fade 1200ms var(--nx-ease) 80ms both;
}
.nx-hero__beam::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(190, 166, 255, .14), rgba(150, 110, 255, .045) 55%, transparent 80%);
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
}
/* One overhead light, aimed at the logo: centred on the logo's stage position (55% of the
   square stage, which is right-aligned and min(art height, 52vw) wide). */
.nx-hero__beam { --stage: min(max(640px, 100svh) - var(--header-h), 52vw); right: calc(var(--stage) * .45 - var(--stage) * .31); width: calc(var(--stage) * .62); }
.nx-hero__floor {
  position: absolute;
  right: 4%;
  bottom: 9%;
  width: 54vw;
  height: 90px;
  background:
    linear-gradient(90deg, transparent, rgba(183, 152, 255, .42) 50%, transparent) center / 100% 1px no-repeat,
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(139, 92, 246, .22), transparent 75%);
  filter: blur(.4px);
  opacity: 0;
  animation: nx-fade 1400ms var(--nx-ease) 150ms both;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.nx-hero__inner { position: relative; z-index: 2; padding-block: clamp(2.5rem, 6vh, 5rem); }
.nx-hero__copy { width: min(55%, 47rem); }

.nx-hero__art {
  position: absolute;
  z-index: 1;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  width: 52vw;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}
.nx-stage {
  position: relative;
  height: min(100%, 52vw);
  aspect-ratio: 1;
  /* The stage's left edge sits beside the copy column: decoration fades out before it. */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 15%);
  mask-image: linear-gradient(90deg, transparent 0, #000 15%);
}
.nx-stage > * { position: absolute; inset: 0; }
.nx-stage__poster img { width: 100%; height: 100%; display: block; }
.nx-stage__canvas { opacity: 0; transition: opacity 450ms var(--ease-out); }
.nx-stage__canvas canvas { display: block; width: 100%; height: 100%; }

/* Halo behind the logo: breathes almost imperceptibly; hero.js nudges it with the light. */
.nx-stage__halo {
  inset: 18% 6% 20% 16%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(124, 58, 237, .42), rgba(124, 58, 237, .14) 55%, transparent 100%);
  filter: blur(34px);
  opacity: 0;
  animation: nx-fade 1000ms var(--nx-ease) both, nx-breathe 7.5s ease-in-out 1.2s infinite alternate;
}

/* Poster entrance: logo first, back/front fx last (the brief's step 6). */
.nx-stage__poster--logo { animation: nx-logo-in 1100ms var(--nx-ease) 120ms both; }
.nx-stage__poster--back { animation: nx-fade 900ms var(--nx-ease) 1250ms both; }
.nx-stage__poster--front { animation: nx-fx-in 900ms var(--nx-ease) 1400ms both; }

/* WebGL took over: crossfade, posters stay as an identical underlay until faded. */
.nx-stage[data-scene='ready'] .nx-stage__canvas { opacity: 1; }
.nx-stage[data-scene='ready'] .nx-stage__poster { opacity: 0; transition: opacity 450ms var(--ease-out); animation: none; }

/* ── Headline ──────────────────────────────────────────────────────────── */
.nx-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(2.2rem, 4.25vw, 4.65rem);
  line-height: 1.03;
  letter-spacing: -.035em;
  word-spacing: .07em; /* the negative tracking also narrows the space glyph */
  color: var(--nx-ink);
  text-wrap: balance;
}
.nx-br { display: none; }
@media (min-width: 1024px) { .nx-br { display: inline; } }

.nx-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: .06em .03em .16em;
  margin: -.06em -.03em -.16em; /* no layout effect: only keeps glyph edges unclipped */
}
.nx-word__inner {
  display: inline-block;
  animation: nx-rise 820ms var(--nx-ease) both;
  animation-delay: calc(300ms + var(--i) * 42ms);
}
.nx-word--hl .nx-word__inner {
  color: transparent;
  background-image:
    linear-gradient(104deg, transparent calc(var(--nx-sheen) - 14%), rgba(255, 255, 255, .92) var(--nx-sheen), transparent calc(var(--nx-sheen) + 14%)),
    linear-gradient(180deg, #ece4ff 0%, #b897ff 46%, #8f63f5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  animation:
    nx-rise-hl 820ms var(--nx-ease) both,
    nx-sheen 1000ms cubic-bezier(.45, 0, .2, 1) both;
  animation-delay: calc(300ms + var(--i) * 42ms), calc(1250ms + (var(--i) - 8) * 120ms);
}

/* ── Lead + accents ────────────────────────────────────────────────────── */
.nx-hero__lead {
  margin: clamp(1.4rem, 2.4vw, 2.1rem) 0 0;
  max-width: 44ch;
  font-size: clamp(1rem, .55vw + .8rem, 1.1875rem);
  line-height: 1.65;
  color: var(--nx-muted);
  animation: nx-fade-up 760ms var(--nx-ease) 940ms both;
}
.nx-accent { transition: color 600ms var(--ease-out); }
.nx-accent:nth-of-type(2) { transition-delay: 70ms; }
.nx-accent:nth-of-type(3) { transition-delay: 140ms; }
.nx-accent:nth-of-type(4) { transition-delay: 210ms; }
@media (hover: hover) and (pointer: fine) {
  .nx-hero__copy:hover .nx-accent { color: #d9cdfd; }
}

/* ── Actions ───────────────────────────────────────────────────────────── */
.nx-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: clamp(1.9rem, 3vw, 2.6rem);
  animation: nx-fade-up 700ms var(--nx-ease) 1120ms both;
}
.nx-cta {
  --mx: 0px; --my: 0px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 54px;
  padding: 0 1.55rem 0 1.75rem;
  border: 1px solid rgba(214, 198, 255, .42);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: .005em;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(180deg, #8f64f5 0%, #6c3adf 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .24),
    inset 0 -1px 0 rgba(28, 8, 66, .35),
    0 14px 32px -14px rgba(109, 59, 224, .8),
    0 2px 6px rgba(0, 0, 0, .35);
  translate: var(--mx) var(--my);
  transition: transform 220ms var(--ease-out), box-shadow 260ms var(--ease-out), translate 280ms var(--ease-out);
}
.nx-cta::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -60% auto -60% -30%;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .34), transparent);
  transform: translateX(-140%) rotate(20deg);
  transition: transform 760ms var(--ease-out);
  pointer-events: none;
}
.nx-cta .icon { transition: transform 240ms var(--ease-out); }
.nx-cta:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .28),
    inset 0 -1px 0 rgba(28, 8, 66, .35),
    0 20px 40px -14px rgba(124, 74, 240, .9),
    0 3px 8px rgba(0, 0, 0, .35);
}
.nx-cta:hover::after { transform: translateX(520%) rotate(20deg); }
.nx-cta:hover .icon, .nx-cta:focus-visible .icon { transform: translateX(4px); }
.nx-cta:active { transform: translateY(-1px) scale(.975); transition-duration: 110ms; }
.nx-cta:focus-visible { outline: 2px solid #cdbcff; outline-offset: 4px; }

.nx-link {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 48px;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--nx-ink);
  text-decoration: none;
}
.nx-link__label { position: relative; }
.nx-link__label::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: linear-gradient(90deg, #cdbcff, #8f63f5);
  transform: scaleX(.22);
  transform-origin: left;
  transition: transform 420ms var(--nx-ease);
}
.nx-link .icon { transition: transform 300ms var(--nx-ease); color: #cdbcff; }
.nx-link:hover .nx-link__label::after, .nx-link:focus-visible .nx-link__label::after { transform: scaleX(1); }
.nx-link:hover .icon, .nx-link:focus-visible .icon { transform: translateX(4px); }
.nx-link:focus-visible { outline: 2px solid #cdbcff; outline-offset: 6px; border-radius: 4px; }

/* Pause control (WCAG 2.2.2): only shown while the live scene runs. */
.nx-hero__pause {
  position: absolute;
  z-index: 3;
  left: var(--gutter); /* bottom-right belongs to the floating WhatsApp button */
  bottom: clamp(.5rem, 1.6vh, 1.25rem);
  min-height: 44px;
  padding: 0 .25rem;
  border: 0;
  background: none;
  font-size: .75rem;
  color: var(--nx-muted);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(185, 176, 199, .4);
  cursor: pointer;
}
.nx-hero__pause:hover { color: var(--nx-ink); }
.nx-hero__pause:focus-visible { outline: 2px solid #cdbcff; outline-offset: 2px; }
.nx-hero[data-paused] .nx-stage__halo { animation-play-state: running, paused; }

/* ── Keyframes ─────────────────────────────────────────────────────────── */
@keyframes nx-fade { from { opacity: 0; } to { opacity: var(--nx-beam, 1); } }
@keyframes nx-breathe { from { scale: 1; } to { scale: 1.035; } }
@keyframes nx-logo-in { from { opacity: 0; transform: scale(.94) rotate(-1.6deg); } to { opacity: 1; transform: none; } }
@keyframes nx-fx-in { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }
@keyframes nx-rise { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes nx-rise-hl { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes nx-sheen { from { --nx-sheen: -40%; } to { --nx-sheen: 140%; } }
@keyframes nx-fade-up { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

/* ── Tablet & mobile: message first, compact scene below ─────────────────── */
@media (max-width: 1023px) {
  .nx-hero { min-height: 0; align-items: start; }
  .nx-hero__inner { padding-block: clamp(2rem, 7vw, 3.5rem) 0; }
  .nx-hero__copy { width: 100%; max-width: 40rem; }
  .nx-hero__title { font-size: clamp(2.05rem, 7.4vw, 3.6rem); }
  .nx-hero__art { position: relative; top: auto; width: 100%; justify-content: center; }
  .nx-stage {
    height: auto;
    width: min(100%, 560px);
    margin-block: -9% -12%;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .nx-stage__halo { inset: 24% 4% 26% 4%; }
  /* Stacked layout: the logo sits below the copy, so an overhead beam would light the text.
     Halo + floor light the logo instead. */
  .nx-hero__beam { display: none; }
  .nx-hero__floor { right: 0; width: 100%; bottom: 1%; }
}
@media (max-width: 479px) {
  .nx-hero__actions { gap: .5rem 1.5rem; }
  .nx-cta { width: 100%; justify-content: center; }
  .nx-link { margin-inline: auto; }
}

/* ── Reduced motion: refined static composition, opacity only ───────────── */
@media (prefers-reduced-motion: reduce) {
  .nx-hero *, .nx-hero *::before, .nx-hero *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; }
  .nx-stage__poster, .nx-hero__copy > *, .nx-word__inner { animation: nx-fade 300ms linear both !important; }
  .nx-word--hl .nx-word__inner { animation: nx-fade 300ms linear both !important; }
  .nx-hero__title, .nx-hero__lead { translate: none; }
  .nx-cta, .nx-cta::after, .nx-link .icon, .nx-link__label::after { transition-duration: 1ms; }
  .nx-cta:hover, .nx-cta:active { transform: none; }
}

/* ── Mobile alignment polish (2026-10-03) ─────────────────────────────── */
@media (max-width: 767px) {
  /* Un solo eje de lectura: todo alineado a la izquierda. */
  .nx-hero__copy, .nx-hero__title, .nx-hero__lead { text-align: left; }
  .nx-hero__actions { flex-direction: column; align-items: stretch; gap: .75rem; margin-inline: 0; }
  .nx-cta { width: 100%; justify-content: center; }
  /* El enlace secundario deja de flotar centrado: mismo ancho que el botón. */
  .nx-link { width: 100%; margin-inline: 0; justify-content: center; min-height: 48px; }
  .nx-link__label { text-align: center; }
  /* Control de pausa legible sobre la escena, nunca encima del logo. */
  .nx-hero__pause {
    left: var(--gutter);
    right: auto;
    bottom: calc(.75rem + env(safe-area-inset-bottom));
    padding: .4rem .8rem;
    border: 1px solid rgba(205, 188, 255, .22);
    border-radius: 999px;
    background: rgba(14, 10, 20, .78);
    color: #ded6ea;
    text-decoration: none;
  }
}
@media (max-width: 479px) {
  .nx-link { margin-inline: 0; }
}