/* Motor de las plantillas de cumpleaños / XV (modelos 02 en adelante).
   Colores, tipografías y escala: estilo/tema.css y estilo/fuentes.css (propios de cada modelo).
   Variantes de diseño: atributos data-* del <body>, que app.js toma de config.js > diseno. */

:root {
  --titulo: "Great Vibes", cursive; --texto: Georgia, serif; --k: 1; --r: 8px;
  --titulo-transform: none; --titulo-ls: 0; --titulo-style: normal;
  --papel: #fff; --lienzo: #fff; --tarjeta: #fff; --tinta: #1b1b1b; --suave: #555;
  --acento: #333; --acento-2: #111; --sobre-acento: #fff; --detalle: #999;
  --banda-bg: var(--acento); --banda-txt: var(--sobre-acento);
  --btn-bg: var(--acento); --btn-txt: var(--sobre-acento);
  --portada-txt: #fff; --velo: rgba(0, 0, 0, .62); --icono: var(--acento);
  --fx-0: var(--acento); --fx-1: var(--detalle); --fx-2: var(--acento-2); --fx-3: var(--detalle); --fx-4: var(--acento);
  --maxw: 460px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { background-color: var(--papel); background-image: url("estilo/fondo.svg"); color: var(--tinta); font-family: var(--texto); font-weight: 400; line-height: 1.5; overflow-x: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; }

/* Columna central (en escritorio se ve como un celular) */
.col { max-width: 480px; margin: 0 auto; background: var(--lienzo); overflow: hidden; min-height: 100vh; }

/* Ícono teñido con el color del texto */
.ico { display: block; width: var(--s, 28px); height: var(--s, 28px); background-color: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; margin-inline: auto; flex: none; }
.ico--sm { --s: 20px; }
.ico--lg { --s: 68px; margin-bottom: 14px; color: var(--icono); }
.ico--divisor { color: var(--detalle); margin-top: 10px; }

/* Esquinas decoradas */
.esq { position: absolute; width: min(70%, 300px); height: auto; pointer-events: none; z-index: 0; }
.esq--tl { top: -2px; left: -2px; }
.esq--br { bottom: -2px; right: -2px; transform: rotate(180deg); }
/* en la portada solo va la esquina de arriba: abajo taparía el nombre */
.portada .esq--br { display: none; }

/* ---------- 1. Portada ---------- */
.portada { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 76px 18px 52px; background-color: var(--papel); background-image: url("estilo/fondo.svg"); }
.portada__foto { position: relative; z-index: 1; }
.hero__img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.portada__texto { position: relative; z-index: 3; width: 100%; padding: 0 12px; }
.kicker { font-family: var(--texto); font-size: .8rem; letter-spacing: .32em; text-transform: uppercase; color: var(--suave); margin-bottom: 6px; }
.hero__name { display: block; width: 100%; white-space: nowrap; font-family: var(--titulo); font-weight: 400; font-size: calc(clamp(3rem, 17vw, 5.2rem) * var(--k)); line-height: 1.12; color: var(--tinta); text-transform: var(--titulo-transform); letter-spacing: var(--titulo-ls); font-style: var(--titulo-style); }
.play { position: absolute; z-index: 5; top: 14px; left: 14px; width: 46px; height: 46px; border: 0; background: none; cursor: pointer; }
.play[hidden] { display: none; }
.play svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .3)); }
.play__bg { fill: var(--btn-bg); stroke: var(--btn-txt); stroke-width: 2.5; }
.play__ic { fill: var(--btn-txt); }
.play:focus-visible, .btn:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; }

