/* ═══════════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100svh; background: #000; }
body {
  width: 100%;
  min-height: 100svh;
  background: #0a0a0a;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* ═══════════════════════════════════════════════════
   STAGE — llena toda la pantalla; el póster cuadrado
   se recorta (object-fit:cover) para cubrir el alto
   completo, igual que la escena de apertura. El footer
   queda debajo, fuera de la vista inicial (con scroll).
═══════════════════════════════════════════════════ */
#stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100svh; /* respaldo hasta que corra el JS */
  overflow: hidden;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
}
/* JS fija --stage-h en píxeles reales una sola vez, ignorando
   el redimensionado que dispara la barra del navegador al
   esconderse/aparecer durante el scroll (evita el "salto") */
.alto-fijado #stage { height: var(--stage-h); }

.poster-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#escena-apertura {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════
   ESCENA 1 — apertura cinemática
═══════════════════════════════════════════════════ */
.grano {
  position: absolute;
  inset: -10%;
  z-index: 2;
  pointer-events: none;
  opacity: .18;
  background-image: radial-gradient(rgba(255,255,255,.9) .6px, transparent .6px);
  background-size: 3px 3px;
  animation: granoTitila .2s steps(1) infinite;
}
@keyframes granoTitila {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(-1.5%,1%); }
  50%  { transform: translate(1%,-1.5%); }
  75%  { transform: translate(-1%,-1%); }
  100% { transform: translate(1.5%,1%); }
}
.cargando .grano { animation-play-state: paused; }

.vineta-negra {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 18vw 4vw rgba(0,0,0,.85);
}

