/* ═══ Maricela Birthday — póster único + hotspots (negro/dorado) ═══ */
:root {
  --oro: #d9b85f;
  --oro-claro: #f3e3a5;
  --negro: #000;
  /* Alto de pantalla FIJO: app.js lo fija al cargar (y solo al girar el teléfono). Evita que el póster se reescale
     cuando la barra del navegador se oculta/aparece al hacer scroll. Fallback: svh (alto con barras visibles). */
  --alto: 100vh;
}
@supports (height: 100svh) { :root { --alto: 100svh; } }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--negro); }
body {
  width: 100%;
  min-height: 100vh; min-height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--negro);
  color: #fff;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body.sin-scroll { overflow: hidden; }

/* ── Stage: ocupa todo el alto libre; el póster 9:16 se ajusta sin deformarse ── */
#stage {
  /* exactamente una pantalla: el contacto queda debajo y se ve al hacer scroll */
  height: calc(var(--alto) - env(safe-area-inset-top, 0px));
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--negro);
}
.poster {
  position: relative;
  aspect-ratio: 9 / 16;
  width: min(100%, calc((var(--alto) - env(safe-area-inset-top, 0px)) * 9 / 16));
  overflow: hidden;
  background: var(--negro);
}
.poster-bg, .tematica-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ── Videos de Flow superpuestos (misma escala que el póster 1080×1920, en %) ── */
.fx {
  position: absolute; z-index: 10;
  object-fit: fill; pointer-events: none;
  opacity: 0; transition: opacity .6s ease;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.fx.on { opacity: 1; }
/* globos: video 720×1280 a todo el póster; la máscara deja solo los dos racimos */
.fx-globos {
  inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: url(assets/mask-globos.png); mask-image: url(assets/mask-globos.png);
}
/* región x0-300, y780-1620 del póster */
.fx-botella {
  left: 0; top: 40.625%; width: 27.78%; height: 43.75%;
  -webkit-mask-image: url(assets/mask-botella.png); mask-image: url(assets/mask-botella.png);
}

/* ── Confeti DEL PÓSTER: las mismas piezas (recortadas de la imagen) caen y se repiten ──
   Cada pieza arranca en su posición original (animation-delay negativo) y recorre toda la altura. */
#confeti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.cf {
  position: absolute; left: var(--x); top: 0;
  width: var(--w); aspect-ratio: var(--ar);
  background: url(assets/confeti.png) no-repeat;
  background-size: var(--bs) auto; background-position: var(--bx) var(--by);
  will-change: transform;
  animation: cae var(--dur) var(--delay) linear infinite both;
}
/* cae durante el 62 % del ciclo y espera fuera de pantalla el resto: así las piezas reentran escalonadas */
@keyframes cae {
  0%   { transform: translate3d(0, -100%, 0) rotate(0deg); }
  62%  { transform: translate3d(var(--dx), var(--H, 100vh), 0) rotate(var(--rot)); }
  100% { transform: translate3d(var(--dx), var(--H, 100vh), 0) rotate(var(--rot)); }
}
.cargando .cf { animation-play-state: paused; }

/* ── Hotspots táctiles sobre los botones dibujados en el póster ──
   Centro vertical medido: 1675.5/1920 = 87.3 %. Altura mínima táctil 44 px. */
#botones-layer { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.btn-tap {
  position: absolute;
  top: 87.3%;
  left: calc(var(--x) - 1.5%);
  width: calc(var(--w) + 3%);
  height: max(6.2%, 44px);
  transform: translateY(-50%);
  border-radius: 999px;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: background .18s ease, transform .15s ease;
}
.btn-tap:hover  { background: rgba(255, 235, 170, .10); }
.btn-tap:active { background: rgba(255, 235, 170, .24); transform: translateY(-50%) scale(.97); }
.btn-tap:focus-visible { box-shadow: 0 0 0 3px var(--oro-claro); }

