/* Idea 2 v2 — Persiana atardecer
   Duración total: 1.8 s. Solo se animan transform y opacity.
   El JS clona #bienvenida en dos mitades e inyecta la costura neón.
   No hace falta cambiar el HTML del sitio. */

.bienvenida {
  transition: none;
}

.bienvenida.euphoria-animando,
.euphoria-hoja.euphoria-animando,
.euphoria-costura.euphoria-animando,
#pagina.euphoria-animando,
main.euphoria-animando,
html.euphoria-enter .hero .eyebrow,
html.euphoria-enter .hero h1,
html.euphoria-enter .hero .lead,
html.euphoria-enter .hero .btn-neon,
html.euphoria-enter .site-header,
.euphoria-hoja .bienvenida-palms {
  will-change: transform, opacity;
}

/* Oculta el overlay original en el mismo instante en que aparecen las hojas. */
.bienvenida.euphoria-oculto-instante {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  animation: none;
  transition: none;
}

.euphoria-hoja {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  z-index: 90;
  pointer-events: none;
}

.euphoria-hoja-sup { top: 0; }
.euphoria-hoja-inf { bottom: 0; }

.euphoria-hoja .bienvenida {
  display: flex;
  position: absolute;
  left: 0;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  opacity: 1;
  animation: none;
  visibility: visible;
  z-index: 0; /* anula el z-index: 80 del overlay, para que la costura quede encima */
  overflow: visible; /* el cielo extra no debe recortarse durante el anticipo */
  transform-origin: 50% 50%;
}

.euphoria-hoja-sup .bienvenida { top: 0; }
.euphoria-hoja-inf .bienvenida { top: -50vh; }

/* El cielo se extiende un poco para que el anticipo (scaleY) no deje huecos. */
.euphoria-hoja .bienvenida-sky {
  top: -18%;
  bottom: -18%;
}

/* Costura neón totalmente DENTRO de cada mitad (overflow:hidden no la recorta).
   Al inicio las dos líneas se juntan en una franja al centro; al abrir, cada
   filo se lleva la suya y el corte se lee limpio e intencional. */
.euphoria-costura {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  z-index: 5;
  pointer-events: none;
  transform: scaleX(0.12);
  opacity: 0;
  transform-origin: 50% 50%;
  background: linear-gradient(90deg, #ff3ea5 0%, #7af6f4 42%, #ffffff 50%, #7af6f4 58%, #ff3ea5 100%);
}

.euphoria-costura::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -5px;
  height: 14px;
  background: linear-gradient(90deg, #ff3ea5 0%, #7af6f4 50%, #ff3ea5 100%);
  opacity: 0.5;
}

.euphoria-hoja-sup .euphoria-costura { bottom: 0; }
.euphoria-hoja-inf .euphoria-costura { top: 0; }

.euphoria-costura.is-on {
  animation: euphoria-costura 0.36s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* Logo y lema suben y se desvanecen al empezar, para que el corte no parta letras. */
.euphoria-hoja.is-out .bienvenida-logo {
  animation: euphoria-logo-arriba 0.38s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.euphoria-hoja.is-out .bienvenida-tagline {
  animation: euphoria-logo-arriba 0.36s cubic-bezier(0.4, 0, 0.2, 1) 0.04s both;
}

/* Pulso de pulsación en ENTRAR (opaco) y luego se evapora para no tapar la costura. */
.euphoria-hoja.is-out .bienvenida-entrar,
html.euphoria-enter .bienvenida-entrar {
  animation: euphoria-boton-pulso 0.52s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.euphoria-hoja-sup.is-out {
  animation: euphoria-hoja-arriba 1.8s both;
}

.euphoria-hoja-inf.is-out {
  animation: euphoria-hoja-abajo 1.8s both;
}

.euphoria-hoja-sup.is-out .bienvenida,
.euphoria-hoja-inf.is-out .bienvenida {
  animation: euphoria-anticipo-inner 1.8s both;
}

/* Parallaje suave: las palmeras se adelantan un poco al cielo de su mitad. */
.euphoria-hoja-sup.is-out .bienvenida-palms {
  animation: euphoria-palmas-sup 1.48s cubic-bezier(0.7, 0, 0.2, 1) 0.32s both;
}

.euphoria-hoja-inf.is-out .bienvenida-palms {
  animation: euphoria-palmas-inf 1.48s cubic-bezier(0.7, 0, 0.2, 1) 0.32s both;
}

html.euphoria-enter #pagina,
html.euphoria-enter main.euphoria-pagina {
  animation: euphoria-pagina-asienta 1.2s cubic-bezier(0.7, 0, 0.2, 1) 0.7s both;
}

/* El header entra cuando la hoja de arriba ya lo dejó al descubierto. */
html.euphoria-enter .site-header {
  animation: euphoria-stagger 0.58s cubic-bezier(0.22, 0.61, 0.36, 1) 1.12s both;
}

html.euphoria-enter .hero .eyebrow {
  animation: euphoria-stagger 0.64s cubic-bezier(0.22, 0.61, 0.36, 1) 0.82s both;
}

html.euphoria-enter .hero h1 {
  animation: euphoria-stagger 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) 0.94s both;
}

html.euphoria-enter .hero .lead {
  animation: euphoria-stagger 0.64s cubic-bezier(0.22, 0.61, 0.36, 1) 1.08s both;
}

html.euphoria-enter .hero .btn-neon {
  animation: euphoria-stagger 0.58s cubic-bezier(0.22, 0.61, 0.36, 1) 1.2s both;
}

/* 0–18% (~320 ms): anticipo, se comprimen hacia el centro.
   El resto: se abren con ease-out cubic-bezier(.7,0,.2,1). */
@keyframes euphoria-hoja-arriba {
  0% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
  }
  18% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.7, 0, 0.2, 1);
  }
  100% {
    transform: translateY(-100%);
  }
}

