/* ---------- Paleta y tipografías ---------- */
:root {
  --bordo: #74252a;
  --crema: #e8dfd8;
  --malva: #8e5d64;
  --todo: #e3000f;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  /* Tipografía de los títulos de la tarjeta. Si se carga la fuente real
     (Adobe Fonts), anteponerla acá; mientras tanto, Pinyon Script se le parece. */
  --font-titulo: 'Pinyon Script', 'Snell Roundhand', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: #3a1216;
  font-family: var(--sans);
  color: var(--bordo);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Columna de la invitación ----------
   El diseño original mide 1080 px de ancho. --u equivale a 1 px de ese
   diseño, escalado al ancho real de la columna (máx. 480 px). */
.invitation {
  max-width: 480px;
  margin: 0 auto;
  container-type: inline-size;
  background: var(--crema);
  box-shadow: 0 0 60px rgba(0, 0, 0, .35);
  visibility: hidden;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.invitation.visible { visibility: visible; opacity: 1; }
.invitation.visible .portada > img:first-of-type { animation: portada-in 2.2s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes portada-in { from { scale: 1.08; opacity: .6; } to { scale: 1; opacity: 1; } }

.sec {
  --u: calc(100cqw / 1080);
  position: relative;
  text-align: center;
  padding: calc(170 * var(--u)) calc(60 * var(--u));
}
.sec--crema {
  background: var(--crema) url('../img/papel.jpg') top center / 800px auto;
  color: var(--bordo);
}
.sec--bordo { background: var(--bordo); color: var(--crema); }

/* Títulos caligráficos (imágenes recortadas del diseño) */
.titulo { display: block; margin: 0 auto; height: auto; }

/* ---------- Tipografía ---------- */
.t-body {
  font-size: calc(36 * var(--u));
  letter-spacing: .1em;
  line-height: 1.55;
  font-weight: 400;
}
.t-sub {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: calc(64 * var(--u));
  line-height: 1.2;
}
.t-fecha {
  font-family: var(--serif);
  font-style: italic;
  font-size: calc(62 * var(--u));   /* mide como en el diseño: ~59 % del ancho (antes 76 y se veía enorme con el "de" agregado) */
  line-height: 1.2;
}
.t-lugar {
  font-weight: 300;
  font-size: calc(42 * var(--u));
  letter-spacing: .14em;
  line-height: 1.4;
  text-transform: uppercase;
}
.todo { color: var(--todo); font-weight: 700; }

/* ---------- Botones ---------- */
.btn {
  display: inline-block;
  margin-top: calc(70 * var(--u));
  padding: calc(26 * var(--u)) calc(64 * var(--u));
  border: calc(2 * var(--u)) solid currentColor;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: 500 calc(40 * var(--u)) / 1 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, transform .2s ease;
}
.btn:hover, .btn:focus-visible { background: rgba(142, 93, 100, .14); }
.sec--bordo .btn:hover, .sec--bordo .btn:focus-visible { background: rgba(232, 223, 216, .14); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

/* ---------- 0. Portada ---------- */
.portada { padding: 0; background: var(--crema); --p: calc(100cqw / 1079); }
/* Texto "¡Nos casamos! y queremos celebrarlo con vos…": texto real (DM Sans) sobre la portada.
   Medidas en px del diseño (1079 de ancho). Original: DM Sans 43 px, línea 54 px, centro de tinta en y≈1664.
   Ajustes pedidos: +3 pt de fuente (43 → 46) y subirlo: 15 px primero, 20 px más después (centro en y≈1629). */
.portada-texto {
  position: absolute;
  left: 0;
  width: 100%;
  top: calc(1568 * var(--p) - 5px);   /* -5px: ajuste fino, en px de pantalla */
  margin: 0;
  text-align: center;
  font: 400 calc(46 * var(--p)) / 1.256 var(--sans);
  color: var(--bordo);
}
.invitation.visible .portada-texto { animation: texto-in 1.4s ease .9s both; }
@keyframes texto-in { from { opacity: 0; translate: 0 calc(14 * var(--p)); } to { opacity: 1; translate: 0 0; } }
.portada > img:first-of-type { display: block; width: 100%; height: auto; }

/* ---------- 1. Lugar y horario ---------- */
.lugar { padding-top: calc(190 * var(--u)); }
.lugar .fotos { display: block; width: calc(855 * var(--u)); height: auto; margin: 0 auto; }
.lugar .titulo { width: calc(485 * var(--u)); margin-top: calc(125 * var(--u)); }
.lugar .t-fecha { margin-top: calc(110 * var(--u)); }
.lugar .t-lugar { margin-top: calc(48 * var(--u)); }

/* ---------- 2. Cronograma ---------- */
.cronograma .titulo { width: calc(414 * var(--u)); }
.cronograma ul { list-style: none; margin-top: calc(90 * var(--u)); }
.evt { margin-bottom: calc(150 * var(--u)); min-height: calc(260 * var(--u)); }
.evt:last-child { margin-bottom: 0; }
.evt img { display: block; margin: 0 auto calc(26 * var(--u)); height: auto; }
.evt .hora {
  font-weight: 300;
  font-size: calc(42 * var(--u));
  letter-spacing: .16em;
  text-transform: uppercase;
}
.evt .nombre {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: calc(62 * var(--u));
  line-height: 1.2;
}
/* Cuando el evento no tiene icono, se reserva el mismo alto */
.evt .icon-slot { height: calc(215 * var(--u)); display: flex; align-items: flex-end; justify-content: center; margin-bottom: calc(26 * var(--u)); }
.evt .icon-slot img { margin: 0; max-height: 100%; }
.evt .icon-slot > img { width: auto; height: auto; }   /* imagen suelta (cubiertos): usa el ancho de su style */

/* ---------- 3. Dress code ---------- */
.dress .titulo { width: calc(402 * var(--u)); }
.dress .icono { display: block; width: calc(250 * var(--u)); height: auto; margin: calc(100 * var(--u)) auto 0; transform-origin: 50% 0; }
.dress .t-sub { margin-top: calc(120 * var(--u)); }
.dress .t-body { margin-top: calc(30 * var(--u)); }

/* ---------- 4. Información adicional ---------- */
.info .titulo { width: calc(642 * var(--u)); }
.info .bloque { margin-top: calc(130 * var(--u)); }
.info .bloque .t-body { margin-top: calc(40 * var(--u)); }
.info .bloque .t-body + .t-body { margin-top: calc(34 * var(--u)); }
.info .bloque strong { font-weight: 700; }

/* ---------- 5. Confirmación ---------- */
.confirmacion .titulo { width: calc(428 * var(--u)); }
.confirmacion .t-body { margin-top: calc(110 * var(--u)); }
.confirmacion .t-body + .t-body { margin-top: calc(40 * var(--u)); }
.confirmacion .agenda {
  margin-top: calc(110 * var(--u));
  font-size: calc(36 * var(--u));
  font-style: italic;
  letter-spacing: .1em;
  line-height: 1.6;
}
.confirmacion .agenda a { color: inherit; font-weight: 700; text-underline-offset: 4px; }

/* ---------- 6. Regalos ---------- */
.regalos .titulo { width: calc(261 * var(--u)); }
.regalos .t-sub { margin-top: calc(120 * var(--u)); }
.regalos .t-body { margin-top: calc(50 * var(--u)); }

/* ---------- 7. Playlist ---------- */
.playlist .icono { display: block; width: calc(160 * var(--u)); height: auto; margin: 0 auto; transform-origin: 50% 80%; }
.playlist .titulo { width: calc(507 * var(--u)); margin-top: calc(100 * var(--u)); }
.playlist .t-body { margin-top: calc(90 * var(--u)); }
.spotify { margin: calc(80 * var(--u)) auto 0; width: calc(900 * var(--u)); max-width: 100%; }
.spotify iframe { display: block; width: 100%; height: 352px; border: 0; border-radius: 14px; }

/* ---------- 8. Cierre ---------- */
.cierre .titulo { width: calc(470 * var(--u)); }
.cierre .monograma { display: block; width: calc(238 * var(--u)); height: auto; margin: calc(110 * var(--u)) auto 0; }

/* ---------- Animación de iconos ----------
   Todo se mueve solo cuando está a la vista (main.js agrega .in-view). */
/* !important: la propiedad abreviada `animation:` de cada icono reiniciaría el play-state */
.anim-box, .anim-box *, .anim { animation-play-state: paused !important; }
.anim-box.in-view, .anim-box.in-view *, .anim.in-view { animation-play-state: running !important; }

/* Contenedor genérico de icono */
.ico { position: relative; display: block; margin: 0 auto; }
.ico > img { display: block; width: 100%; height: auto; }

/* Destellos (estrella de 4 puntas) */
.destello, .chispa {
  position: absolute;
  width: calc(var(--s, 34) * var(--u));
  aspect-ratio: 1;
  translate: -50% -50%;
  background: #c9969e;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  opacity: 0;
  pointer-events: none;
}
.sec--bordo .destello { background: #f3e6e1; }
.destello { left: var(--x); top: var(--y); animation: destello 3.4s ease-in-out var(--d, 0s) infinite; }
@keyframes destello {
  0%, 100% { opacity: 0; scale: .2; rotate: 0deg; }
  18%      { opacity: 1; scale: 1;  rotate: 45deg; }
  40%      { opacity: 0; scale: .3; rotate: 90deg; }
}

/* ---- Anillos: giran despacio y brilla el diamante ---- */
.ico-anillos > img { animation: anillos 5s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes anillos {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50%      { transform: rotate(4deg)  scale(1.04); }
}

/* ---- Copas (SVG propio): cada copa pivota desde su pie, se alejan, chocan y rebotan ---- */
.copas { display: block; margin: 0 auto; height: auto; overflow: visible;
  fill: none; stroke: #8e5d64; stroke-linecap: round; stroke-linejoin: round; }
.copas .mov { transform-origin: 0 268px; animation: copa 4.2s ease-in-out infinite; }
@keyframes copa {
  0%, 8%   { transform: rotate(2deg);  animation-timing-function: ease-in-out; }
  28%      { transform: rotate(-6deg); animation-timing-function: cubic-bezier(.6, 0, 1, .6); }   /* toman impulso */
  38%      { transform: rotate(5.5deg); animation-timing-function: ease-out; }                    /* ¡chocan! */
  44%      { transform: rotate(0deg);  animation-timing-function: ease-in-out; }                  /* rebotan */
  51%      { transform: rotate(2.8deg); }
  62%, 100%{ transform: rotate(2deg); }
}
.copas .chispa-svg { fill: #b8626e; stroke: none; transform-origin: 0 0; animation: chispa-svg 4.2s ease-out infinite; opacity: 0; }
@keyframes chispa-svg {
  0%, 36% { opacity: 0; transform: scale(.2) rotate(0deg); }
  39%     { opacity: 1; transform: scale(1.3) rotate(25deg); }
  58%     { opacity: 0; transform: scale(.5) rotate(70deg); }
  100%    { opacity: 0; }
}
.copas .gota { fill: #b8626e; stroke: none; opacity: 0; animation: gota 4.2s ease-out infinite; }
.copas .g1 { --dx: -44px; --dy: -58px; }
.copas .g2 { --dx: 6px;   --dy: -72px; animation-delay: .03s; }
.copas .g3 { --dx: 46px;  --dy: -52px; animation-delay: .06s; }
@keyframes gota {
  0%, 37% { opacity: 0; transform: translate(0, 0); }
  41%     { opacity: 1; }
  60%     { opacity: 0; transform: translate(var(--dx), var(--dy)); }
  100%    { opacity: 0; }
}

/* ---- Bola de espejos: se balancea desde el hilo y gira ---- */
.ico-disco > img { animation: disco 4.6s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes disco {
  0%, 100% { transform: rotate(-7deg); }
  50%      { transform: rotate(7deg); }
}

/* ---- Traje y vestido: cuelgan de la percha y giran apenas ---- */
.anim-traje { animation: percha 6s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes percha {
  0%, 100% { transform: perspective(700px) rotateY(-14deg) rotate(-2.5deg); }
  50%      { transform: perspective(700px) rotateY(14deg)  rotate(2.5deg); }
}

/* ---- Gramófono: late al ritmo y salen notas ---- */
.gramofono { position: relative; width: calc(160 * var(--u)); margin: 0 auto; }
.gramofono > img { display: block; width: 100%; height: auto; transform-origin: 50% 85%; animation: gramofono 2.4s ease-in-out infinite; }
@keyframes gramofono {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25%      { transform: scale(1.07) rotate(-2.5deg); }
  55%      { transform: scale(1.02) rotate(1.5deg); }
}
.nota {
  position: absolute;
  left: var(--x);
  top: 18%;
  font: 400 calc(46 * var(--u)) / 1 Georgia, serif;
  color: #f3e6e1;
  opacity: 0;
  animation: nota 3.6s ease-out var(--d, 0s) infinite;
}
@keyframes nota {
  0%   { opacity: 0;  transform: translate(0, 0) rotate(0deg) scale(.7); }
  15%  { opacity: .95; }
  100% { opacity: 0;  transform: translate(var(--dx, 20px), calc(-130 * var(--u))) rotate(var(--r, 18deg)) scale(1.1); }
}

/* ---------- Aparición progresiva al hacer scroll ----------
   (usa `translate`, que no pisa los transform de las animaciones) */
.reveal {
  opacity: 0;
  translate: 0 calc(46 * var(--u, 1px));
  transition: opacity 1s ease var(--d, 0s), translate 1s cubic-bezier(.2, .7, .2, 1) var(--d, 0s);
}
.reveal.shown { opacity: 1; translate: 0 0; }

@media (prefers-reduced-motion: reduce) {
  .anim, .anim *, .anim-box, .anim-box *, .nota, .destello, .chispa { animation: none !important; }
  .invitation.visible .portada-texto { animation: none; }
  .reveal { opacity: 1; translate: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Pop ups ---------- */
.modal {
  --u: 1px;
  margin: auto;
  width: min(88vw, 380px);
  padding: 34px 28px 30px;
  border: 0;
  border-radius: 22px;
  background: var(--crema) url('../img/papel.jpg') center / 800px auto;
  color: var(--bordo);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.modal::backdrop { background: rgba(58, 18, 22, .62); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .28s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.modal h3 { font-family: var(--font-titulo); font-style: normal; font-weight: 400; font-size: 40px; line-height: 1.05; }
.modal .cerrar {
  position: absolute; top: 10px; right: 12px;
  width: 36px; height: 36px; border: 0; background: none;
  color: var(--bordo); font-size: 26px; line-height: 1; cursor: pointer;
}
.modal { max-height: 88dvh; overflow-y: auto; }
.modal .dato { margin-top: 22px; }
.modal .cuenta { margin-top: 26px; padding-top: 20px; border-top: 1px solid rgba(116, 37, 42, .25); }
.modal .cuenta:first-child { border-top: 0; padding-top: 0; margin-top: 18px; }
.modal .cuenta h4 { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; }
.modal .cuenta .dato { margin-top: 14px; }
.modal .dato strong.cbu { font-size: 17px; letter-spacing: .04em; }
.modal .contactos { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.modal .contactos .btn { margin-top: 0; padding: 10px 12px; font-size: 12px; letter-spacing: .1em; }
.modal .datos-contacto span { display: block; word-break: break-all; }
.modal .nota-modal { margin-top: 8px; font-size: 13px; line-height: 1.45; opacity: .85; }
.modal .dato small { display: block; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; opacity: .75; }
.modal .dato strong { display: block; margin-top: 6px; font-size: 20px; letter-spacing: .08em; word-break: break-all; }
.modal .btn { margin-top: 14px; padding: 12px 26px; font-size: 14px; border-width: 1px; }
.modal hr { border: 0; border-top: 1px solid rgba(116, 37, 42, .25); margin: 24px 0 0; }
.modal .btn.copiado { background: var(--bordo); color: var(--crema); }

/* ---------- Botón de música ---------- */
.musica {
  position: fixed;
  right: max(14px, calc(50vw - 240px + 14px));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 40;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 1px solid rgba(232, 223, 216, .55);
  border-radius: 50%;
  background: rgba(116, 37, 42, .88);
  color: var(--crema);
  cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity .8s ease .6s, transform .2s ease;
  backdrop-filter: blur(4px);
}
body:not(.locked) .musica { opacity: 1; pointer-events: auto; }
.musica:active { transform: scale(.92); }
.musica:focus-visible { outline: 2px solid var(--crema); outline-offset: 3px; }
.musica svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.musica .on  { display: none; }
.musica.suena .on  { display: block; }
.musica.suena .off { display: none; }
.musica[hidden] { display: none; }

/* Reproductor de YouTube: solo se usa para el audio */
#yt-player { position: fixed; left: -400px; bottom: 0; width: 200px; height: 200px; opacity: .01; pointer-events: none; }