#burbujas-intro {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.titulo-wrap {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 0 8%;
}
.titulo-don {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: clamp(30px, 10.5vw, 50px);
  letter-spacing: 6px;
  color: #f4f4f4;
  text-shadow: 0 0 14px rgba(255,255,255,.35), 0 2px 3px rgba(0,0,0,.8);
  opacity: 0;
  transform: translateY(14px) scale(.94);
  animation: tituloEntra .8s .25s cubic-bezier(.2,.8,.25,1) forwards;
}
.titulo-anos {
  font-family: 'Alex Brush', cursive;
  font-size: clamp(38px, 13vw, 62px);
  color: #d9b968;
  text-shadow: 0 0 18px rgba(217,185,104,.5), 0 2px 4px rgba(0,0,0,.8);
  opacity: 0;
  transform: translateY(10px) scale(.92);
  animation: tituloEntra .8s .95s cubic-bezier(.2,.8,.25,1) forwards;
}
.titulo-linea {
  width: 0;
  height: 1.5px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, #d9b968, transparent);
  opacity: 0;
  animation: lineaCrece 1s 1.6s ease forwards;
}
@keyframes tituloEntra {
  0%   { opacity: 0; transform: translateY(14px) scale(.94); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes lineaCrece {
  0%   { width: 0; opacity: 0; }
  30%  { opacity: 1; }
  100% { width: 46%; opacity: 1; }
}
.cargando .titulo-don,
.cargando .titulo-anos,
.cargando .titulo-linea { animation-play-state: paused; }

#escena-apertura {
  animation: apMuere .55s 3.9s ease forwards;
}
.cargando #escena-apertura { animation-play-state: paused; }
@keyframes apMuere {
  0%   { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* ═══════════════════════════════════════════════════
   DESTELLO DE TRANSICIÓN — brindis / choque de tarros
═══════════════════════════════════════════════════ */
#destello-transicion {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(circle, #fff7e0 0%, #d9b968 32%, rgba(217,185,104,0) 72%);
  opacity: 0;
  animation: destelloPop .7s 3.75s cubic-bezier(.2,.8,.2,1) forwards;
}
.cargando #destello-transicion { animation-play-state: paused; }
@keyframes destelloPop {
  0%   { opacity: 0;   transform: scale(.3); }
  35%  { opacity: 1;   transform: scale(1.15); }
  100% { opacity: 0;   transform: scale(1.9); }
}

/* ═══════════════════════════════════════════════════
   ESCENA 2 — póster final con Ken Burns
═══════════════════════════════════════════════════ */
.poster-wrap {
  z-index: 20;
  opacity: 0;
  animation: finalEntra .9s 3.85s cubic-bezier(.2,.8,.2,1) forwards;
}
.cargando .poster-wrap { animation-play-state: paused; }
@keyframes finalEntra {
  0%   { opacity: 0; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

.poster-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transform-origin: center center;
  transform: scale(1.06);
  animation: kenBurns 12s ease-in-out infinite alternate;
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.cargando .poster-bg { animation-play-state: paused; }
@keyframes kenBurns {
  0%   { transform: scale(1.06) translate(0%, 0.2%); }
  50%  { transform: scale(1.11) translate(-1%, -0.6%); }
  100% { transform: scale(1.07) translate(0.8%, 0.3%); }
}

.poster-vino {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 10vw 1vw rgba(0,0,0,.55);
}

/* ═══════════════════════════════════════════════════
   PARTÍCULAS AMBIENTE — burbujas de cerveza + destellos plata
   (arrancan junto con la escena final, en bucle continuo)
═══════════════════════════════════════════════════ */
#particulas {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  animation: particulasAparece .6s 4.1s ease forwards;
}
.cargando #particulas { animation-play-state: paused; }
@keyframes particulasAparece { to { opacity: 1; } }

.burbuja {
  position: absolute;
  bottom: -8%;
  border-radius: 50%;
  border: 1.2px solid rgba(255,255,255,.55);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.5), rgba(255,255,255,.05) 60%);
  opacity: 0;
  animation: burbujaSube var(--dur, 7s) var(--delay, 0s) ease-in-out infinite;
}
.cargando .burbuja { animation-play-state: paused; }
@keyframes burbujaSube {
  0%   { opacity: 0;  transform: translate(0,0) scale(.6); }
  10%  { opacity: .8; }
  60%  { opacity: .6; transform: translate(var(--dx, 10px), -70%) scale(1); }
  100% { opacity: 0;  transform: translate(calc(var(--dx, 10px) * 1.6), -125%) scale(.8); }
}

.destello-plata {
  position: absolute;
  border-radius: 50%;
  background: #f2f2f2;
  box-shadow: 0 0 6px 1.5px rgba(255,255,255,.9);
  opacity: 0;
  animation: plataTitila var(--dur, 2.6s) var(--delay, 0s) ease-in-out infinite;
}
.cargando .destello-plata { animation-play-state: paused; }
@keyframes plataTitila {
  0%, 100% { opacity: 0;  transform: scale(.4); }
  50%      { opacity: .95; transform: scale(1.1); }
}

/* ═══════════════════════════════════════════════════
   BARRA DE ACCIONES
═══════════════════════════════════════════════════ */
#botones-layer {
  flex-shrink: 0;
  position: relative;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 3.2% 5% calc(3.2% + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #1c1c1c 0%, #050505 100%);
  border-top: 2px solid #d9b968;
  box-shadow: 0 -6px 14px rgba(0,0,0,.5);
  opacity: 0;
  transform: translateY(14px);
  animation: barraAparece .8s 4.6s cubic-bezier(.2,.7,.2,1) forwards;
}
.cargando #botones-layer { animation-play-state: paused; }
@keyframes barraAparece { to { opacity: 1; transform: translateY(0); } }

.btn-tap {
  flex: 0 1 auto;
  width: 55%;
  max-width: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  text-decoration: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #3a3a3a 0%, #161616 100%);
  border: 1.5px solid #d9b968;
  box-shadow: 0 3px 0 #000, inset 0 1px 0 rgba(255,255,255,.12);
  -webkit-tap-highlight-color: transparent;
  outline: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-tap:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #000, inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-tap svg { width: 22px; height: 22px; fill: #d9b968; flex-shrink: 0; }
.btn-tap span {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #f2f2f2;
  text-align: center;
}

/* ═══════════════════════════════════════════════════
   LOADER
═══════════════════════════════════════════════════ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .5s ease;
}
#loader.oculto { opacity: 0; pointer-events: none; }
#loader-puntos { display: flex; gap: 8px; }
.l-punto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9b968;
  animation: lPulso .9s ease-in-out infinite;
}
.l-punto:nth-child(2) { animation-delay: .15s; }
.l-punto:nth-child(3) { animation-delay: .3s; }
@keyframes lPulso {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50%      { opacity: 1;  transform: scale(1.2); }
}

/* ═══════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════ */
#footer-inv {
  flex-shrink: 0;
  width: 100%;
  max-width: 480px;
  padding: 6px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: #0a0a0a;
}
#footer-inv p {
  font-family: 'Oswald', sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: #8a8a8a;
  line-height: 1.5;
  letter-spacing: .2px;
}
#footer-inv a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-family: 'Oswald', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: #d9b968;
  text-decoration: none;
  transition: opacity .2s;
}
#footer-inv a:hover { opacity: .65; }
#footer-inv a svg   { width: 10px; height: 10px; flex-shrink: 0; }