/* ── Footer ── */
#footer-inv {
  width: 100%;
  padding: 28px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: var(--negro);
}
#footer-inv p { font: 12px/1.6 system-ui, sans-serif; color: #8a8478; letter-spacing: .2px; }
#footer-inv a {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 2px;
  font: 700 14px system-ui, sans-serif; color: var(--oro); min-height: 44px; padding: 0 10px; text-decoration: none;
}
#footer-inv a svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Botón de música ── */
#btn-musica {
  position: fixed; z-index: 70;
  top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--oro-claro);
  background: linear-gradient(180deg, #e9cf86 0%, #b8923a 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent; outline: none;
  opacity: 0;
  animation: aparece .8s .7s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes aparece { to { opacity: 1; } }
.cargando #btn-musica { animation-play-state: paused; }
#btn-musica:active { transform: scale(.92); }
#btn-musica:focus-visible { box-shadow: 0 0 0 3px #fff; }
#btn-musica svg { width: 24px; height: 24px; fill: #1a1408; }
#btn-musica .ico-off { display: none; }
#btn-musica[aria-pressed="true"] .ico-on  { display: none; }
#btn-musica[aria-pressed="true"] .ico-off { display: block; }

#toast-audio {
  position: fixed; z-index: 80;
  left: 50%; top: calc(14px + env(safe-area-inset-top, 0px));
  transform: translate(-50%, -14px) scale(.9);
  display: flex; align-items: center; gap: 8px;
  max-width: calc(100% - 80px);
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2312 0%, #0c0a05 100%);
  border: 1.5px solid var(--oro);
  box-shadow: 0 6px 20px rgba(0,0,0,.7);
  opacity: 0; pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
#toast-audio.mostrar { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast-emoji { font-size: 16px; line-height: 1; flex-shrink: 0; }
.toast-texto { font: 600 10px/1.3 system-ui, sans-serif; color: var(--oro-claro); }

/* ── Vista Temática ── */
#vista-tematica {
  position: fixed; inset: 0; z-index: 90;
  padding-top: env(safe-area-inset-top, 0px);
  height: var(--alto);
  background: var(--negro);
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility 0s .3s;
}
#vista-tematica.abierta { opacity: 1; visibility: visible; transition: opacity .3s ease; }
.tematica-area { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.tematica-area .tematica-img {
  position: relative; inset: auto;
  aspect-ratio: 9 / 16; height: auto;
  width: min(100%, calc((var(--alto) - 72px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 9 / 16));
}
.tematica-barra {
  flex-shrink: 0;
  height: calc(72px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center; justify-content: center;
}
#btn-volver {
  min-height: 48px; padding: 0 28px;
  border-radius: 999px;
  border: 1.5px solid var(--oro-claro);
  background: linear-gradient(180deg, #e9cf86 0%, #b8923a 100%);
  color: #1a1408; font: 700 15px/1 system-ui, sans-serif; letter-spacing: .3px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
#btn-volver:active { transform: scale(.97); }
#btn-volver:focus-visible { box-shadow: 0 0 0 3px #fff; }

/* ── Loader ── */
#loader { position: fixed; inset: 0; z-index: 999; background: var(--negro); 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: 6px; height: 6px; border-radius: 50%; background: var(--oro); 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); } }

@media (prefers-reduced-motion: reduce) {
  .cf { animation: none; top: var(--y0); }
  .cf-b { display: none; }
  .poster video { display: none; }
}

/* ── Solo vertical: teléfono en horizontal → aviso a pantalla completa ── */
#girar { display: none; }
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  html, body { overflow: hidden; }
  #girar {
    position: fixed; inset: 0; z-index: 1000;
    background: #000; color: var(--oro);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    text-align: center; font: 600 16px/1.4 system-ui, sans-serif;
  }
  #girar svg { width: 64px; height: 64px; animation: giraTel 2.4s ease-in-out infinite; }
}
@keyframes giraTel { 0%, 20% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0deg); } }
@media (prefers-reduced-motion: reduce) { #girar svg { animation: none; } }