/* portada: foto a pantalla completa */
[data-portada="foto"] .portada { height: min(100svh, 820px); min-height: 520px; padding: 0; justify-content: flex-end; }
[data-portada="foto"] .esq { display: none; }
[data-portada="foto"] .portada__foto { position: absolute; inset: 0; }
[data-portada="foto"] .portada::after { content: ""; position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(transparent, rgba(0, 0, 0, .62)); z-index: 2; pointer-events: none; }
[data-portada="foto"] .portada__texto { padding-bottom: 12%; color: var(--portada-txt); }
[data-portada="foto"] .hero__name { color: var(--portada-txt); text-shadow: 0 2px 16px rgba(0, 0, 0, .5); }
[data-portada="foto"] .kicker { color: var(--portada-txt); text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
[data-portada="foto"] .ico--divisor { color: var(--portada-txt); }

/* portada: foto en arco */
[data-portada="arco"] .portada__foto { width: min(74%, 290px); aspect-ratio: 3 / 4; border-radius: 999px 999px 0 0; overflow: hidden; border: 6px solid var(--lienzo); box-shadow: 0 0 0 2px var(--detalle), 0 16px 34px rgba(0, 0, 0, .2); margin-bottom: 26px; }
/* portada: foto en círculo */
[data-portada="circulo"] .portada__foto { width: min(68%, 270px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 7px solid var(--lienzo); box-shadow: 0 0 0 2px var(--acento), 0 14px 30px rgba(0, 0, 0, .18); margin-bottom: 28px; }
/* portada: foto con marco doble */
[data-portada="marco"] .portada__foto { width: min(76%, 300px); aspect-ratio: 4 / 5; padding: 10px; background: var(--tarjeta); box-shadow: 0 0 0 8px var(--papel), 0 0 0 9.5px var(--detalle), 0 18px 36px rgba(0, 0, 0, .22); margin-bottom: 34px; }
/* portada: foto arriba con borde inferior curvo */
[data-portada="mitad"] .portada { padding: 0 0 46px; justify-content: flex-start; }
[data-portada="mitad"] .esq { display: none; }
[data-portada="mitad"] .portada__foto { width: 100%; aspect-ratio: 4 / 4.7; border-radius: 0 0 50% 50% / 0 0 14% 14%; overflow: hidden; margin-bottom: 26px; }
/* portada: foto arriba y tarjeta con el nombre encima */
[data-portada="tarjeta"] .portada { padding: 0 0 46px; justify-content: flex-start; }
[data-portada="tarjeta"] .esq { display: none; }
[data-portada="tarjeta"] .portada__foto { width: 100%; aspect-ratio: 4 / 4.6; }
[data-portada="tarjeta"] .portada__texto { width: 86%; margin-top: -72px; padding: 26px 10px 28px; background: var(--tarjeta); border: 1px solid var(--detalle); box-shadow: 0 14px 34px rgba(0, 0, 0, .18); }

/* ---------- Bandas y bloques ---------- */
.banda, .bloque { position: relative; padding: 56px 24px; text-align: center; }
.banda { overflow: hidden; background: var(--banda-bg); color: var(--banda-txt); }
.banda > *:not(.esq), .bloque > * { position: relative; z-index: 1; }
.banda > *, .bloque > * { margin-left: auto; margin-right: auto; max-width: var(--maxw); }
.banda .ico--lg { color: currentColor; }
.banda .esq { display: none; }
.lead { font-size: 1.25rem; line-height: 1.45; }

[data-bandas="clara"] .banda { background: transparent; color: var(--tinta); border-top: 1px solid var(--detalle); border-bottom: 1px solid var(--detalle); }
[data-bandas="clara"] .banda .ico--lg { color: var(--icono); }
[data-bandas="motivo"] .banda .esq { display: block; opacity: .4; width: min(62%, 250px); }
[data-bandas="marco"] .banda::before { content: ""; position: absolute; inset: 12px; border: 1px solid currentColor; opacity: .55; pointer-events: none; }
[data-bandas="marco"] .banda::after { content: ""; position: absolute; inset: 17px; border: 1px solid currentColor; opacity: .25; pointer-events: none; }

.title { font-family: var(--titulo); font-weight: 400; font-size: calc(2.5rem * var(--k)); line-height: 1.15; margin-bottom: 12px; font-style: var(--titulo-style); }
[data-titulos="caps"] .title { text-transform: uppercase; letter-spacing: .14em; font-size: var(--caps-size, 1.7rem); }
[data-titulos="texto"] .title { font-family: var(--texto); text-transform: uppercase; letter-spacing: .24em; font-size: 1.3rem; }
.when { font-size: 1.08rem; }
.text { font-size: 1.05rem; margin-bottom: 20px; }
.dress { font-size: 1.6rem; margin-bottom: 8px; line-height: 1.25; }
.hint { min-height: 1.4em; margin-top: 10px; font-size: .95rem; color: var(--suave); }
.place { font-size: 1.12rem; margin-top: 8px; }
.place--sub { color: var(--suave); margin-bottom: 22px; }
.banda .text, .banda .hint { color: inherit; opacity: .92; }
[data-bandas="clara"] .banda .text { color: var(--suave); opacity: 1; }

/* ---------- Cuenta regresiva ---------- */
.countdown { display: flex; justify-content: center; align-items: flex-start; gap: 6px; margin: 22px auto; }
.countdown div { display: flex; flex-direction: column; align-items: center; min-width: 0; flex: 0 1 64px; }
.countdown span { font-size: clamp(2rem, 10.5vw, 3rem); line-height: 1.12; font-variant-numeric: tabular-nums; color: var(--acento-2); }
.countdown small { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--suave); }
.countdown i { font-style: normal; font-size: clamp(1.8rem, 9vw, 2.6rem); line-height: 1.2; color: var(--detalle); }
[data-cuenta="cajas"] .countdown { gap: 8px; }
[data-cuenta="cajas"] .countdown i, [data-cuenta="linea"] .countdown i, [data-cuenta="circulos"] .countdown i { display: none; }
[data-cuenta="cajas"] .countdown div { flex: 1 1 0; max-width: 72px; padding: 10px 2px 8px; background: var(--tarjeta); border: 1px solid var(--detalle); border-radius: var(--r); }
[data-cuenta="cajas"] .countdown span { font-size: clamp(1.7rem, 9vw, 2.4rem); }
[data-cuenta="circulos"] .countdown { gap: 8px; }
[data-cuenta="circulos"] .countdown div { flex: 0 0 auto; width: clamp(62px, 19vw, 74px); aspect-ratio: 1; justify-content: center; border-radius: 50%; border: 2px solid var(--acento); background: var(--tarjeta); }
[data-cuenta="circulos"] .countdown span { font-size: clamp(1.4rem, 7vw, 1.8rem); line-height: 1; }
[data-cuenta="circulos"] .countdown small { font-size: .56rem; letter-spacing: .08em; }
[data-cuenta="linea"] .countdown { gap: 0; }
[data-cuenta="linea"] .countdown div { flex: 1 1 0; max-width: 84px; border-left: 1px solid var(--detalle); }
[data-cuenta="linea"] .countdown div:first-of-type { border-left: 0; }

/* ---------- Botones ---------- */
.btn { --b-bg: var(--btn-bg); --b-txt: var(--btn-txt); --b-line: var(--tinta);
  display: inline-block; max-width: 100%; padding: 13px 30px; border: 1.5px solid var(--b-bg); border-radius: 999px; background: var(--b-bg); color: var(--b-txt);
  font-family: var(--texto); font-size: 1rem; letter-spacing: .04em; line-height: 1.3; text-decoration: none; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s, color .2s; overflow-wrap: anywhere; }
.btn:hover { transform: translateY(-1px); }
.closing .btn { --b-bg: #fff; --b-txt: #1a1a1a; --b-line: #fff; }
[data-botones="recto"] .btn { border-radius: 0; text-transform: uppercase; letter-spacing: .14em; font-size: .85rem; }
[data-botones="contorno"] .btn { background: transparent; color: var(--b-line); border-color: var(--b-line); border-radius: 4px; }
[data-botones="contorno"] .btn:hover { background: var(--b-line); color: var(--lienzo); }
[data-botones="contorno"] .closing .btn:hover { color: #1a1a1a; }
[data-botones="chip"] .btn { padding: 11px 24px; font-size: .95rem; box-shadow: 0 4px 0 rgba(0, 0, 0, .22); }
[data-botones="chip"] .btn:hover { box-shadow: 0 6px 0 rgba(0, 0, 0, .22); }
[data-botones="bisel"] .btn { border: 2px solid var(--b-line); border-radius: 6px; box-shadow: 4px 4px 0 var(--b-line); }
[data-botones="bisel"] .closing .btn { border-color: #000; box-shadow: 4px 4px 0 #000; }
[data-botones="bisel"] .btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--b-line); }
[data-botones="subrayado"] .btn { background: transparent; color: var(--b-line); border: 0; border-bottom: 2px solid var(--acento); border-radius: 0; padding: 8px 6px; text-transform: uppercase; letter-spacing: .14em; font-size: .88rem; }
[data-botones="subrayado"] .closing .btn { border-bottom-color: #fff; }
[data-botones="doble"] .btn { border-radius: 0; outline: 1px solid var(--b-bg); outline-offset: 4px; margin: 5px; text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; }

/* ---------- Fotos ---------- */
.foto { position: relative; }
.foto__bg { display: none; }
.foto__img { display: block; width: 100%; height: auto; }

[data-fotos="difuminado"] .foto { overflow: hidden; padding: 56px 24px; background: #111; }
[data-fotos="difuminado"] .foto__bg { display: block; position: absolute; inset: -40px; background: center / cover; filter: blur(36px) brightness(.7) saturate(1.2); transform: scale(1.1); }
[data-fotos="difuminado"] .foto__img { position: relative; max-width: 420px; margin: 0 auto; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); }

[data-fotos="apiladas"] .fotos { display: grid; gap: 28px; padding: 30px 26px; }
[data-fotos="apiladas"] .foto { padding: 10px; background: var(--tarjeta); border: 1px solid var(--detalle); box-shadow: 0 10px 26px rgba(0, 0, 0, .15); border-radius: calc(var(--r) / 2); }
[data-fotos="apiladas"] .foto:nth-child(odd) { rotate: -1.3deg; }
[data-fotos="apiladas"] .foto:nth-child(even) { rotate: 1.3deg; }

[data-fotos="polaroid"] .fotos { display: grid; gap: 34px; padding: 40px 26px; }
[data-fotos="polaroid"] .foto { max-width: 330px; width: 100%; margin: 0 auto; padding: 12px 12px 48px; background: #fdfcf8; box-shadow: 0 10px 26px rgba(0, 0, 0, .25); }
[data-fotos="polaroid"] .foto:nth-child(odd) { rotate: -3deg; }
[data-fotos="polaroid"] .foto:nth-child(even) { rotate: 2.5deg; }
[data-fotos="polaroid"] .foto::before { content: ""; position: absolute; z-index: 1; top: -11px; left: 50%; width: 86px; height: 24px; margin-left: -43px; background: var(--detalle); opacity: .6; rotate: -4deg; }
[data-fotos="polaroid"] .foto__img { aspect-ratio: 4 / 5; object-fit: cover; }

[data-fotos="carrusel"] .fotos { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 30px 24px; scrollbar-width: thin; scrollbar-color: var(--detalle) transparent; -webkit-overflow-scrolling: touch; }
[data-fotos="carrusel"] .foto { flex: 0 0 78%; scroll-snap-align: center; }
[data-fotos="carrusel"] .foto__img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r); }

[data-fotos="mosaico"] .fotos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 28px 22px; }
[data-fotos="mosaico"] .foto:first-child { grid-column: 1 / -1; }
[data-fotos="mosaico"] .foto__img { height: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r); }
[data-fotos="mosaico"] .foto:first-child .foto__img { aspect-ratio: 4 / 3; }

