/* =====================================================================
   WIF DIGITAL UNIVERSE — BEYOND THE NEXT DIMENSION (v4.0)
   Capa visual cinematográfica, arquitectura 3D y UI de nueva generación
   sobre el sistema base wif.css (100% compatible con todas las rutas).
   ===================================================================== */
:root {
  --void: #030814;
  --void-2: #061226;
  --blue-electric: #168BFF;
  --cyan-glow: #36C5FF;
  --gold-metal: #FFD700;
  --gold-bright: #FFE885;
  --chrome: #D8E4F2;
  --glass-bg: rgba(7, 20, 42, 0.72);
  --glass-border: rgba(125, 179, 240, 0.2);
  --glass-border-gold: rgba(255, 215, 0, 0.34);
}

body {
  background-color: var(--void);
}

/* ---------- Canvas persistente del Universo 3D ---------- */
.wif-universe-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(65% 55% at 50% 34%, rgba(0, 87, 184, 0.22), transparent 70%),
    radial-gradient(45% 40% at 22% 72%, rgba(255, 215, 0, 0.06), transparent 68%),
    linear-gradient(180deg, #030814 0%, #050E20 52%, #071630 100%);
  transition: opacity 0.45s ease;
}

main, .footer, .signal-strip {
  position: relative;
  z-index: 2;
}

/* ---------- Cabecera glass-metálica evolucionada ---------- */
.header {
  background: rgba(3, 8, 20, 0.72);
  border-bottom: 1px solid rgba(54, 197, 255, 0.14);
}
.header.is-scrolled {
  background: rgba(3, 8, 20, 0.92);
  border-bottom-color: rgba(255, 215, 0, 0.24);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* ---------- FASE 2: APERTURA CINEMATOGRÁFICA (#wif-cinema) ---------- */
.wif-cinema {
  position: relative;
  min-height: 310vh;
  padding-top: var(--header-h);
  z-index: 2;
}

.wif-cinema-sticky {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: calc(var(--header-h) + 20px) var(--gutter) 32px;
}

/* HUD cinematográfico superior (indicador de escena + botón saltar) */
.wif-cinema-hud {
  position: absolute;
  top: calc(var(--header-h) + 14px);
  left: var(--gutter);
  right: var(--gutter);
  max-width: var(--maxw);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 12;
  pointer-events: none;
}

.wif-scene-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(5, 14, 32, 0.78);
  border: 1px solid rgba(54, 197, 255, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--chrome);
  pointer-events: auto;
}

.wif-scene-code {
  color: var(--gold-metal);
  font-variant-numeric: tabular-nums;
}

.wif-scene-track {
  width: 68px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.wif-scene-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-glow), var(--gold-metal));
  transform-origin: left center;
  transform: scaleX(0.05);
}

.wif-skip-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.36);
  background: rgba(5, 14, 32, 0.78);
  color: var(--gold-bright);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.wif-skip-btn:hover {
  background: rgba(255, 215, 0, 0.14);
  border-color: var(--gold-metal);
  transform: translateY(-2px);
}

/* Escenario 3D del logotipo (3 capas PNG/WebP transparentes exactas) */
.wif-cinema-inner {
  width: min(100%, var(--maxw));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: clamp(18px, 2.8vw, 32px);
  position: relative;
  z-index: 5;
}

.wif-logo-stage {
  position: relative;
  width: min(92vw, 680px);
  aspect-ratio: 16 / 8.4;
  perspective: 1200px;
  transform-style: preserve-3d;
  display: grid;
  place-items: center;
  pointer-events: none;
  margin-top: 12px;
}

/* Cuando Three.js WebGL dibuja las 3 capas directamente en el canvas 3D,
   mantenemos la altura del escenario para el balance del layout pero ocultamos
   el duplicado DOM para evitar doble dibujo. */
.wif-logo-stage.is-webgl-driven .wif-logo-layer,
.wif-logo-stage.is-webgl-driven .wif-logo-sheen {
  opacity: 0 !important;
  visibility: hidden;
}

