/* ===== Lenis smooth scroll (CSS recomendado) ===== */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ===== Base ===== */
body { background: #000019; }

/* ===== Header overlay transparente sobre el hero ===== */
#masthead {
  position: absolute;
  top: 0; left: 0; width: 100%;
  z-index: 100;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}
#atlas-header { background: transparent !important; }

/* Desktop: menú nativo en una sola línea */
@media (min-width: 768px) {
  #atlas-header .elementor-widget-navigation-menu { width: auto; max-width: none; }
  #atlas-header .hfe-nav-menu { flex-wrap: nowrap; }
  #atlas-header .hfe-nav-menu > li { white-space: nowrap; }
}

/* Móvil: logo + hamburguesa en la misma fila; el desplegable HFE se apila vertical */
@media (max-width: 767px) {
  #atlas-header, #atlas-header > .e-con-inner {
    flex-wrap: nowrap !important;
    align-items: center !important;
  }
  #atlas-header .elementor-widget-navigation-menu { flex: 1 1 0% !important; min-width: 0 !important; }
}
/* link activo / hover del nav nativo */
#atlas-header .elementor-button { transition: opacity .25s ease; }
#atlas-header .elementor-button:hover { opacity: .7; }

/* ===== Loader sutil y liviano: velo muy tenue + spinner pequeño (sin backdrop-filter) ===== */
.atlas-loader {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 1, 15, 0.12);
  transition: opacity .5s ease;
}
.atlas-loader.is-hidden { opacity: 0; pointer-events: none; }
.atlas-loader__box { display: flex; align-items: center; justify-content: center; }
.atlas-loader__txt { display: none; }
.atlas-loader__spinner {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.85);
  animation: atlas-spin .7s linear infinite;
}
@keyframes atlas-spin { to { transform: rotate(360deg); } }

/* ===== Hero scrub ===== */
/* El contenedor #atlas-hero es el "track" (alto grande).
   #atlas-hero-sticky se queda fijo mientras el video se reproduce con el scroll. */
/* Altura del track = cuánto scroll cuesta completar el hero y llegar a "la manito".
   Elementor la deja en 320vh; la bajamos aquí (ID gana en especificidad) para que
   la transición sea más inmediata. Ajustar este valor sube/baja el scroll necesario:
   menos vh = la manito aparece antes. */
#atlas-hero { --min-height: 180vh; }

.atlas-sticky {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh; /* altura visible real en móvil (evita el desfase por la barra del navegador) */
  width: 100%;
  overflow: hidden;
}
.atlas-hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 36% center;
  z-index: 0;
  pointer-events: none;
}
/* Canvas de la secuencia de imágenes (el encuadre/cover se calcula en JS) */
.atlas-hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  /* Entrada elegante del primer frame: fade in + subida */
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1.1s ease, transform 1.3s cubic-bezier(.2, .7, .2, 1);
}
.atlas-hero__canvas.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .atlas-hero__canvas { transition: opacity .5s ease; transform: none; }
}
.atlas-hero__vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 0%, transparent 42%, rgba(0,0,25,.5) 100%),
    linear-gradient(to bottom, rgba(0,0,25,.45) 0%, transparent 26%, transparent 62%, rgba(0,0,25,.92) 100%);
}

/* Las "stages" de texto van por encima del video (overlay absoluto) */
.atlas-stage { z-index: 2; }
.atlas-sticky .atlas-stage--1 {
  position: absolute !important;
  top: calc(50% - 120px); left: 50%;
  transform: translate(-50%, -50%);
  width: min(820px, 88vw);
  text-align: center;
}
.atlas-sticky .atlas-stage--2 {
  position: absolute !important;
  top: 50%; left: 60%;
  transform: translateY(-50%);
  width: min(36vw, 520px);
  text-align: left;
  opacity: 0;
}
.atlas-scroll-hint {
  position: absolute; bottom: 34px; left: 50%;
  transform: translateX(-50%);
  z-index: 2; color: rgba(255,255,255,.5);
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
}

@media (max-width: 820px) {
  .atlas-hero__video { object-position: center; }
  /* Usamos el ID #atlas-hero-sticky para ganar a los selectores de Elementor (id > clases).
     Ancho/centrado explícitos: el contenedor flex dejaba el texto más ancho y se cortaba. */
  #atlas-hero-sticky .atlas-stage--1 {
    width: 86vw !important; max-width: 86vw !important;
    margin-left: auto !important; margin-right: auto !important;
  }
  /* Los hijos deben ocupar el 100% de la caja de contenido del padre.
     Si se les pone 86vw también, se salen por la derecha el equivalente
     al padding del contenedor y el texto queda descentrado. */
  #atlas-hero-sticky .atlas-stage--1 > .elementor-element {
    width: 100% !important; max-width: 100% !important;
    margin-left: 0 !important; margin-right: 0 !important;
  }
  /* Título: interlineado ajustado, tamaño seguro y wrap forzado (la tipografía traía
     line-height en px y nowrap pensados para desktop). */
  #atlas-hero-sticky .atlas-stage--1 .elementor-heading-title {
    font-size: 42px !important;
    line-height: 1.06 !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    text-align: center !important;
  }
  /* Subtítulo más compacto para que entre centrado en la parte negra */
  #atlas-hero-sticky .atlas-stage--1 .elementor-widget-text-editor,
  #atlas-hero-sticky .atlas-stage--1 .elementor-widget-text-editor p {
    font-size: 15px !important; line-height: 1.45 !important; text-align: center !important;
  }
  .atlas-sticky .atlas-stage--2 {
    left: 50%; top: auto; bottom: 9%;
    transform: translateX(-50%);
    width: 88vw; text-align: center;
  }
}

/* ===== Soluciones · hero en móvil =====
   El contenedor tiene min-height 720px y centra el contenido verticalmente.
   En móvil el contenido se apila (~343px), así que quedaban ~190px de hueco
   sobre el título. Lo alineamos arriba con un respiro; el planeta del fondo
   gana espacio por debajo. */
@media (max-width: 820px) {
  #soluciones-hero > .e-con-inner {
    justify-content: flex-start !important;
    padding-top: 40px !important;
  }
}

/* ===== Footer · menú "Enlaces" (HFE nav vertical, id d5f9070) =====
   SOLO tocamos el móvil: centrado. En escritorio se deja EXACTAMENTE como estaba.
   Los enlaces de HFE son flex, por eso usamos justify-content (no text-align),
   y forzamos ancho completo de nav/ul/li para que el centrado tenga espacio. */
@media (max-width: 767px) {
  .elementor-element-d5f9070 { width: 100% !important; }
  .elementor-element-d5f9070 nav.hfe-nav-menu__layout-vertical,
  .elementor-element-d5f9070 ul.hfe-nav-menu,
  .elementor-element-d5f9070 ul.hfe-nav-menu > li.menu-item { width: 100% !important; }
  .elementor-element-d5f9070 .hfe-nav-menu a.hfe-menu-item {
    justify-content: center !important; text-align: center !important;
  }
}

/* ===== Reveals ===== */
.atlas-reveal { opacity: 0; transform: translateY(34px); will-change: transform, opacity; }

/* En el editor de Elementor no queremos nada oculto */
.elementor-editor-active .atlas-reveal,
.elementor-editor-active .atlas-stage--2 { opacity: 1 !important; transform: none !important; }
