/* ==========================================================================
   ENVELOPE 3D & WAX SEAL STYLES
   Estilos y Animaciones 3D para el Sobre y Sello de Lacre
   ========================================================================== */

.envelope-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #2e2621 0%, #15110e 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 1.2s;
  overflow: hidden;
  padding: 15px;
}

.envelope-screen.opened-fade {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  perspective: 1200px;
}

/* Textos de invitación sobre el sobre */
.envelope-intro-text {
  text-align: center;
  margin-bottom: 25px;
  color: #fff;
  z-index: 10;
  animation: fadeInDown 1.2s ease-out;
}

.envelope-intro-text .tagline {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #d4af37;
  margin-bottom: 8px;
}

.envelope-intro-text .intro-couple-names {
  font-family: 'Great Vibes', cursive;
  font-size: 2.8rem;
  font-weight: normal;
  color: #f7ede2;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
  line-height: 1.2;
  margin-bottom: 12px;
}

.invitation-notice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 8px 18px;
  border-radius: 50px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  color: #f0e6d2;
  backdrop-filter: blur(8px);
  margin-bottom: 12px;
}

.invitation-notice .notice-icon {
  color: #d4af37;
  font-size: 1rem;
}

.tap-hint {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.82rem;
  color: #d4af37;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pulse-icon {
  animation: pulseHint 1.5s infinite;
}

@keyframes pulseHint {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; color: #fff; }
}

/* ==============================================
   ESTRUCTURA DEL SOBRE 3D
   ============================================== */
.envelope-3d-box {
  position: relative;
  width: 320px;
  height: 215px;
  background: #c2ab87;
  border-radius: 6px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7), 0 0 35px rgba(212, 175, 55, 0.25);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}

.envelope-3d-box:hover {
  transform: translateY(-5px) scale(1.02);
}

/* Fondo interior del sobre */
.envelope-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #a48c66 0%, #7d6746 100%);
  border-radius: 6px;
  z-index: 1;
}

/* Carta interior que sale al abrir */
.envelope-letter {
  position: absolute;
  top: 10px;
  left: 15px;
  width: 290px;
  height: 195px;
  background: #faf7f2;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2d7c5;
  z-index: 2;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s;
  background-image: radial-gradient(#e5d8c3 1px, transparent 1px);
  background-size: 16px 16px;
}

.letter-inner {
  border: 1px dashed #c4a77d;
  padding: 10px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.letter-monogram {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: #967840;
  letter-spacing: 2px;
  font-weight: 700;
}

.letter-inner h3 {
  font-family: 'Great Vibes', cursive;
  font-size: 1.8rem;
  color: #4a3b2c;
  margin: 2px 0;
}

.letter-date {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: #8c734b;
}

.letter-divider {
  color: #c4a77d;
  font-size: 0.9rem;
  margin: 2px 0;
}

.letter-text {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: #5c4d3d;
  line-height: 1.2;
}

/* Solapas del Sobre (Pliegues triangulares con CSS) */
.envelope-left {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid #ba9f77;
  border-top: 108px solid transparent;
  border-bottom: 107px solid transparent;
  border-radius: 4px 0 0 4px;
  z-index: 3;
}

.envelope-right {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-right: 160px solid #ba9f77;
  border-top: 108px solid transparent;
  border-bottom: 107px solid transparent;
  border-radius: 0 4px 4px 0;
  z-index: 3;
}

.envelope-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-bottom: 120px solid #aa8e67;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-radius: 0 0 6px 6px;
  z-index: 4;
}

/* Solapa Superior (Flap) con rotación 3D */
.envelope-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-top: 125px solid #cbaf86;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  transform-origin: top center;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), z-index 0.2s;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* ==============================================
   SELLO DE LACRE DORADO (WAX SEAL)
   ============================================== */
.wax-seal {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  background: radial-gradient(circle at 35% 35%, #e6c875, #b8860b 60%, #8b6508 100%);
  border-radius: 50%;
  z-index: 6;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.6), inset 0 -2px 6px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.4s ease, opacity 0.5s ease;
  border: 2px solid #dfb743;
}

.wax-seal:hover {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 25px rgba(223, 183, 67, 0.8), 0 8px 20px rgba(0, 0, 0, 0.5);
}

.seal-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 240, 180, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at 40% 40%, rgba(218, 165, 32, 0.9), rgba(139, 101, 8, 0.9));
}

.seal-letters {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff8dc;
  letter-spacing: 1px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.seal-glow {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 2px solid rgba(223, 183, 67, 0.4);
  animation: waxGlow 2s infinite ease-in-out;
}

@keyframes waxGlow {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

/* Cintas decorativas del sello */
.seal-ribbon {
  position: absolute;
  width: 14px;
  height: 28px;
  background: linear-gradient(to bottom, #990011, #660000);
  top: 40px;
  z-index: -1;
  border-radius: 2px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.ribbon-left {
  left: 18px;
  transform: rotate(-18deg);
}

.ribbon-right {
  right: 18px;
  transform: rotate(18deg);
}

/* ==============================================
   ANIMACIÓN DE APERTURA (OPEN STATE)
   ============================================== */
.envelope-3d-box.is-opening .wax-seal {
  transform: translate(-50%, -50%) scale(1.3);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.envelope-3d-box.is-opening .envelope-top {
  transform: rotateX(180deg);
  z-index: 0;
  transition-delay: 0.2s;
}

.envelope-3d-box.is-opening .envelope-letter {
  transform: translateY(-130px) scale(1.06);
  z-index: 10;
  transition-delay: 0.6s;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
}

/* Media Query para pantallas pequeñas */
@media (max-width: 420px) {
  .envelope-intro-text .intro-couple-names {
    font-size: 2.2rem;
  }
  .envelope-3d-box {
    width: 290px;
    height: 195px;
  }
  .envelope-letter {
    width: 260px;
    height: 175px;
    left: 15px;
  }
  .envelope-left {
    border-left-width: 145px;
    border-top-width: 98px;
    border-bottom-width: 97px;
  }
  .envelope-right {
    border-right-width: 145px;
    border-top-width: 98px;
    border-bottom-width: 97px;
  }
  .envelope-bottom {
    border-bottom-width: 110px;
    border-left-width: 145px;
    border-right-width: 145px;
  }
  .envelope-top {
    border-top-width: 115px;
    border-left-width: 145px;
    border-right-width: 145px;
  }
  .wax-seal {
    top: 100px;
    width: 60px;
    height: 60px;
  }
  .seal-inner {
    width: 42px;
    height: 42px;
  }
  .seal-letters {
    font-size: 0.95rem;
  }
  .envelope-3d-box.is-opening .envelope-letter {
    transform: translateY(-110px) scale(1.04);
  }
}
