/* =====================================================================
   Inicio renovado (remake uxui fase 31): recorrido scroll-world
   Vista: application/views/pages_remake/inicio_v2/index.blade.php
   Script: assets/js/app_pages/inicio_v2.js

   Dos modos:
   - .mw--activo (lo agrega el script): escenario fijo, la camara avanza por las salas
     con el scroll y los capitulos llegan desde el fondo de la escena.
   - Sin la clase (sin JS o con "reducir movimiento"): capitulos apilados con su foto.
   ===================================================================== */

:root {
  --mw-noche: #1E1232;
  --mw-noche-2: #2C1B47;
  --mw-morado: #5C418A;
  --mw-lavanda: #8263B6;
  --mw-dorado: #DEBC80;
  --mw-crema: #FBF8F3;
  --mw-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --mw-texto: 'Poppins', Arial, sans-serif;
  --mw-facil: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- Botones del recorrido (formas nuevas: pildora con flecha que se estira) ---------- */
.mw-boton {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 30px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--mw-texto);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .02em;
  text-decoration: none !important;
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, transform .35s var(--mw-facil);
}
.mw-boton:hover { transform: translateY(-2px); }
.mw-boton:focus-visible { outline: 2px solid var(--mw-dorado); outline-offset: 4px; }
.mw-boton--claro {
  background: #FFFFFF;
  color: var(--mw-morado) !important;
}
.mw-boton--claro:hover { background: var(--mw-crema); }
.mw-boton--morado {
  background: var(--mw-morado);
  color: #FFFFFF !important;
}
.mw-boton--morado:hover { background: var(--mw-noche-2); }
.mw-flecha {
  position: relative;
  width: 22px;
  height: 1px;
  background: currentColor;
  transition: width .35s var(--mw-facil);
}
.mw-flecha::after {
  content: '';
  position: absolute;
  right: 0;
  top: -3px;
  width: 7px;
  height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}
.mw-boton:hover .mw-flecha { width: 34px; }

/* =====================================================================
   Version apilada (base: sin JS o con movimiento reducido)
   ===================================================================== */
.mw {
  position: relative;
  margin-top: calc(-1 * var(--navbar-site-h, 99px)); /* el header se fusiona con el recorrido */
  background: var(--mw-noche);
  color: #FFFFFF;
}
.mw-fondo,
.mw-portal,
.mw-arco,
.mw-luz,
.mw-rail,
.mw-cue {
  display: none;
}
.mw-capitulo {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 82vh;
  padding: calc(var(--navbar-site-h, 99px) + 40px) clamp(16px, 7vw, 120px) 72px;
  background-image:
    linear-gradient(90deg, rgba(30, 18, 50, .82) 0%, rgba(30, 18, 50, .45) 55%, rgba(30, 18, 50, .15) 100%),
    var(--foto);
  background-size: cover;
  background-position: center;
}
.mw-umbral {
  min-height: 100vh;
  align-items: center;
}
.mw-salida {
  min-height: 60vh;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-image: linear-gradient(rgba(255, 255, 255, .86), rgba(255, 255, 255, .94)), var(--foto);
  color: var(--mw-morado);
}
.mw-capitulo-contenido {
  position: relative;
  max-width: 640px;
}

