/* Opening screen: the printed card under a vellum gatefold, closed with the
   gold wax seal. Tapping the seal breaks it, swings the flaps open and fades
   into the site (timings in js/envelope.js). */
.envelope {
  position: fixed; inset: 0; z-index: 50;
  overflow: hidden;
  perspective: 1800px;
  background: radial-gradient(120% 90% at 50% 40%, #f2efe3 0%, #e4e0d0 100%);
  transition: opacity .9s ease;
}
.envelope.gone { opacity: 0; pointer-events: none; }
.skip .envelope { display: none; }

/* The real card, softly blurred like it looks through vellum */
.env-card {
  position: absolute; left: 50%; top: 50%;
  width: min(94vw, 64svh); aspect-ratio: 2 / 3;
  transform: translate(-50%, -50%);
  background: #fefff9 url(../assets/img/card.jpg) center / cover no-repeat;
  box-shadow: 0 30px 60px -30px rgba(40, 50, 35, .45);
  filter: blur(2.6px) saturate(.9);
}

/* Two translucent vellum flaps; the right one overlaps the left */
.env-flap {
  position: absolute; top: 0; bottom: 0; width: 54%;
  background:
    linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0) 30%, rgba(255,255,255,.25)),
    var(--vellum);
}
.env-left { left: 0; transform-origin: left center; }
.env-right {
  right: 0; transform-origin: right center;
  box-shadow: -10px 0 24px -12px rgba(30, 40, 30, .28);
  border-left: 1px solid rgba(255, 255, 255, .7);
}

/* Wax seal, centred on the seam; each half carries the same SVG, clipped */
.env-seal {
  position: absolute; left: 50%; top: 50%;
  width: 176px; height: 176px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: seal-breathe 3.2s ease-in-out infinite;
}
.seal-half { position: absolute; inset: 0; }
.seal-half svg { position: absolute; left: 0; top: 0; overflow: visible; }
.seal-left { clip-path: polygon(0 -60%, 51% -60%, 48% 30%, 54% 55%, 49% 160%, 0 160%); } /* 1% overlap hides the seam */
.seal-right { clip-path: polygon(50% -60%, 300% -60%, 300% 160%, 48% 160%, 53% 55%, 47% 30%); }

.env-seal-btn {
  position: absolute; left: 50%; top: 50%;
  width: 190px; height: 190px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: transparent; border: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.env-seal-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }

.env-kicker, .env-tap {
  position: absolute; left: 0; right: 0; margin: 0; text-align: center;
  font-family: var(--f-caps); text-transform: uppercase; letter-spacing: .3em;
  font-size: 12px; color: var(--ink-soft);
  transition: opacity .5s ease;
}
.env-kicker { top: max(28px, env(safe-area-inset-top)); }
.env-tap {
  bottom: max(34px, env(safe-area-inset-bottom));
  width: max-content; margin: 0 auto; padding: 11px 20px;
  background: rgba(255, 255, 255, .7); border-radius: 999px;
  animation: tap-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
/* landscape phones: no room for the captions around the seal */
@media (max-height: 460px) { .env-kicker, .env-tap { display: none; } }

/* Opening choreography lives in reveal.css */
@keyframes seal-breathe { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.025); } }
@keyframes tap-pulse { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .env-seal, .env-tap { animation: none; }
}
