/* Motor de escenas: lo común de los diseños hechos con fichas. Cada diseño pone su letra y sus colores en su estilo.css:
   --letra-titulo, --letra-nombres, --suave, --linea, --sombra, --papel (fondo de la escena) y --halo (luz detrás del texto). */
body.cerrado { overflow: hidden; height: 100vh; height: 100svh; }

#escena { position: relative; height: 100vh; height: 100svh; overflow: hidden; background: var(--papel, #FFFFFF); }
#escena .capa { position: absolute; inset: 0; pointer-events: none; will-change: transform; transform-origin: 50% 60%; }
#escena .capa > img { position: absolute; display: block; max-width: none; }
#escena .capa.llena > img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
#motor-particulas, #motor-papel { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#motor-papel { z-index: 4; }
#motor-tono { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: multiply; }

/* Textos de la escena */
.motor-texto { position: absolute; left: 0; right: 0; z-index: 3; text-align: center; padding: 0 1.2rem; pointer-events: none; opacity: 0; text-shadow: 0 0 14px var(--halo, #fff), 0 0 26px var(--halo, #fff); }
.motor-texto .velo { display: inline-block; padding: 1rem 1.5rem; background: radial-gradient(closest-side, color-mix(in srgb, var(--halo, #fff) 92%, transparent), color-mix(in srgb, var(--halo, #fff) 70%, transparent) 60%, transparent); }
.motor-texto .ornato { display: block; margin-bottom: .3rem; font-family: var(--letra-titulo); font-size: .78rem; letter-spacing: .24em; text-transform: uppercase; color: var(--tinta); }
.motor-texto p { font-size: 1.4rem; font-style: italic; }
#t1 { top: var(--t1, 44%); }
#t2 { top: var(--t2, 16%); }
#t3 { top: var(--t3, 62%); }
#t2 .nombre { display: block; font-family: var(--nombres-letra, var(--letra-nombres, "Great Vibes", cursive)); font-size: min(4.2rem, calc(var(--ancho) * 1.5 / (var(--letras) * var(--nombres-ancho, 1)))); line-height: 1; overflow-wrap: anywhere; font-weight: var(--nombres-peso, 400); font-style: var(--nombres-estilo, normal); text-transform: var(--nombres-mayus, none); letter-spacing: var(--nombres-espacio, normal); }
#t2 .nombre .linea { display: block; }
#t2 .nombre .palabra { display: inline-block; white-space: nowrap; }
#t2 .nombre .l { display: inline-block; }
#t2 .nombre .y { font-size: .62em; color: var(--acento); }
#t2 .sub { font-family: var(--letra-titulo); font-size: .85rem; letter-spacing: .3em; text-transform: uppercase; color: var(--tinta); font-weight: 500; }
#t3 .fecha { display: block; font-family: var(--letra-titulo); font-size: 1.3rem; letter-spacing: .12em; }
#t3 p { font-size: 1.15rem; color: var(--suave); }
#desliza { position: absolute; z-index: 3; bottom: calc(1.4rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .95rem; font-style: italic; opacity: 0; text-shadow: 0 0 10px var(--halo, #fff); }
#desliza i { width: 1px; height: 28px; background: linear-gradient(var(--tinta), transparent); transform-origin: top; animation: motor-gota 1.8s ease-in-out infinite; }
@keyframes motor-gota { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* Foto del festejado: un marco con forma. Sin foto se ve el adorno del diseño. */
.marco-foto { position: absolute; z-index: 2; overflow: hidden; background: var(--papel, #fff); box-shadow: 0 10px 30px var(--sombra, rgba(0, 0, 0, .18)); }
.marco-foto .retrato, .marco-foto .marco-adorno { position: absolute; inset: 0; }
.marco-foto .retrato img { width: 100%; height: 100%; object-fit: cover; display: block; }
.marco-foto .marco-adorno { display: none; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; }
.marco-foto:has(.retrato[hidden]) .marco-adorno { display: flex; }
.marco-foto.ovalo { border-radius: 50%; border: 4px solid var(--papel, #fff); outline: 1.5px solid var(--acento); outline-offset: 4px; }
.marco-foto.circulo { border-radius: 50%; aspect-ratio: 1; border: 5px solid var(--papel, #fff); }
.marco-foto.arco { border-radius: 999px 999px 10px 10px; border: 4px solid var(--papel, #fff); outline: 1.5px solid var(--acento); outline-offset: 4px; }
.marco-foto.polaroid { padding: 8px 8px 34px; background: #fff; transform: rotate(-3deg); }
.marco-foto.polaroid .retrato, .marco-foto.polaroid .marco-adorno { inset: 8px 8px 34px; }

/* Portada: una tarjeta quieta sobre el arte (no se mueve al cargar: un botón en movimiento es difícil de tocar). */
#portada { position: absolute; inset: 0; z-index: 5; perspective: 1100px; }
#portada .fondo-portada { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#portada .velo-portada { position: absolute; inset: 0; background: var(--velo-portada, rgba(255, 255, 255, .35)); pointer-events: none; }
#portada .hoja-izq, #portada .hoja-der { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; backface-visibility: hidden; will-change: transform; }
#portada .hoja-izq { left: 0; transform-origin: 0 50%; }
#portada .hoja-der { right: 0; transform-origin: 100% 50%; }
.tarjeta { position: absolute; left: 50%; top: var(--tarjeta-arriba, 50%); transform: translate(-50%, -50%); width: min(80%, 18.5rem); padding: 1.6rem 1.3rem 1.4rem; text-align: center; background: rgba(255, 255, 255, .95); box-shadow: 0 18px 44px var(--sombra, rgba(0, 0, 0, .25)); border-radius: var(--tarjeta-radio, 2px); }
.tarjeta::before { content: ""; position: absolute; inset: 6px; border: 1px solid color-mix(in srgb, var(--acento) 45%, transparent); border-radius: inherit; pointer-events: none; }
.tarjeta .para { font-family: var(--letra-titulo); font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; color: var(--acento); }
.tarjeta .nombre { margin: .35rem 0 .1rem; font-family: var(--nombres-letra, var(--letra-nombres, "Great Vibes", cursive)); font-size: min(2.8rem, calc(var(--ancho) * .7 / (var(--letras) * var(--nombres-ancho, 1)))); line-height: 1.15; overflow-wrap: anywhere; font-weight: var(--nombres-peso, 400); font-style: var(--nombres-estilo, normal); text-transform: var(--nombres-mayus, none); letter-spacing: var(--nombres-espacio, normal); }
.tarjeta .nombre b { font-weight: 400; font-size: .7em; color: var(--acento); }
.tarjeta .sub { font-style: italic; color: var(--suave); }
#abrir { width: 100%; margin-top: 1.1rem; padding: .85rem 1rem; border: 0; border-radius: var(--boton-radio, 0); background: var(--tinta); color: #fff; font-family: var(--letra-titulo); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; cursor: pointer; }
#abrir:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; }

/* Música */
#musica { position: fixed; z-index: 20; right: max(1rem, calc(50vw - var(--col) / 2 + 1rem)); top: calc(1rem + env(safe-area-inset-top)); display: none; place-items: center; width: 44px; height: 44px; border: 1px solid var(--linea); border-radius: 50%; background: rgba(255, 255, 255, .9); cursor: pointer; }
#musica.ver { display: grid; }
#musica svg { width: 20px; height: 20px; }
#musica .barras { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
#musica .barras i { width: 3px; height: 30%; background: var(--tinta); animation: motor-barra 1s ease-in-out infinite; }
#musica .barras i:nth-child(2) { animation-delay: -.3s; }
#musica .barras i:nth-child(3) { animation-delay: -.6s; }
@keyframes motor-barra { 50% { height: 100%; } }

@media (prefers-reduced-motion: reduce) {
  #desliza i, #musica .barras i { animation: none; }
  .motor-texto { opacity: 1; }
}
