/* ============================================================
   ENVELOPE — PNG image approach
   Mobile  (≤768px): envelop-top/down-mobile.png
   Desktop (≥769px): envelop-top/down-desktop.png

   On click:
   - top  PNG slides UP   (slower, 1.8s)
   - bottom PNG drifts DOWN a small amount (1.8s)
   - BOTH fade out simultaneously from the moment movement starts
   - overlay removed, couple modal shown
============================================================ */

/* ── Overlay ────────────────────────────────────────────── */
#env-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  cursor: pointer;
  overflow: hidden;
  /* No opacity transition — overlay is removed instantly, no flash of main page */
}
#env-overlay.fading { opacity: 0; pointer-events: none; }
#env-overlay.gone   { display: none !important; }

/* ── Container ──────────────────────────────────────────── */
#env-container {
  position: absolute;
  inset: 0;
  animation: envAppear .5s ease both;
}
@keyframes envAppear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Bottom PNG — drifts slightly downward ──────────────── */
#env-bottom {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  user-select: none;
  pointer-events: none;
  transform-origin: bottom center;
  transition: transform 1.8s cubic-bezier(.4, 0, .2, 1);
}
#env-bottom.opening {
  /* drift down 8% of its own height — subtle, not dramatic */
  transform: translateY(8%);
}

/* ── Top PNG — slides upward ────────────────────────────── */
#env-top {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  user-select: none;
  pointer-events: none;
  transform-origin: top center;
  transition: transform 1.8s cubic-bezier(.4, 0, .2, 1);
}
#env-top.opening {
  transform: translateY(-105%);
}

/* ── Hint text ──────────────────────────────────────────── */
#env-hint {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(.9rem, 2.2vw, 1.1rem);
  font-style: italic;
  color: rgba(201, 168, 76, .75);
  letter-spacing: .12em;
  white-space: nowrap;
  pointer-events: none;
  animation: hintFade .8s 1.8s ease both;
  text-shadow: 0 1px 6px rgba(0,0,0,.8);
}
@keyframes hintFade {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#env-overlay.fading #env-hint { opacity: 0; }

/* ============================================================
   COUPLE MODAL
============================================================ */
#couple-modal {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: rgba(6,12,8,.85);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  opacity: 0; pointer-events: none; transition: opacity .55s ease;
}
#couple-modal.visible    { opacity: 1; pointer-events: auto; }
#couple-modal.dismissing { opacity: 0; pointer-events: none; }

.modal-card {
  position: relative; width: 100%; max-width: 560px;
  background: linear-gradient(155deg, #1C0A30 0%, #0e1f14 55%, #1A1200 100%);
  border-radius: 4px; overflow: hidden;
  transform: scale(.88) translateY(20px); opacity: 0;
  transition: transform .6s cubic-bezier(.34,1.56,.64,1), opacity .5s ease;
  box-shadow: 0 0 0 1px rgba(201,168,76,.22), 0 40px 80px rgba(0,0,0,.65);
}
#couple-modal.visible .modal-card {
  transform: scale(1) translateY(0); opacity: 1; transition-delay: .1s;
}
.modal-band {
  height: 3px;
  background: linear-gradient(90deg, transparent, #8B6914 20%, #C9A84C 50%, #8B6914 80%, transparent);
}
.modal-texture {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(201,168,76,.04) 1px, transparent 1px);
  background-size: 24px 24px; pointer-events: none; z-index: 0;
}
.modal-card::before {
  content: ''; position: absolute; inset: 14px;
  border: 1px solid rgba(201,168,76,.14);
  border-radius: 2px; pointer-events: none; z-index: 0;
}
.modal-corner {
  position: absolute; width: 10px; height: 10px;
  border: 1px solid rgba(201,168,76,.45); transform: rotate(45deg); z-index: 2;
}
.modal-corner--tl{top:28px;left:28px} .modal-corner--tr{top:28px;right:28px}
.modal-corner--bl{bottom:28px;left:28px} .modal-corner--br{bottom:28px;right:28px}

.modal-body {
  position: relative; z-index: 1;
  padding: 3rem 2.5rem 2.5rem;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.modal-ornament {
  font-family: 'Jost', sans-serif;
  font-size: .72rem; letter-spacing: .42em; text-transform: uppercase;
  color: rgba(201,168,76,.6); margin-bottom: 1.6rem;
  animation: modalUp .7s .4s ease both;
}
.modal-monogram {
  font-family: 'Parisienne','Great Vibes', cursive;
  font-size: clamp(2.8rem, 6.5vw, 4.2rem);
  color: rgba(232,213,163,.92); line-height: 1; margin-bottom: .6rem;
  animation: modalUp .7s .5s ease both;
}
.modal-rule {
  width: 80px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,.55), transparent);
  margin: 1.2rem auto; animation: modalUp .7s .6s ease both;
}
.modal-message {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1rem, 2.1vw, 1.18rem); font-weight: 300; font-style: italic;
  color: rgba(255,255,255,.83); line-height: 2.1;
  max-width: 430px; animation: modalUp .7s .7s ease both;
  text-align: center;
}
.modal-signature {
  margin-top: 1.8rem; display: flex; flex-direction: column;
  align-items: center; gap: .35rem; animation: modalUp .7s .85s ease both;
}
.modal-sig-names {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.3rem, 2.7vw, 1.75rem); font-style: italic;
  color: rgba(201,168,76,.92);
}
.modal-sig-date {
  font-family: 'Jost', sans-serif;
  font-size: .68rem; letter-spacing: .28em; text-transform: uppercase;
  color: rgba(255,255,255,.28);
}
.modal-rule-bottom {
  width: 40px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,.3), transparent);
  margin: 1.8rem auto 1.4rem; animation: modalUp .7s .95s ease both;
}
.modal-enter-btn {
  display: inline-flex; align-items: center; gap: .7rem;
  padding: .78rem 2.2rem;
  border: 1px solid rgba(201,168,76,.38); border-radius: 2px;
  background: transparent; color: rgba(201,168,76,.88);
  font-family: 'Jost', sans-serif; font-size: .73rem;
  font-weight: 500; letter-spacing: .28em; text-transform: uppercase;
  cursor: pointer; transition: all .35s;
  animation: modalUp .7s 1.05s ease both; position: relative; overflow: hidden;
}
.modal-enter-btn::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(201,168,76,.08);
  transform: scaleX(0); transform-origin: left; transition: transform .35s;
}
.modal-enter-btn:hover::before { transform: scaleX(1); }
.modal-enter-btn:hover {
  border-color: rgba(201,168,76,.7); color: rgba(201,168,76,1); transform: translateY(-2px);
}
.modal-btn-arrow { display: inline-flex; flex-direction: column; gap: 3px; }
.modal-btn-arrow span { display: block; width: 14px; height: 1px; background: currentColor; }
.modal-btn-arrow span:first-child { transform: rotate(35deg) translateX(2.5px); }
.modal-btn-arrow span:last-child  { transform: rotate(-35deg) translateX(-2.5px); }
.modal-dismiss-hint {
  position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
  font-family: 'Jost', sans-serif;
  font-size: .58rem; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(255,255,255,.14); white-space: nowrap;
  animation: modalUp .7s 1.3s ease both; z-index: 2;
}
@keyframes modalUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 600px) {
  .modal-body { padding: 2.5rem 1.5rem 2rem; }
  .modal-corner--tl{top:16px;left:16px} .modal-corner--tr{top:16px;right:16px}
  .modal-corner--bl{bottom:16px;left:16px} .modal-corner--br{bottom:16px;right:16px}
}