@keyframes euphoria-hoja-abajo {
  0% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
  }
  18% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.7, 0, 0.2, 1);
  }
  100% {
    transform: translateY(100%);
  }
}

@keyframes euphoria-anticipo-inner {
  0% {
    transform: scaleY(1);
    animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
  }
  18% {
    transform: scaleY(0.982);
    animation-timing-function: cubic-bezier(0.7, 0, 0.2, 1);
  }
  100% {
    transform: scaleY(1);
  }
}

@keyframes euphoria-costura {
  0% { transform: scaleX(0.12); opacity: 0; }
  38% { transform: scaleX(1); opacity: 1; }
  58% { transform: scaleX(1); opacity: 0.55; }
  100% { transform: scaleX(1); opacity: 1; }
}

@keyframes euphoria-logo-arriba {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-24px); opacity: 0; }
}

@keyframes euphoria-boton-pulso {
  0% { transform: scale(1); opacity: 1; }
  22% { transform: scale(0.92); opacity: 1; }
  42% { transform: scale(1.06); opacity: 1; }
  62% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes euphoria-palmas-sup {
  from { transform: translateY(0); }
  to { transform: translateY(-4%); }
}

@keyframes euphoria-palmas-inf {
  from { transform: translateY(0); }
  to { transform: translateY(4%); }
}

@keyframes euphoria-pagina-asienta {
  from { transform: scale(1.03); }
  to { transform: scale(1); }
}

@keyframes euphoria-stagger {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes euphoria-fade-simple {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bienvenida.euphoria-animando,
  .euphoria-hoja.euphoria-animando,
  .euphoria-costura.euphoria-animando,
  #pagina.euphoria-animando,
  main.euphoria-animando,
  html.euphoria-enter .hero .eyebrow,
  html.euphoria-enter .hero h1,
  html.euphoria-enter .hero .lead,
  html.euphoria-enter .hero .btn-neon,
  html.euphoria-enter .site-header,
  .euphoria-hoja .bienvenida-palms {
    will-change: auto;
  }

  .euphoria-hoja,
  .euphoria-costura { display: none; }

  .bienvenida.euphoria-oculto-instante {
    visibility: visible;
    opacity: 1;
  }

  .bienvenida.euphoria-salida {
    pointer-events: none;
    visibility: visible;
    animation: euphoria-fade-simple 0.25s ease both;
  }

  html.euphoria-enter .bienvenida-entrar,
  html.euphoria-enter .site-header,
  html.euphoria-enter .hero .eyebrow,
  html.euphoria-enter .hero h1,
  html.euphoria-enter .hero .lead,
  html.euphoria-enter .hero .btn-neon,
  html.euphoria-enter #pagina,
  html.euphoria-enter main.euphoria-pagina {
    animation: none;
    transform: none;
    opacity: 1;
  }
}