.wif-logo-aura {
  position: absolute;
  inset: -12% 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 50%, rgba(255, 215, 0, 0.16), transparent 52%),
    radial-gradient(circle at 66% 50%, rgba(22, 139, 255, 0.22), transparent 58%);
  filter: blur(28px);
  pointer-events: none;
}

.wif-logo-layer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.55));
}

.wif-logo-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Posicionamiento final calibrado 1:1 con logo_assembly_check.png */
.wif-layer-frame,
.wif-layer-core {
  width: 41%;
  aspect-ratio: 1;
  margin-left: -46%;
  margin-top: -20.5%;
}

.wif-layer-wordmark {
  width: 51%;
  aspect-ratio: 1;
  margin-left: -4%;
  margin-top: -25.2%;
}

.wif-logo-sheen {
  position: absolute;
  inset: 4% 0;
  width: 24%;
  left: 38%;
  background: linear-gradient(90deg, transparent, rgba(255, 232, 133, 0.42), rgba(54, 197, 255, 0.28), transparent);
  filter: blur(8px);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}

/* Bloque editorial del Hero (siempre indexable en DOM, revelado en Escena 04) */
.wif-hero-content {
  width: min(100%, 920px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: clamp(18px, 2.6vw, 28px) clamp(18px, 3vw, 36px);
  border-radius: var(--r-l);
  background: linear-gradient(160deg, rgba(6, 18, 38, 0.78), rgba(3, 8, 20, 0.86));
  border: 1px solid rgba(125, 179, 240, 0.22);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  will-change: transform, opacity;
}

.wif-hero-content .brandline {
  justify-content: center;
  margin-bottom: 4px;
}

.wif-hero-content h1 {
  max-width: 20ch;
  font-size: clamp(28px, 4.1vw, 54px);
  margin: 0;
  letter-spacing: -0.035em;
  background: linear-gradient(180deg, #FFFFFF 0%, #D8E4F2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wif-hero-content .lead {
  max-width: 66ch;
  margin: 0;
  font-size: clamp(15.5px, 1.25vw, 18.5px);
  color: #C9D8EC;
}

.wif-hero-content .hero-ctas {
  justify-content: center;
  margin: 6px 0 4px;
}

.wif-hero-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(125, 179, 240, 0.16);
  width: 100%;
  font-size: 13.5px;
  color: var(--chrome);
}

.wif-hero-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.wif-hero-metrics strong {
  color: var(--gold-metal);
  font-weight: 700;
}

.wif-hero-content .hero-social {
  justify-content: center;
  margin-top: 2px;
}

.wif-scroll-cue {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(216, 228, 242, 0.72);
  pointer-events: none;
  z-index: 10;
}

.wif-scroll-mouse {
  width: 20px;
  height: 32px;
  border-radius: 99px;
  border: 1.5px solid rgba(54, 197, 255, 0.65);
  display: grid;
  justify-items: center;
  padding-top: 6px;
}

.wif-scroll-mouse span {
  width: 3px;
  height: 7px;
  border-radius: 99px;
  background: var(--gold-metal);
  animation: wifScrollDot 1.8s ease-in-out infinite;
}

@keyframes wifScrollDot {
  0%, 100% { transform: translateY(0); opacity: 1; }
  65% { transform: translateY(9px); opacity: 0.25; }
}

/* ---------- Riel de Progreso Narrativo (Desktop >= 1240px) ---------- */
.wif-chapter-rail {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 8px;
  border-radius: 999px;
  background: rgba(3, 8, 20, 0.72);
  border: 1px solid rgba(125, 179, 240, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.wif-rail-link {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  text-decoration: none;
  color: rgba(216, 228, 242, 0.55);
  transition: color 0.25s, background 0.25s;
}

.wif-rail-link::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  transition: transform 0.25s, background 0.25s, box-shadow 0.25s;
}

.wif-rail-link span {
  position: absolute;
  right: 38px;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(5, 14, 32, 0.94);
  border: 1px solid rgba(54, 197, 255, 0.28);
  color: var(--white);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  opacity: 0;
  pointer-events: none;
  transform: translateX(6px);
  transition: opacity 0.2s, transform 0.2s;
}

.wif-rail-link:hover span,
.wif-rail-link:focus-visible span {
  opacity: 1;
  transform: translateX(0);
}

.wif-rail-link.is-active {
  color: var(--gold-metal);
  background: rgba(255, 215, 0, 0.12);
}

.wif-rail-link.is-active::before {
  transform: scale(1.35);
  box-shadow: 0 0 12px var(--gold-metal);
}

@media (max-width: 1239px) {
  .wif-chapter-rail { display: none; }
}

/* ---------- Superficies translúcidas sobre el Universo 3D ---------- */
.surface-night,
.surface-light,
.surface-white {
  background: linear-gradient(180deg, rgba(6, 18, 38, 0.84) 0%, rgba(4, 11, 24, 0.90) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid rgba(54, 197, 255, 0.12);
}

.surface-light {
  background: linear-gradient(165deg, rgba(10, 29, 58, 0.82) 0%, rgba(5, 14, 32, 0.88) 100%);
}

.surface-white {
  background: linear-gradient(195deg, rgba(8, 24, 48, 0.84) 0%, rgba(4, 12, 26, 0.90) 100%);
}

/* ---------- FASE 4: ECOSISTEMA COMERCIAL DIFERENCIADO ---------- */
.service[data-universe="marketing"] {
  border-top: 2px solid var(--gold-metal);
  background: linear-gradient(155deg, rgba(255, 215, 0, 0.07), rgba(5, 14, 32, 0.86));
}
.service[data-universe="empresas"] {
  border-top: 2px solid var(--blue-electric);
  background: linear-gradient(155deg, rgba(0, 87, 184, 0.16), rgba(5, 14, 32, 0.86));
}
.service[data-universe="frontend"] {
  border-top: 2px solid var(--cyan-glow);
  background: linear-gradient(155deg, rgba(54, 197, 255, 0.12), rgba(5, 14, 32, 0.86));
}
.service[data-universe="ia"] {
  border-top: 2px solid var(--chrome);
  background: linear-gradient(155deg, rgba(216, 228, 242, 0.09), rgba(5, 14, 32, 0.88));
}

/* Banda de especialidades del Ecosistema WIF (SEO/AEO/GEO, 3D, Branding, E-Commerce) */
.wif-ecosystem-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.wif-eco-node {
  padding: 18px 18px 16px;
  border-radius: 12px;
  background: rgba(5, 14, 32, 0.72);
  border: 1px solid rgba(125, 179, 240, 0.18);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.3s, transform 0.3s var(--ease), box-shadow 0.3s;
}

.wif-eco-node:hover {
  border-color: rgba(255, 215, 0, 0.45);
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

.wif-eco-tag {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan-glow);
}

.wif-eco-node h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  color: var(--white);
}

.wif-eco-node p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2);
}

@media (max-width: 980px) {
  .wif-ecosystem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wif-cinema { min-height: 240vh; }
}

@media (max-width: 640px) {
  .wif-ecosystem-grid { grid-template-columns: 1fr; }
  .wif-cinema { min-height: 200vh; }
  .wif-cinema-sticky { padding: calc(var(--header-h) + 12px) 16px 24px; }
  .wif-cinema-hud { top: calc(var(--header-h) + 8px); left: 16px; right: 16px; }
  .wif-scene-track { display: none; }
  .wif-logo-stage { width: 94vw; aspect-ratio: 16 / 9.2; }
  .wif-hero-content { padding: 16px; }
}

/* ---------- Respeto estricto a prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .wif-cinema { min-height: auto; }
  .wif-cinema-sticky { position: relative; min-height: auto; padding-block: 40px 52px; }
  .wif-scroll-cue, .wif-scene-track { display: none; }
  .wif-logo-layer { transform: none !important; opacity: 1 !important; }
  .wif-hero-content { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }
}
