/* ========================================================
   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:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.52), transparent 28%),
    radial-gradient(circle at 82% 76%, rgba(255, 255, 255, 0.3), transparent 30%),
    linear-gradient(145deg, #dce4d8 0%, #c9d4c5 48%, #aebdab 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(91, 116, 91, 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(124, 148, 121, 0.7);
  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(91, 116, 91, 0.5);
  }
  100% {
    transform: scale(2.8);
    opacity: 0;
    box-shadow: 0 0 25px rgba(91, 116, 91, 0);
  }
}

@keyframes seal-shockwave-2 {
  0% {
    transform: scale(0.95);
    opacity: 0.85;
    box-shadow: 0 0 0 0 rgba(124, 148, 121, 0.4);
  }
  100% {
    transform: scale(3.6);
    opacity: 0;
    box-shadow: 0 0 35px rgba(124, 148, 121, 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,
.invite-opening .envelope-flower-right {
  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(440px, 90vw);
  perspective: 1000px;
}

.envelope-card {
  position: relative;
  isolation: isolate;
  height: 450px;
  min-height: 450px;
  max-height: 450px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.86), transparent 44%),
    linear-gradient(160deg, #fbfcf7 0%, #f1f4eb 100%);
  border-radius: 20px;
  padding: 24px 20px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-shadow: 
    0 28px 70px rgba(35, 55, 39, 0.3),
    0 8px 22px rgba(35, 55, 39, 0.16);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.76);
}

.envelope-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 3;
  border: 1px solid rgba(177, 157, 93, 0.62);
  border-radius: 14px;
  pointer-events: none;
}

.envelope-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(120deg, rgba(255,255,255,.26), transparent 34%, rgba(190,201,181,.12));
  pointer-events: none;
}

/* Botanical corner ornaments */
.envelope-flower-left {
  position: absolute;
  bottom: -62px;
  left: -52px;
  width: 190px;
  height: auto;
  pointer-events: none;
  opacity: 0.36;
  z-index: 2;
  transform: rotate(4deg);
  transform-origin: 30% 90%;
  animation: flower-sway-left 6s ease-in-out infinite;
  mix-blend-mode: multiply;
}

.envelope-flower-right {
  position: absolute;
  top: -42px;
  right: -32px;
  display: block;
  width: 185px;
  height: auto;
  pointer-events: none;
  opacity: 0.34;
  z-index: 2;
  transform: rotate(-5deg);
  transform-origin: 70% 10%;
  animation: flower-sway-right 7s ease-in-out infinite;
  mix-blend-mode: multiply;
}

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

@keyframes flower-sway-right {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50% { transform: rotate(-7deg) translateY(4px); }
}

.envelope-kicker {
  position: relative;
  z-index: 5;
  margin: 0;
  color: #344737;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
}

/* Dark Wine Wax Seal Badge at Top Center */
.envelope-seal {
  position: relative;
  margin: 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #82977f, #5f765f 58%, #3f5542);
  border: 2px solid #c9ad68;
  box-shadow: 0 7px 20px rgba(45, 67, 48, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.3);
  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: 20px;
  height: 20px;
  fill: #f5e8c4;
  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: "Alex Brush", "Great Vibes", cursive;
  color: #203a2a;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.envelope-name-line {
  font-size: clamp(2.8rem, 8.8vw, 3.4rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: 0.015em;
  color: #203a2a;
}

.envelope-name-amp {
  font-family: "Alex Brush", "Great Vibes", cursive;
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 400;
  color: #af9252;
  line-height: 1;
  margin: -2px 0;
}

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

.envelope-divider .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, #b1985c 40%, #b1985c 100%);
  opacity: 0.65;
}

.envelope-divider .line:last-child {
  background: linear-gradient(to left, transparent, #b1985c 40%, #b1985c 100%);
}

.envelope-divider .ornament {
  color: #8b7849;
  font-size: 0.8rem;
  opacity: 0.8;
  line-height: 1;
}

/* Date & Subtext (Mảnh mai, thanh thoát, tao nhã) */
.envelope-date {
  position: relative;
  z-index: 5;
  font-family: "Cinzel", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(0.86rem, 2.2vw, 0.98rem);
  color: #344737;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.envelope-invite-text {
  position: relative;
  z-index: 5;
  font-family: "Cormorant Garamond", "Lora", Georgia, serif;
  font-size: clamp(1.15rem, 3.8vw, 1.35rem);
  color: #2c4230;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
}

/* Pill Open Button */
.btn-open {
  position: relative;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 32px;
  background: #5f765f;
  color: #fff8f2;
  font-family: "Cormorant Garamond", "Lora", Georgia, serif;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid #c6a75f;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(45, 67, 48, 0.26);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
  cursor: pointer;
}

.btn-open:hover {
  background: #4e654f;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(45, 67, 48, 0.4);
}

.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%; }
}