/* ---------- Tipografia del recorrido ---------- */
.mw-antetitulo,
.mw-seccion-nombre {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  font-family: var(--mw-texto);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mw-dorado);
}
.mw-punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mw-dorado);
  box-shadow: 0 0 0 0 rgba(222, 188, 128, .6);
  animation: mw-latido 2.4s ease-out infinite;
}
@keyframes mw-latido {
  0% { box-shadow: 0 0 0 0 rgba(222, 188, 128, .55); }
  70% { box-shadow: 0 0 0 12px rgba(222, 188, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(222, 188, 128, 0); }
}
.mw-titulo,
.mw-frase {
  margin: 0;
  font-family: var(--mw-display);
  font-weight: 300;
  font-size: clamp(40px, 6.4vw, 96px);
  line-height: 1.02;
  letter-spacing: -.02em;
  color: #FFFFFF;
}
.mw-linea,
.mw-frase span,
.mw-frase em {
  display: block;
}
.mw-titulo em,
.mw-frase em {
  font-style: italic;
  color: var(--mw-dorado);
}
.mw-frase--oscura { color: var(--mw-noche); }
.mw-frase--oscura em { color: var(--mw-morado); }
.mw-parrafo {
  max-width: 460px;
  margin: 28px 0 0;
  font-family: var(--mw-texto);
  font-size: 17px;
  line-height: 1.65;
  color: rgba(255, 255, 255, .86);
}
.mw-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
  margin-top: 40px;
}
.mw-enlace-tel {
  font-family: var(--mw-texto);
  font-size: 15px;
  color: rgba(255, 255, 255, .9) !important;
  text-decoration: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, .4);
  padding-bottom: 2px;
  transition: border-color .3s ease;
}
.mw-enlace-tel:hover { border-color: var(--mw-dorado); }
.mw-numero {
  margin: 0 0 4px;
  font-family: var(--mw-display);
  font-weight: 300;
  font-size: clamp(72px, 10vw, 150px);
  line-height: .9;
  color: transparent;
  -webkit-text-stroke: 1px rgba(222, 188, 128, .85);
}
.mw-servicio-titulo {
  margin: 0 0 18px;
  font-family: var(--mw-display);
  font-weight: 400;
  font-size: clamp(36px, 4.6vw, 68px);
  line-height: 1.05;
  letter-spacing: -.015em;
  color: #FFFFFF;
}
.mw-servicio-texto {
  max-width: 470px;
  margin: 0 0 34px;
  font-family: var(--mw-texto);
  font-size: 17px;
  line-height: 1.65;
  color: rgba(255, 255, 255, .88);
}
.mw-salida .mw-boton { margin-top: 36px; }
/* inicio_site.css trae un h2 global (centrado, 7em, padding): no aplica a estos titulos */
.mw-servicio-titulo,
.mm-titulo {
  padding: 0;
  text-align: inherit;
}
.mw-recuerdo .mw-capitulo-contenido { max-width: 900px; }

/* =====================================================================
   Modo recorrido (scroll-world)
   ===================================================================== */
