:root {
  --cream: #FFF9CD;
  --coral: #FF724F;
  --red: #8A1502;
}

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

html {
  background: var(--coral);
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

/* fijar el body impide el scroll y el rebote elástico en móvil */
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background-color: var(--coral);
  color: var(--cream);
  display: flex;
  justify-content: center;
  /* la bola arranca pegada al borde superior */
  align-items: flex-start;
  /* espacio reservado para el botón fijo */
  padding-bottom: 68px;
  font-family: "Rubik", sans-serif;
  text-align: center;
}

/* ---- Composición tipo póster: todas las medidas en cqw
   escalan igual que el mockup en cualquier pantalla.
   El ancho se acota por la altura (ratio ~2.4) para que
   nunca haya scroll. ---- */
.poster {
  container-type: inline-size;
  position: relative;
  width: min(100%, 560px, 42dvh);
  /* la ilustración sobresale por debajo del último texto:
     este padding hace que la caja abarque toda la composición
     y el centrado vertical quede real */
}

/* Bola de discoteca colgando del borde superior.
   Se centra con margin (no con transform) para dejar
   el transform libre para la animación de caída. */
.bola {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -24cqw;
  width: 48cqw;
  aspect-ratio: 1 / 1;
  z-index: 0;
  pointer-events: none;
  animation: ball-drop 3.4s 0.15s backwards cubic-bezier(0.37, 0, 0.28, 1);
}

/* Pareja + perros detrás de los nombres.
   El wrapper posiciona, la imagen anima. */
/* Arranca bajo el título y termina sobre la fecha: el texto
   superior e inferior quedan fuera de la ilustración, y las caras
   de los novios caen en la banda limpia sobre KAREN. */
.pareja-wrap {
  position: absolute;
  top: 48cqw;
  left: 50%;
  /* desplazada a la izquierda para que los perros queden centrados */
  transform: translateX(calc(-50% - 4cqw));
  /* sangra por los costados del póster */
  width: 158cqw;
  z-index: 0;
  pointer-events: none;
}

.pareja {
  display: block;
  width: 100%;
  animation: illustration-in 1.5s 0.95s backwards cubic-bezier(0.22, 1, 0.36, 1);
}

.top-line,
.date,
.location {
  /* Rubik: tildes correctas en todos los dispositivos */
  font-family: "Rubik", sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.55em;
  margin-right: -0.55em; /* compensa el espaciado del último carácter para centrar */
  font-size: 4.2cqw;
  position: relative;
  z-index: 1;
}

.top-line {
  margin-top: 47cqw;
  animation: text-in 0.9s 1.55s backwards cubic-bezier(0.22, 1, 0.36, 1);
}

.names {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 400;
  /* deja pasar las caras de los novios por encima de KAREN */
  margin-top: 28cqw;
}

.name,
.amp {
  animation: text-in 1s backwards cubic-bezier(0.22, 1, 0.36, 1);
}

.name {
  font-family: "Six Caps", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  font-size: 33cqw;
  line-height: 0.82;
  letter-spacing: 0.04em;
}

.names .name:first-of-type { animation-delay: 1.78s; }
.amp { animation-delay: 1.88s; }
.names .name:last-of-type { animation-delay: 1.98s; }

.amp {
  font-family: "Slackside One", cursive;
  font-size: 11cqw;
  line-height: 1;
  margin: 1.5cqw 0;
}

.date {
  /* separa la fecha de CRIS lo suficiente para caer bajo
     el borde inferior de la ilustración */
  margin-top: 36cqw;
  font-size: 4.6cqw;
  animation: text-in 0.9s 2.25s backwards cubic-bezier(0.22, 1, 0.36, 1);
}

.location {
  margin-top: 3.5cqw;
  font-size: 4.6cqw;
  animation: text-in 0.9s 2.4s backwards cubic-bezier(0.22, 1, 0.36, 1);
}

.calendar-btn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  left: 50%;
  transform: translateX(-50%);
  width: fit-content;
  white-space: nowrap;
  font-family: "Slackside One", cursive;
  font-size: clamp(21px, 6.3cqw, 26px);
  line-height: 1;
  color: var(--red);
  background: var(--cream);
  border: none;
  border-radius: 999px;
  /* Slackside One cuelga bajo la línea base: menos padding arriba
     para que se vea centrado */
  padding: 0.2em 1.7em 0.7em;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 4px 16px rgba(138, 21, 2, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: btn-in 0.9s 2.7s backwards cubic-bezier(0.22, 1, 0.36, 1);
}

.calendar-btn:hover {
  transform: translate(-50%, -2px);
  box-shadow: 0 8px 22px rgba(138, 21, 2, 0.28);
}

.calendar-btn:active {
  transform: translateX(-50%);
}

/* En desktop la ilustración de fondo crece */
@media (min-width: 700px) {
  .pareja-wrap {
    transform: translateX(-50%);
  }
}

/* Ícono de unmute arriba a la derecha */
.music-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  border: none;
  background: none;
  color: var(--cream);
  cursor: pointer;
  z-index: 10;
  display: flex;
  padding: 6px;
  filter: drop-shadow(0 1px 3px rgba(138, 21, 2, 0.3));
}

.music-toggle[hidden] { display: none; }
.music-toggle .icon-sound { display: none; }
.music-toggle.sound-on .icon-muted { display: none; }
.music-toggle.sound-on .icon-sound { display: block; }

/* ---- Secuencia de entrada ----
   Mientras el body tiene .loading, toda la animación queda
   congelada en su primer fotograma (pantalla coral limpia).
   Se libera desde JS cuando las tipografías y la ilustración
   ya están listas, para que la secuencia corra fluida. */
body.loading .poster,
body.loading .poster *,
body.loading .room-sparkles span {
  animation-play-state: paused;
}

/* La bola baja lentamente colgada de su hilo, girando,
   mientras el resto del contenido va apareciendo. */
@keyframes ball-drop {
  from { transform: translateY(-135%); }
  to { transform: translateY(0); }
}

/* La ilustración entra desenfocada y algo más grande,
   como una foto que va tomando foco al asentarse. */
@keyframes illustration-in {
  from {
    opacity: 0;
    transform: scale(1.16) translateY(4%);
    filter: blur(16px);
  }
  60% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

@keyframes text-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes btn-in {
  from {
    opacity: 0;
    transform: translate(-50%, 18px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Destellos de la bola repartidos por la pantalla */
.room-sparkles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.room-sparkles span {
  position: absolute;
  background: var(--cream);
  border-radius: 3px;
  filter: blur(7px);
  opacity: 0;
  animation: twinkle ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; }
  50% { opacity: var(--max-o, 0.3); }
}

@media (prefers-reduced-motion: reduce) {
  .bola,
  .pareja,
  .top-line,
  .name,
  .amp,
  .date,
  .location,
  .calendar-btn,
  .room-sparkles span {
    animation: none;
  }
}
