/* ══════════ Capa 3D / videojuego — se suma a style.css ══════════ */

/* lienzo WebGL fijo detrás del contenido */
#gl {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: 1; pointer-events: none;
}

/* contenido sobre el lienzo */
.nav, .progress, .grain, .wa-float { z-index: 80; }
.hero { z-index: 2; }
.hero-inner { position: relative; z-index: 2; }
.scroll-cue { z-index: 2; }
.solid { position: relative; z-index: 2; background: var(--bg); }

/* ── cursor retícula (videojuego) ── */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  body, a, button, .ba-divider { cursor: none; }
}
.ret {
  position: fixed; top: 0; left: 0; width: 36px; height: 36px; z-index: 99;
  pointer-events: none; mix-blend-mode: screen;
  transition: width .18s, height .18s;
}
.ret::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(245, 166, 35, .95);
  box-shadow: 0 0 12px rgba(242, 112, 29, .6), inset 0 0 8px rgba(242, 112, 29, .25);
}
.ret i { position: absolute; background: rgba(245, 166, 35, .9); }
.ret i:nth-child(1) { top: -7px; left: 50%; width: 1.5px; height: 9px; transform: translateX(-50%); }
.ret i:nth-child(2) { bottom: -7px; left: 50%; width: 1.5px; height: 9px; transform: translateX(-50%); }
.ret i:nth-child(3) { left: -7px; top: 50%; height: 1.5px; width: 9px; transform: translateY(-50%); }
.ret i:nth-child(4) { right: -7px; top: 50%; height: 1.5px; width: 9px; transform: translateY(-50%); }
.ret b { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); transform: translate(-50%, -50%); }
.ret.lock { width: 54px; height: 54px; }
.ret.lock::before { border-color: #ffd34d; animation: retSpin 1.6s linear infinite; border-style: dashed; }
@keyframes retSpin { to { transform: rotate(360deg); } }
@media (hover: none), (prefers-reduced-motion: reduce) { .ret { display: none; } }

/* ── HUD: esquinas + lectura de datos ── */
.hud { position: fixed; inset: 16px; z-index: 70; pointer-events: none; }
.hud span { position: absolute; width: 26px; height: 26px; border: 1.5px solid rgba(245, 166, 35, .5); }
.hud span:nth-child(1) { top: 0; left: 0; border-right: none; border-bottom: none; }
.hud span:nth-child(2) { top: 0; right: 0; border-left: none; border-bottom: none; }
.hud span:nth-child(3) { bottom: 0; left: 0; border-right: none; border-top: none; }
.hud span:nth-child(4) { bottom: 0; right: 0; border-left: none; border-top: none; }
.hud-pct {
  position: fixed; right: 30px; bottom: 26px; z-index: 70; pointer-events: none;
  font-family: monospace; font-size: 12.5px; letter-spacing: .18em; color: rgba(245, 166, 35, .85);
  text-shadow: 0 0 10px rgba(242, 112, 29, .5);
}
@media (max-width: 980px) { .hud, .hud-pct { display: none; } }

/* ── túnel 3D ── */
.tunnel { position: relative; height: 560vh; z-index: 2; }
.tunnel-head {
  position: absolute; top: 6vh; left: 0; right: 0; text-align: center; padding: 0 24px; z-index: 3;
}
.tunnel-head .kicker::before { margin: 0 auto; }
.tunnel-head .kicker { justify-content: center; }
.tunnel-sub { color: var(--mut); font-size: 17px; margin-top: 16px; letter-spacing: .04em; }
.hud-cap {
  position: fixed; left: 34px; bottom: 30px; z-index: 70; pointer-events: none;
  display: flex; align-items: center; gap: 16px;
  opacity: 0; transform: translateY(14px); transition: opacity .4s, transform .4s;
}
.hud-cap.on { opacity: 1; transform: none; }
.hud-idx {
  font-family: monospace; font-size: 13px; letter-spacing: .2em; color: var(--gold);
  border: 1px solid rgba(245, 166, 35, .5); padding: 8px 12px; background: rgba(14, 15, 18, .6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.hud-label {
  font-family: var(--disp); font-weight: 700; font-size: 26px; text-transform: uppercase; letter-spacing: .05em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .8), 0 0 24px rgba(242, 112, 29, .35);
}
@media (max-width: 980px) { .hud-cap { left: 16px; bottom: 84px; } .hud-label { font-size: 18px; } }

/* ── tarjetas de servicio con profundidad 3D real ── */
.svc-card {
  transform: perspective(1200px) scale(var(--cover-scale, 1)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
}
.svc-card > div:first-child { transform: translateZ(58px); }
.svc-media { transform: translateZ(34px); }
.svc-num { display: inline-block; transform: translateZ(26px); }

/* stats con tilt sutil */
.stat { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; }
.stat b { transform: translateZ(30px); }

/* ── rueda de proceso giratoria ── */
.pw { height: 340vh; }
.pw-sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1.1fr; align-items: center; gap: 48px;
  max-width: 1440px; margin: 0 auto; padding: 0 56px;
}
.pw-wheel { position: relative; width: 480px; height: 480px; max-width: 44vw; aspect-ratio: 1; margin: 0 auto; }
.pw-ticks {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px dashed rgba(243, 239, 232, .16);
  transform: rotate(var(--rot, 0deg));
}
.pw-orbit { position: absolute; inset: 44px; border-radius: 50%; border: 1px solid var(--line); }
.pw-orbit::before {
  content: ""; position: absolute; right: -5px; top: 50%; width: 10px; height: 10px;
  border-radius: 50%; background: var(--gold); transform: translateY(-50%);
  box-shadow: 0 0 14px rgba(245, 166, 35, .9);
}
.pw-node {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px;
  transform: rotate(calc(var(--ang) + var(--rot, 0deg))) translate(240px) rotate(calc(-1 * var(--ang) - var(--rot, 0deg)));
  border-radius: 50%; border: 2px solid var(--line); background: var(--bg2);
  display: grid; place-items: center;
  transition: background .4s, border-color .4s, box-shadow .4s;
}
.pw-node b { font-family: var(--disp); font-weight: 800; font-size: 26px; color: var(--dim); transition: color .4s; }
.pw-node.on { background: linear-gradient(120deg, #d9481f, #f2701d 55%, #f5a623); border-color: var(--gold); box-shadow: 0 0 34px rgba(242, 112, 29, .65); }
.pw-node.on b { color: #1a0d04; }
.pw-center {
  position: absolute; inset: 130px; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #1d1f24, var(--bg2) 70%);
  border: 1px solid var(--line); display: grid; place-content: center; justify-items: center; gap: 4px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 0 60px rgba(242, 112, 29, .12);
}
.pw-cnum {
  font-family: var(--disp); font-weight: 800; font-size: 92px; line-height: 1;
  background: var(--fire); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pw-clabel { font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: var(--dim); }
.pw-steps { display: grid; gap: 10px; margin-top: 40px; }
.pw-step {
  padding: 20px 24px; border-radius: 12px; border: 1px solid transparent;
  opacity: .32; transform: translateX(0); transition: opacity .45s, transform .45s, border-color .45s, background .45s;
}
.pw-step.on {
  opacity: 1; transform: translateX(10px);
  background: var(--bg2); border-color: rgba(242, 112, 29, .4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35), inset 3px 0 0 var(--acc);
}
.pw-step h4 { font-family: var(--disp); font-weight: 700; font-size: 27px; text-transform: uppercase; letter-spacing: .02em; }
.pw-step p { margin-top: 6px; font-size: 16px; line-height: 1.55; color: var(--mut); }
@media (max-width: 980px) {
  .pw { height: auto; }
  .pw-sticky { position: static; height: auto; grid-template-columns: 1fr; padding: 90px 20px; gap: 32px; }
  .pw-left { display: none; }
  .pw-steps { display: grid; gap: 16px; margin-top: 24px; }
  .pw-step {
    opacity: 1; transform: none;
    padding: 22px 24px; border-radius: 12px;
    background: var(--bg2); border: 1px solid var(--line);
    position: relative; padding-left: 72px;
  }
  .pw-step::before {
    content: counter(pw-c); counter-increment: pw-c;
    position: absolute; left: 20px; top: 22px;
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--fire); color: #1a0d04;
    font-family: var(--disp); font-weight: 800; font-size: 20px;
    display: grid; place-items: center;
  }
  .pw-right { counter-reset: pw-c; }
  .pw-step h4 { font-size: 22px; }
  .pw-step p { font-size: 15px; }
}

/* ── CTA: sin fondo sólido — el canvas 3D se cuela por detrás ── */
.cta { position: relative; z-index: 2; background: transparent !important; }

/* ── hamburger ── */
.nav-ham {
  display: none; background: none; border: none; cursor: pointer;
  flex-direction: column; justify-content: center; gap: 5px;
  padding: 10px; margin-left: 8px; z-index: 82;
}
.nav-ham span {
  display: block; width: 26px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: transform .3s, opacity .3s;
  transform-origin: center;
}
.nav-ham.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-ham.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-ham.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── menú móvil overlay ── */
.mob-menu {
  position: fixed; inset: 0; z-index: 76;
  background: rgba(10, 11, 14, .97);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  opacity: 0; pointer-events: none;
  transition: opacity .35s cubic-bezier(.4,0,.2,1);
}
.mob-menu.open { opacity: 1; pointer-events: all; }
.mob-logo { width: 72px; height: 72px; object-fit: contain; margin-bottom: 32px;
  filter: drop-shadow(0 0 18px rgba(242,112,29,.5)); }
.mob-menu a {
  font-family: var(--disp); font-weight: 800; font-size: clamp(38px, 10vw, 64px);
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink);
  padding: 10px 0; line-height: 1.1;
  transition: color .2s;
}
.mob-menu a:hover, .mob-menu a:active { color: var(--gold); }
.mob-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 32px; }
.mob-actions .lang-toggle { display: flex !important; }
.mob-actions .btn-fire { font-size: 18px; padding: 16px 36px; }

@media (max-width: 980px) {
  .nav-links, .lang-toggle.nav-item, .nav-cta-desk { display: none !important; }
  .nav-ham { display: flex; }
  .nav { padding: 14px 20px; }
  .nav.scrolled { padding: 10px 20px; }
}
@media (min-width: 981px) { .mob-menu { display: none !important; } }

/* ── fallback sin WebGL ── */
.proj-fallback { display: none; }
html.no3d .tunnel { display: none; }
html.no3d .proj-fallback { display: block; }
html.no3d #gl { display: none; }
