/* ========================================================
   3. ENVELOPE OPENING OVERLAY (IMAGE 2 MATCH)
   ======================================================== */
.envelope-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #511419;
  background: linear-gradient(145deg, #741b22 0%, #54141a 45%, #3b0a0e 100%);
  overflow: hidden;
  padding: 16px;
  transition: opacity 2.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 2.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.invite-opening .envelope-screen,
.invite-open .envelope-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Opening Shockwave & Motion Blur Transition */
.envelope-seal::before,
.envelope-seal::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.invite-opening .envelope-seal {
  transform: scale(1.22);
  box-shadow: 0 0 45px rgba(212, 175, 55, 0.75);
  transition: transform 2.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 2.2s ease;
}

.invite-opening .envelope-seal::before {
  border: 3px solid rgba(82, 103, 70, 0.85);
  animation: seal-shockwave-1 2.4s cubic-bezier(0.15, 0.85, 0.35, 1) forwards;
}

.invite-opening .envelope-seal::after {
  border: 2px solid rgba(185, 155, 85, 0.8);
  animation: seal-shockwave-2 2.4s cubic-bezier(0.15, 0.85, 0.35, 1) 0.25s forwards;
}

@keyframes seal-shockwave-1 {
  0% {
    transform: scale(0.95);
    opacity: 0.95;
    box-shadow: 0 0 0 0 rgba(60, 89, 61, 0.55);
  }
  100% {
    transform: scale(2.8);
    opacity: 0;
    box-shadow: 0 0 25px rgba(60, 89, 61, 0);
  }
}

@keyframes seal-shockwave-2 {
  0% {
    transform: scale(0.95);
    opacity: 0.85;
    box-shadow: 0 0 0 0 rgba(185, 155, 85, 0.45);
  }
  100% {
    transform: scale(3.6);
    opacity: 0;
    box-shadow: 0 0 35px rgba(185, 155, 85, 0);
  }
}

/* Flowers, Card & Content slide upwards & fade out smoothly */
.invite-opening .envelope-box {
  transform: translateY(-85px) scale(0.97);
  opacity: 0;
  transition: transform 2.4s cubic-bezier(0.2, 0.8, 0.25, 1), opacity 2.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.invite-opening .envelope-flower-left {
  filter: blur(8px);
  opacity: 0;
  transform: rotate(20deg) translateY(-65px) scale(0.97);
  transition: filter 2.3s ease, opacity 2.1s cubic-bezier(0.4, 0, 0.2, 1), transform 2.4s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.invite-opening .envelope-card {
  filter: blur(8px);
  opacity: 0;
  transform: translateY(-85px) scale(0.96);
  transition: filter 2.3s ease, opacity 2.1s cubic-bezier(0.4, 0, 0.2, 1), transform 2.4s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.invite-opening .envelope-names,
.invite-opening .envelope-divider,
.invite-opening .envelope-date,
.invite-opening .envelope-invite-text,
.invite-opening .btn-open {
  filter: blur(6px);
  opacity: 0;
  transform: translateY(-45px);
  transition: filter 1.9s ease, opacity 1.8s ease, transform 2.0s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.invite-opening .ambient-particles {
  filter: blur(8px);
  opacity: 0;
  transform: translateY(-50px);
  transition: filter 2.3s ease, opacity 2.2s ease, transform 2.4s ease;
}

/* Falling ambient particles */
.ambient-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.particle {
  position: absolute;
  top: -40px;
  color: var(--gold);
  font-size: 16px;
  opacity: 0.75;
  animation: particle-fall linear infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

@keyframes particle-fall {
  0% {
    transform: translateY(-20px) translateX(0) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  15% { opacity: 0.85; }
  85% { opacity: 0.85; }
  100% {
    transform: translateY(105vh) translateX(var(--sway, 30px)) rotate(360deg) scale(1.1);
    opacity: 0;
  }
}

/* Velvet Envelope Card Container (Larger & More Spacious) */
.envelope-box {
  position: relative;
  z-index: 10;
  width: min(660px, 94vw);
  perspective: 1000px;
}

.envelope-card {
  position: relative;
  background: #fbf7ee url("../assets/rough-paper.png") center / cover;
  border-radius: 18px;
  padding: 44px 40px 38px;
  text-align: center;
  box-shadow: 
    0 26px 65px rgba(15, 1, 3, 0.55),
    0 8px 22px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Decorative Lotus Flower on Left tilted 30deg to the right */
.envelope-flower-left {
  position: absolute;
  top: 10px;
  left: -85px;
  width: clamp(170px, 42vw, 225px);
  height: auto;
  pointer-events: none;
  opacity: 0.98;
  z-index: 2;
  transform: rotate(15deg);
  transform-origin: 35% 85%;
  animation: flower-sway-left 6s ease-in-out infinite;
  filter: drop-shadow(2px 6px 14px rgba(40, 10, 15, 0.18));
}

.envelope-flower-right {
  display: none !important;
}

@keyframes flower-sway-left {
  0%, 100% {
    transform: rotate(15deg) translateY(0) scale(1);
  }
  35% {
    transform: rotate(17.2deg) translateY(-4px) scale(1.02);
  }
  70% {
    transform: rotate(13deg) translateY(2px) scale(0.99);
  }
}

/* Dark Wine Wax Seal Badge at Top Center */
.envelope-seal {
  position: relative;
  margin: 0 auto 18px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #561219, #38080d, #200205);
  box-shadow: 0 6px 20px rgba(25, 2, 5, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: seal-pulse 2.4s ease-in-out infinite;
}

.envelope-seal:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(35, 4, 8, 0.55);
}

.envelope-seal svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

@keyframes seal-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Couple Names (Slender & Elegant Serif) */
.envelope-names {
  position: relative;
  z-index: 5;
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  color: #4a1015;
  margin: 0 auto 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.envelope-name-line {
  font-size: clamp(1.85rem, 4.8vw, 2.75rem);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: 0.015em;
  color: #481015;
}

.envelope-name-amp {
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-size: clamp(1.4rem, 3.6vw, 1.95rem);
  font-weight: 400;
  color: #481015;
  line-height: 1.15;
  margin: 2px 0 3px;
}

/* Elegant Divider */
.envelope-divider {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px auto 12px;
  width: min(100%, 140px);
  max-width: 140px;
}

.envelope-divider .line {
  flex: 1;
  height: 1.5px;
  background: linear-gradient(to right, transparent 0%, #b89855 12%, #947738 100%);
  opacity: 0.85;
  border-radius: 1px;
}

.envelope-divider .line:last-child {
  background: linear-gradient(to left, transparent 0%, #b89855 12%, #947738 100%);
}

.envelope-divider .ornament {
  color: #927536;
  font-size: 1.05rem;
  opacity: 0.95;
  line-height: 1;
  padding: 0 3px;
}

/* Date & Subtext (Mảnh mai, thanh thoát, tao nhã) */
.envelope-date {
  position: relative;
  z-index: 5;
  font-family: "Cormorant Garamond", "Lora", Georgia, serif;
  font-size: clamp(1rem, 2.3vw, 1.15rem);
  color: #65494d;
  margin-bottom: 6px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.envelope-invite-text {
  position: relative;
  z-index: 5;
  font-family: "Cormorant Garamond", "Lora", Georgia, serif;
  font-size: clamp(1rem, 2.1vw, 2rem);
  color: #75575b;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.03em;
  margin-bottom: 22px;
}

/* Pill Open Button */
.btn-open {
  position: relative;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 36px;
  background: #3e0d12;
  color: #fff8f2;
  font-family: "Cormorant Garamond", "Lora", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 999px;
  box-shadow: 0 7px 20px rgba(40, 5, 10, 0.42);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
  cursor: pointer;
}

.btn-open:hover {
  background: #4e1218;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(40, 5, 10, 0.58);
}

.btn-open:active {
  transform: translateY(0);
}

.btn-open .shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: btn-shimmer 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btn-shimmer {
  0% { left: -100%; }
  35%, 100% { left: 140%; }
}
