/* Portadas foto primero, trazo y sello (js/render/sections/portada-modelos-d.js),
   cuenta regresiva en la portada y apertura de telón. */

/* --- Cuenta regresiva en la portada (sirve para cualquier estilo) --- */
.portada-cuenta { display: grid; grid-template-columns: repeat(4, minmax(52px, 1fr)); gap: 4px; margin: 0 auto; max-width: 300px; }
.portada-cuenta div { display: flex; flex-direction: column; align-items: center; padding: 0 6px; }
.portada-cuenta div + div { border-left: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.portada-cuenta strong { font-family: var(--font-heading); font-size: 1.700rem; font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }
.portada-cuenta span { font-size: .54rem; letter-spacing: .18em; text-transform: uppercase; opacity: .8; }
.portada-cuenta-llego { margin: 0; font-family: var(--font-heading); font-style: var(--heading-style); font-size: 1.200rem; }

/* --- Foto primero --- */
.portada.estilo-fotoprimero { padding: 0 0 86px; place-items: start stretch; }
.estilo-fotoprimero .portada-centro { gap: 24px; }
.f-foto { position: relative; width: 100%; height: 56svh; min-height: 300px; }
.f-foto .m-foto { position: absolute; inset: 0; }
.inv[data-movimiento="si"] .f-foto img { animation: f-acerca 18s ease-out both; }
@keyframes f-acerca { from { scale: 1.12; } to { scale: 1; } }
.f-arco .m-foto { border-radius: 0 0 50% 50% / 0 0 16% 16%; }
.f-arco::after { content: ""; position: absolute; left: 50%; bottom: -13px; width: 26px; height: 26px; margin-left: -13px; rotate: 45deg; background: var(--color-bg); border: 1px solid var(--color-accent); }
.f-diagonal .m-foto { clip-path: polygon(0 0, 100% 0, 100% 80%, 0 100%); }
.f-diagonal::after { content: ""; position: absolute; right: 0; bottom: 0; width: 100%; height: 20%; background: linear-gradient(to bottom right, transparent calc(50% - 5px), var(--color-accent) calc(50% - 5px), var(--color-accent) calc(50% - 3px), transparent calc(50% - 3px)); transform: scaleX(-1); pointer-events: none; }
.f-marco { width: calc(100% - 72px); height: 50svh; margin-top: 66px; }
.f-filete { position: absolute; inset: -12px 12px 12px -12px; border: 1px solid var(--color-accent); pointer-events: none; }
.f-texto { padding: 0 22px; }

/* --- Trazo --- */
.t-lamina { width: min(100%, 340px); }
.t-dibujo { display: block; width: 100%; height: auto; overflow: visible; }
.t-linea { fill: none; stroke: var(--color-primary-dark); stroke-width: 1.600; stroke-linecap: round; stroke-linejoin: round; }
.t-acento { fill: var(--color-accent); }
.inv[data-movimiento="si"] .t-linea > * { stroke-dasharray: 1; stroke-dashoffset: 1; }
.inv[data-movimiento="si"] .t-acento { opacity: 0; }
.inv.abierta[data-movimiento="si"] .t-linea > * { animation: t-dibuja 1.5s ease-in-out forwards; animation-delay: calc(var(--i) * 160ms + .5s); }
.inv.abierta[data-movimiento="si"] .t-acento { animation: t-aparece .9s 2.6s ease-out forwards; }
.inv.abierta[data-movimiento="si"] .t-faroles .t-acento, .inv.abierta[data-movimiento="si"] .t-mesa .t-acento { animation: t-aparece .9s 2.6s ease-out forwards, t-titila 3.2s 3.6s ease-in-out infinite; }
@keyframes t-dibuja { to { stroke-dashoffset: 0; } }
@keyframes t-aparece { to { opacity: 1; } }
@keyframes t-titila { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* --- Sello --- */
.s-sello { position: relative; width: min(78%, 280px); aspect-ratio: 1; display: grid; place-items: center; }
.s-sello svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.s-borde { fill: none; stroke: var(--color-primary); stroke-width: 2.500; }
.s-fino { fill: none; stroke: var(--color-accent); stroke-width: 1; }
.s-sello text { font-family: var(--font-body); font-size: 15px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; fill: var(--color-primary); }
.s-iniciales { position: relative; font-weight: 400; font-size: clamp(3rem, 19cqw, 4.600rem); line-height: 1; color: var(--color-primary); white-space: nowrap; }
.s-iniciales em { margin: 0 .12em; font-size: .5em; font-style: normal; color: var(--color-accent); }
.inv[data-movimiento="si"] .s-gira { animation: s-gira 48s linear infinite; }
.inv[data-movimiento="si"] .s-sello { opacity: 0; }
.inv.abierta[data-movimiento="si"] .s-sello { animation: s-estampa .7s .45s cubic-bezier(.3, 1.5, .5, 1) forwards; }
@keyframes s-gira { to { rotate: 360deg; } }
@keyframes s-estampa { from { opacity: 0; scale: 1.7; rotate: -14deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }

/* Vista previa del panel y miniaturas: todo dibujado desde el arranque. */
.inv[data-quieto] .t-linea > * { stroke-dasharray: none; animation: none !important; }
.inv[data-quieto] .t-acento, .inv[data-quieto] .s-sello { opacity: 1 !important; animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  .inv .t-linea > * { stroke-dasharray: none; animation: none !important; }
  .inv .t-acento, .inv .s-sello { opacity: 1 !important; animation: none !important; }
}

/* --- Garabatos --- */
.portada.estilo-garabato { background: radial-gradient(1px 1px at 20% 30%, color-mix(in srgb, var(--color-text) 16%, transparent), transparent), radial-gradient(1px 1px at 70% 60%, color-mix(in srgb, var(--color-text) 14%, transparent), transparent), radial-gradient(1.500px 1.500px at 40% 80%, color-mix(in srgb, var(--color-text) 10%, transparent), transparent), var(--color-bg); background-size: 37px 41px, 53px 47px, 61px 67px, auto; }
.estilo-garabato .portada-centro { gap: 14px; }
.g-dibujo { width: min(100%, 360px); }
.g-dibujo .t-linea { stroke: var(--color-text); stroke-width: 2.600; }
.g-numero { font-family: var(--font-script); font-weight: 700; fill: var(--color-text); }
.g-datos { display: flex; align-items: center; justify-content: center; gap: 14px; font-family: var(--font-heading); font-size: 1.350rem; line-height: 1.1; text-transform: uppercase; letter-spacing: .04em; }
.g-datos span { flex: 1; min-width: 0; }
.g-datos span:first-child { text-align: right; }
.g-datos span:last-child { text-align: left; }
.g-datos b { display: flex; flex-direction: column; align-items: center; padding: 2px 14px; border-left: 3px solid currentColor; border-right: 3px solid currentColor; border-radius: 3px 8px 4px 9px; font-size: 2.400rem; line-height: .95; rotate: -2deg; }
.g-datos i { font-style: normal; font-size: .6em; }
.estilo-garabato .m-lugar { font-family: var(--font-heading); font-size: 1.150rem; }

/* --- Tema a pedido: marco para la imagen que se sube en cada evento --- */
.portada.estilo-tema { background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--color-primary) 24%, var(--color-bg)), var(--color-bg) 72%); }
.x-lamina { position: relative; width: min(78%, 300px); aspect-ratio: 1; }
.x-lamina .m-foto { position: absolute; inset: 0; border-radius: 34px; background: #fff; border: 6px solid var(--color-primary); box-shadow: 0 10px 0 color-mix(in srgb, var(--color-primary-dark) 70%, transparent), 0 26px 40px rgba(0, 0, 0, .14); rotate: -2deg; }
.x-lamina .m-foto img, .x-pegatina img { object-fit: contain; padding: 6%; box-sizing: border-box; }
.x-edad { position: absolute; right: -14px; bottom: -14px; z-index: 2; }
.x-brillo { position: absolute; z-index: 2; width: 26px; height: 26px; background: var(--color-accent); clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
.x-brillo.b1 { left: -20px; top: 8%; }
.x-brillo.b2 { right: -22px; top: 30%; width: 18px; height: 18px; }
.x-brillo.b3 { left: 6%; bottom: -24px; width: 20px; height: 20px; }
.x-pegatinas { display: flex; justify-content: center; gap: 18px; }
.m-foto.x-pegatina { width: 82px; height: 82px; border-radius: 50%; background: #fff; border: 4px solid var(--color-accent); box-shadow: 0 6px 14px rgba(0, 0, 0, .12); }
.m-foto.x-pegatina:nth-child(2) { border-color: var(--color-primary); }
.m-foto.x-pegatina i { min-height: 0; font-size: .5rem; letter-spacing: .1em; }
.inv[data-movimiento="si"]:not([data-quieto]) .x-lamina .m-foto { animation: x-flota 4.5s ease-in-out infinite; }
.inv[data-movimiento="si"]:not([data-quieto]) .x-brillo { animation: x-titila 2.4s ease-in-out infinite; }
.inv[data-movimiento="si"]:not([data-quieto]) .x-brillo.b2 { animation-delay: -.8s; }
.inv[data-movimiento="si"]:not([data-quieto]) .x-brillo.b3 { animation-delay: -1.6s; }
.inv[data-movimiento="si"]:not([data-quieto]) .x-pegatina { animation: x-menea 3s ease-in-out infinite; }
.inv[data-movimiento="si"]:not([data-quieto]) .x-pegatina:nth-child(2) { animation-delay: -1.5s; }
@keyframes x-flota { 0%, 100% { translate: 0 0; rotate: -2deg; } 50% { translate: 0 -10px; rotate: 1deg; } }
@keyframes x-titila { 0%, 100% { scale: 1; opacity: 1; } 50% { scale: .55; opacity: .5; } }
@keyframes x-menea { 0%, 100% { rotate: -6deg; } 50% { rotate: 6deg; } }
/* Las imágenes chicas, de adorno arriba de la cuenta regresiva y la confirmación. */
.inv[data-pegatinas] :is(.sec-cuenta, .sec-rsvp) > :first-child::before { content: ""; display: block; width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 50%; background: #fff var(--pegatina-1) center / 82% no-repeat; box-shadow: 0 6px 14px rgba(0, 0, 0, .14); }
.inv[data-pegatinas] .sec-rsvp > :first-child::before { background-image: var(--pegatina-2); }

/* --- Apertura: telón de tela que se corre hacia los costados --- */
.apertura.ap-telon { background: transparent; transition: none; }
.ap-pano { position: absolute; top: 0; bottom: 0; width: 50.5%; background: repeating-linear-gradient(90deg, var(--color-primary) 0, color-mix(in srgb, var(--color-primary-dark) 82%, #000) 5.5%, var(--color-primary) 11%, color-mix(in srgb, var(--color-primary) 86%, #fff) 14%, var(--color-primary) 17%); box-shadow: inset 0 -60px 60px -40px rgba(0, 0, 0, .45); transition: transform 1.5s cubic-bezier(.65, 0, .25, 1); }
.ap-pano.izq { left: 0; transform-origin: 0 50%; }
.ap-pano.der { right: 0; transform-origin: 100% 50%; }
.ap-pano::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: var(--color-accent); opacity: .9; }
.ap-cenefa { position: absolute; z-index: 1; top: 0; left: 0; right: 0; height: 12svh; background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--color-primary-dark) 88%, #000) 70%, transparent 71%) 0 100% / 25% 56% repeat-x, linear-gradient(color-mix(in srgb, var(--color-primary-dark) 88%, #000) 62%, transparent 62%); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); transition: transform 1.2s .5s ease-in; }
.ap-cenefa::after { content: ""; position: absolute; left: 0; right: 0; top: 56%; height: 3px; background: var(--color-accent); }
.ap-telon .apertura-centro { z-index: 2; color: var(--color-on-primary); text-shadow: 0 2px 14px rgba(0, 0, 0, .45); transition: opacity .4s; }
.ap-telon .apertura-toca { color: inherit; opacity: .9; }
.ap-telon.abriendo { opacity: 1; transform: translateX(-50%); pointer-events: none; }
.ap-telon.abriendo .apertura-centro { opacity: 0; }
.ap-telon.abriendo .ap-pano { transform: scaleX(.07); }
.ap-telon.abriendo .ap-cenefa { transform: translateY(-110%); }