.mw--activo .mw-pista {
  height: 720vh;
}
.mw--activo .mw-escenario {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
.mw--activo .mw-fondo,
.mw--activo .mw-portal,
.mw--activo .mw-arco,
.mw--activo .mw-luz {
  display: block;
  position: absolute;
  inset: 0;
}
/* Noche: fondo del umbral alrededor de la ventana, con grano muy leve */
.mw--activo .mw-fondo {
  z-index: 0;
  background:
    radial-gradient(60% 55% at 50% 58%, rgba(130, 99, 182, .35), rgba(130, 99, 182, 0) 70%),
    linear-gradient(180deg, var(--mw-noche) 0%, var(--mw-noche-2) 100%);
}
.mw--activo .mw-fondo::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Ventana en arco: el script anima su recorte (clip-path) hasta la pantalla completa */
.mw--activo .mw-portal {
  z-index: 1;
  overflow: hidden;
  will-change: clip-path;
}
.mw-camara {
  position: absolute;
  inset: -2%;
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0) scale(var(--zoom, 1.08));
  will-change: transform;
}
.mw-poster,
.mw-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mw-video {
  opacity: 0;
  transition: opacity .8s ease;
}
.mw--video-listo .mw-video { opacity: 1; }
/* Sombra pareja mientras el texto va centrado sobre la escena (umbral y recuerdo) */
.mw--activo .mw-portal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(30, 18, 50, .5);
  opacity: var(--sombra, 1);
}
/* Velo para leer el texto: izquierda y abajo en escritorio */
.mw-velo {
  position: absolute;
  inset: 0;
  opacity: var(--velo, 0);
  background:
    linear-gradient(90deg, rgba(30, 18, 50, .82) 0%, rgba(30, 18, 50, .5) 38%, rgba(30, 18, 50, 0) 68%),
    linear-gradient(0deg, rgba(30, 18, 50, .45) 0%, rgba(30, 18, 50, 0) 40%);
}
/* Contorno dorado del arco: se abre con la ventana y se desvanece */
.mw--activo .mw-arco {
  z-index: 2;
  inset: auto;
  border: 1px solid rgba(222, 188, 128, .7);
  border-bottom: 0;
  pointer-events: none;
  will-change: transform, opacity;
}
/* Luz del final: la camara llega a los ventanales y la escena se vuelve blanca */
.mw--activo .mw-luz {
  z-index: 3;
  opacity: var(--luz, 0);
  background: radial-gradient(120% 90% at 62% 45%, #FFFFFF 0%, rgba(255, 255, 255, .96) 45%, #FFFFFF 100%);
  pointer-events: none;
}

/* Espacio 3D de los capitulos: cada capitulo tiene su propia perspectiva y el script mueve su
   contenido en profundidad (translateZ), su opacidad y un leve giro que sigue al cursor. */
.mw--activo .mw-mundo3d {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.mw--activo .mw-capitulo {
  position: absolute;
  inset: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  padding: 72px clamp(24px, 7vw, 140px) 0;
  background: none;
  visibility: hidden;
  perspective: 1100px;
  perspective-origin: 50% 45%;
}
.mw--activo .mw-capitulo.is-presente { visibility: visible; }
.mw--activo .mw-capitulo.is-activo { pointer-events: auto; }
.mw--activo .mw-capitulo-contenido {
  opacity: 0;
  will-change: transform, opacity;
}
.mw--activo .mw-umbral {
  justify-content: center;
  text-align: center;
}
.mw--activo .mw-umbral .mw-capitulo-contenido { max-width: 980px; }
.mw--activo .mw-umbral .mw-acciones { justify-content: center; }
.mw--activo .mw-umbral .mw-titulo {
  text-shadow: 0 2px 40px rgba(30, 18, 50, .55);
}
.mw--activo .mw-recuerdo { justify-content: flex-end; text-align: right; }
.mw--activo .mw-recuerdo .mw-parrafo { margin-left: auto; }
.mw--activo .mw-recuerdo .mw-frase { text-shadow: 0 2px 30px rgba(30, 18, 50, .5); }
.mw--activo .mw-salida {
  justify-content: center;
  text-align: center;
}
.mw--activo .mw-salida .mw-frase { font-size: clamp(40px, 5.6vw, 84px); }

/* Indice del recorrido */
.mw--activo .mw-rail {
  display: block;
  position: absolute;
  z-index: 5;
  right: clamp(16px, 2.6vw, 44px);
  top: 50%;
  transform: translateY(-50%);
  opacity: var(--rail, 0);
  transition: opacity .4s ease;
}
.mw-rail ol {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.mw-rail-paso {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: rgba(255, 255, 255, .7);
  font-family: var(--mw-texto);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.mw-rail-paso::after {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: transparent;
  transition: background-color .3s ease, transform .3s ease;
}
.mw-rail-texto {
  opacity: 0;
  transform: translateX(6px);
  transition: opacity .3s ease, transform .3s ease;
  white-space: nowrap;
}
.mw-rail-paso:hover .mw-rail-texto,
.mw-rail-paso:focus-visible .mw-rail-texto,
.mw-rail-paso.is-activo .mw-rail-texto {
  opacity: 1;
  transform: none;
}
.mw-rail-paso.is-activo { color: #FFFFFF; }
.mw-rail-paso.is-activo::after {
  background: var(--mw-dorado);
  border-color: var(--mw-dorado);
  transform: scale(1.25);
}
.mw-rail-paso:focus-visible { outline: none; }
.mw-rail-paso:focus-visible::after { box-shadow: 0 0 0 3px rgba(222, 188, 128, .6); }
.mw-rail-linea {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(255, 255, 255, .25);
}
.mw-rail-linea span {
  position: absolute;
  inset: 0;
  background: var(--mw-dorado);
  transform-origin: top;
  transform: scaleY(var(--avance, 0));
}

/* Indicador para bajar */
.mw--activo .mw-cue {
  display: flex;
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 34px;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
  opacity: var(--cue, 1);
  color: rgba(255, 255, 255, .85) !important;
  text-decoration: none !important;
  font-family: var(--mw-texto);
  font-size: 12px;
  letter-spacing: .24em;
  text-transform: uppercase;
  white-space: nowrap;
}
.mw-cue-linea {
  position: relative;
  width: 1px;
  height: 46px;
  overflow: hidden;
  background: rgba(255, 255, 255, .25);
}
.mw-cue-linea::after {
  content: '';
  position: absolute;
  left: 0;
  top: -100%;
  width: 1px;
  height: 100%;
  background: var(--mw-dorado);
  animation: mw-cue 2.2s var(--mw-facil) infinite;
}
@keyframes mw-cue {
  0% { top: -100%; }
  60% { top: 100%; }
  100% { top: 100%; }
}

/* ---------- Movil del recorrido: texto abajo, sin indice lateral ---------- */
@media (max-width: 991.98px) {
  .mw--activo .mw-pista { height: 600vh; }
  .mw--activo .mw-capitulo {
    align-items: flex-end;
    padding: 96px 20px 110px;
  }
  .mw--activo .mw-recuerdo { justify-content: flex-start; text-align: left; }
  .mw--activo .mw-recuerdo .mw-parrafo { margin-left: 0; }
  .mw--activo .mw-umbral { align-items: center; padding-bottom: 40px; }
  .mw--activo .mw-salida { align-items: center; padding-bottom: 40px; }
  .mw-velo {
    background: linear-gradient(0deg, rgba(30, 18, 50, .9) 0%, rgba(30, 18, 50, .55) 45%, rgba(30, 18, 50, .1) 75%);
  }
  .mw--activo .mw-rail { display: none; }
  .mw-servicio-texto,
  .mw-parrafo { font-size: 16px; }
  .mw-servicio-texto { margin-bottom: 26px; }
  .mw-numero { font-size: 64px; }
  .mw-acciones { margin-top: 30px; }
}
@media (max-width: 575.98px) {
  .mw-boton { min-height: 50px; padding: 0 24px; }
  .mw-umbral .mw-boton { width: 100%; justify-content: center; }
  .mw-acciones { flex-direction: column; }
}

/* =====================================================================
   Libro de Memorias: muro de recuerdos
   ===================================================================== */
.mm {
  position: relative;
  background: #FFFFFF;
  color: var(--mw-noche);
}
.mm-escenario {
  position: relative;
  padding: 88px 0 72px;
}
.mm-encabezado {
  padding: 0 clamp(16px, 7vw, 120px);
  max-width: 560px;
  box-sizing: content-box;
}
.mm-antetitulo {
  margin: 0 0 14px;
  font-family: var(--mw-texto);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mw-lavanda);
}
.mm-titulo {
  margin: 0 0 18px;
  font-family: var(--mw-display);
  font-weight: 300;
  font-size: clamp(42px, 5vw, 76px);
  line-height: 1.02;
  letter-spacing: -.02em;
  color: var(--mw-noche);
}
.mm-titulo em {
  font-style: italic;
  color: var(--mw-morado);
}
.mm-texto {
  margin: 0 0 30px;
  font-family: var(--mw-texto);
  font-size: 16px;
  line-height: 1.65;
  color: #5B5566;
}
.mm-ventana {
  margin-top: 48px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mm-ventana::-webkit-scrollbar { display: none; }
.mm-fila {
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 10px clamp(16px, 7vw, 120px) 24px;
  list-style: none;
  width: max-content;
}
.mm-item {
  flex: 0 0 auto;
  width: 280px;
  scroll-snap-align: center;
}
.mm-item .card-memories { margin: 0 auto; }
.mm-progreso { display: none; }

/* Escritorio con movimiento: el muro avanza de lado con el scroll y gira como en un pasillo */
@media (min-width: 992px) {
  .mm--recorrido .mm-pista { height: var(--mm-alto, 200vh); }
  .mm--recorrido .mm-escenario {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    padding: 72px 0 0;
    overflow: hidden;
  }
  .mm--recorrido .mm-encabezado {
    position: absolute;
    z-index: 2;
    left: 0;
    top: 50%;
    box-sizing: border-box;
    width: 38vw;
    max-width: none;
    padding: 0 3vw 0 clamp(16px, 7vw, 120px);
    transform: translateY(-46%);
  }
  .mm--recorrido .mm-ventana {
    position: relative;
    z-index: 1;
    width: 100%;
    margin: 0;
    overflow: visible;
    perspective: 1400px;
    /* las tarjetas se desvanecen antes de llegar al encabezado */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, transparent 36vw, #000 44vw, #000 calc(100% - 4vw), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, transparent 36vw, #000 44vw, #000 calc(100% - 4vw), transparent 100%);
  }
  .mm--recorrido .mm-fila {
    padding: 30px 0 30px 44vw;
    transform: translate3d(var(--mm-x, 0px), 0, 0);
    transform-style: preserve-3d;
    will-change: transform;
  }
  .mm--recorrido .mm-item {
    transform: rotateY(var(--giro, 0deg)) translateZ(var(--fondo, 0px));
    transform-origin: center;
    opacity: var(--alfa, 1);
    will-change: transform;
  }
  .mm--recorrido .mm-progreso {
    display: block;
    position: absolute;
    left: 44vw;
    right: 6vw;
    bottom: 56px;
    height: 1px;
    background: rgba(92, 65, 138, .15);
  }
  .mm--recorrido .mm-progreso span {
    position: absolute;
    inset: 0;
    background: var(--mw-morado);
    transform-origin: left;
    transform: scaleX(var(--mm-avance, 0));
  }
}

/* Entrada de las secciones compartidas: solo un poco de aire entre bloques */
.mw-resto { position: relative; background: #FFFFFF; }

@media (prefers-reduced-motion: reduce) {
  .mw-punto,
  .mw-cue-linea::after { animation: none; }
  .mw-boton,
  .mw-flecha { transition: none; }
}
