/* ==========================================================
   envelope.css — the premium "open the invitation" sequence.

   The guest's landing screen is the envelope-opening video
   itself, paused on its first frame (a wax-seal design) via the
   <video poster>. It always renders in a royal-blue + gold
   palette (see the --env-* variables below), independent of the
   invitation's own `data-theme`. That keeps the cinematic
   "unwrap a handcrafted invitation" moment consistent for every
   client, while the six themes in themes.css continue to style
   everything *after* the video ends exactly as before.
   ========================================================== */

:root {
  /* ---- royal blue + gold palette, used by the envelope video's
     tap-to-open overlay ---- */
  --env-cream: #f9f2e3;
}

body.envelope-locked {
  overflow: hidden;
  height: 100%;
}

/* ---- fullscreen video envelope: the guest's landing screen. Paused
   on its poster frame (the wax-seal design) until tapped, at which
   point it plays with sound and the tap overlay fades away. ---- */
.envelope-video {
  position: fixed;
  inset: 0;
  z-index: 610;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.6s ease;
}

.envelope-video[hidden] {
  display: none;
}

.envelope-video.is-fading {
  opacity: 0;
  pointer-events: none;
}

.envelope-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

/* ---- tap-to-open overlay, shown over the poster frame until tapped ---- */
.envelope-video__tap {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.45) 100%);
  border: none;
  cursor: pointer;
  transition: opacity 0.5s ease;
}

.envelope-video.is-playing .envelope-video__tap {
  opacity: 0;
  pointer-events: none;
}

.envelope-video__tap-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(64px, 16vw, 84px);
  height: clamp(64px, 16vw, 84px);
  border-radius: 50%;
  border: 1px solid rgba(249, 242, 227, 0.75);
  background: rgba(0, 0, 0, 0.25);
  animation: envTapPulse 2.2s ease-in-out infinite;
}

.envelope-video__tap-ring::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 4px;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent var(--env-cream, #f9f2e3);
}

.envelope-video__tap-label {
  font-family: var(--font-body, "Jost", sans-serif);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--env-cream, #f9f2e3);
}

@keyframes envTapPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 242, 227, 0.35); }
  50% { box-shadow: 0 0 0 14px rgba(249, 242, 227, 0); }
}

/* Full-bleed invitation stage the card zooms into.
   Fixed + inset:0 only while the envelope video is playing (so it can
   cross-fade behind/in front of it). Once open, it must return to
   normal document flow or the whole site gets clipped to one
   viewport height and becomes unscrollable. */
.invitation-stage {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--color-bg);
  opacity: 0;
  pointer-events: none;
  min-height: 100vh;
}

.invitation-stage.is-active {
  position: static;
  opacity: 1;
  pointer-events: auto;
}

/* Petals (fall over the revealed invitation, in its own theme colors) */
.petal {
  position: absolute;
  top: -5%;
  width: 14px;
  height: 14px;
  background: var(--color-accent-soft);
  border-radius: 0 100% 0 100%;
  opacity: 0.9;
  will-change: transform;
}

.music-toggle {
  position: fixed;
  bottom: var(--space-3);
  right: var(--space-3);
  z-index: 60;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  .envelope-video__tap-ring {
    animation: none !important;
  }
}