[data-fotos="arco"] .fotos { display: grid; gap: 30px; padding: 36px 24px; }
[data-fotos="arco"] .foto { width: min(80%, 320px); margin: 0 auto; }
[data-fotos="arco"] .foto__img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 999px 999px 0 0; box-shadow: 0 0 0 6px var(--lienzo), 0 0 0 7.5px var(--detalle); }

/* ---------- Cierre ---------- */
.closing { position: relative; overflow: hidden; color: #fff; text-align: center; }
.closing__bg { position: absolute; inset: 0; background: url("img/fondo-cierre.jpg") center / cover; }
.closing::before { content: ""; position: absolute; inset: 0; background: var(--velo); z-index: 1; }
.closing__box { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: 72px 24px; }
.closing__title { font-family: var(--titulo); font-weight: 400; font-size: calc(3.4rem * var(--k)); line-height: 1.1; margin-bottom: 12px; text-transform: var(--titulo-transform); letter-spacing: var(--titulo-ls); font-style: var(--titulo-style); }
.closing .text { color: #f1f1f1; }
.closing__thanks { margin: 36px 0 0; }

/* ---------- Selector de contacto ---------- */
.picker { border: 0; border-radius: 16px; padding: 24px; width: min(92vw, 360px); margin: auto; font: inherit; background: var(--lienzo); color: var(--tinta); }
.picker::backdrop { background: rgba(0, 0, 0, .55); }
.picker h3 { font-weight: 400; font-size: 1.2rem; margin-bottom: 14px; text-align: center; }
.picker ul { list-style: none; display: grid; gap: 10px; margin-bottom: 14px; }
.picker a { display: block; text-align: center; padding: 12px; border: 1.5px solid var(--tinta); border-radius: 12px; color: var(--tinta); text-decoration: none; }
.picker a:hover, .picker a:focus-visible { background: var(--tinta); color: var(--lienzo); outline: none; }
.picker__close { display: block; margin: 0 auto; border: 0; background: none; color: var(--suave); cursor: pointer; padding: 6px 12px; }

/* ---------- Animaciones ---------- */
.fx { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.fx__p { position: absolute; top: -14px; display: block; width: 9px; height: 13px; opacity: .9; }
.fx__p--0 { background: var(--fx-0); }
.fx__p--1 { background: var(--fx-1); border-radius: 50%; width: 10px; height: 10px; }
.fx__p--2 { background: var(--fx-2); width: 7px; height: 14px; }
.fx__p--3 { background: var(--fx-3); border-radius: 50%; width: 8px; height: 8px; }
.fx__p--4 { background: var(--fx-4); width: 12px; height: 6px; }
[data-anim="confeti"] .fx__p { animation: cae linear infinite; }
@keyframes cae { 0% { transform: translateY(0) rotate(0); opacity: 0; } 8% { opacity: .95; } 100% { transform: translateY(560px) rotate(520deg); opacity: .8; } }
[data-anim="brillos"] .fx__p { top: 0; width: 14px; height: 14px; border-radius: 0; background: var(--fx-0); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: brilla ease-in-out infinite; opacity: 0; }
[data-anim="brillos"] .fx__p--1, [data-anim="brillos"] .fx__p--3 { background: var(--fx-1); width: 9px; height: 9px; }
[data-anim="brillos"] .fx__p--2 { background: var(--fx-2); width: 11px; height: 11px; }
@keyframes brilla { 0%, 100% { opacity: 0; scale: .4; } 50% { opacity: 1; scale: 1.1; } }

.anim .rev { opacity: 0; translate: 0 20px; transition: opacity .8s ease, translate .8s ease; }
.anim .rev.in { opacity: 1; translate: 0 0; }
[data-fotos="carrusel"] .foto.rev { opacity: 1 !important; translate: none !important; }
[data-anim="suave"] .ico--lg { animation: pulso 3s ease-in-out infinite; }
[data-anim="flotante"] .ico--lg { animation: flota 3.6s ease-in-out infinite; }
[data-anim="confeti"] .ico--lg { animation: rebota 2.4s ease-in-out infinite; }
[data-anim="brillos"] .ico--lg { animation: pulso 3.4s ease-in-out infinite; }
@keyframes pulso { 0%, 100% { scale: 1; } 50% { scale: 1.14; } }
@keyframes flota { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
@keyframes rebota { 0%, 100% { translate: 0 0; } 40% { translate: 0 -12px; } 60% { translate: 0 0; } 75% { translate: 0 -4px; } }

@media (min-width: 520px) {
  .col { box-shadow: 0 0 60px rgba(0, 0, 0, .18); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ico--lg, .fx__p { animation: none !important; }
  .rev { opacity: 1 !important; translate: none !important; transition: none !important; }
}
