/* ═══════════════════════════════════════════════
   SOBRE DE APERTURA
═══════════════════════════════════════════════ */
#envelope-intro {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f9f4ee 0%, #f2e7db 100%);
  transition: opacity 600ms ease, visibility 600ms ease;
}

#envelope-intro.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.env-wrap {
  position: relative;
  width: 220px;
  height: 160px;
  cursor: pointer;
}

/* Cuerpo del sobre */
.env-body {
  position: absolute;
  inset: 0;
  background: #fff8f1;
  border: 1.5px solid rgba(141, 99, 73, 0.3);
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(80, 55, 38, 0.2);
  overflow: hidden;
}

/* Pliegue inferior V */
.env-body::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(135deg, #f0e4d7 50%, transparent 50%),
              linear-gradient(225deg, #f0e4d7 50%, transparent 50%);
  background-size: 50% 100%;
  background-position: left bottom, right bottom;
  background-repeat: no-repeat;
}

/* Pliegues laterales */
.env-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(141,99,73,0.08) 50%, transparent 50%),
    linear-gradient(225deg, rgba(141,99,73,0.08) 50%, transparent 50%);
  background-size: 50% 100%;
  background-position: left top, right top;
  background-repeat: no-repeat;
}

/* Solapa superior */
.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: #f5ece3;
  border-bottom: 1.5px solid rgba(141, 99, 73, 0.2);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.env-flap.open {
  transform: rotateX(180deg);
}

/* Tarjeta dentro del sobre */
.env-card {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 10px;
  height: 110px;
  background: linear-gradient(145deg, #fff8f1, #f5ece3);
  border: 1px solid rgba(141, 99, 73, 0.25);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transform: translateY(0);
  transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1) 200ms;
  z-index: 1;
}

.env-card.rise {
  transform: translateY(-90px);
}

.env-card-names {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
  color: #271d17;
  line-height: 1;
}

.env-card-names span {
  color: #8d6349;
}

.env-card-date {
  font-family: "Outfit", sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6d5f56;
}

.env-hint {
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Outfit", sans-serif;
  font-size: 0.72rem;
  color: #8d6349;
  white-space: nowrap;
  letter-spacing: 0.08em;
  animation: pulse-hint 1.6s ease-in-out infinite;
}

@keyframes pulse-hint {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}


/* ═══════════════════════════════════════════════
   PÉTALOS CAYENDO
═══════════════════════════════════════════════ */
#petals-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.75;
}



/* ═══════════════════════════════════════════════
   LIGHTBOX GALERÍA
═══════════════════════════════════════════════ */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(20, 14, 10, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease, visibility 280ms ease;
}

#lightbox.open {
  opacity: 1;
  visibility: visible;
}

#lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 16px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

#lightbox img.slide-left {
  animation: lb-slide-left 220ms ease forwards;
}
#lightbox img.slide-right {
  animation: lb-slide-right 220ms ease forwards;
}

@keyframes lb-slide-left {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(-40px); opacity: 0; }
}
@keyframes lb-slide-right {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(40px); opacity: 0; }
}

.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 248, 241, 0.12);
  border: 1px solid rgba(255, 248, 241, 0.2);
  color: #fff8f1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms;
  -webkit-tap-highlight-color: transparent;
}

.lb-btn:hover { background: rgba(255, 248, 241, 0.22); }
#lb-prev { left: 16px; }
#lb-next { right: 16px; }

#lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 248, 241, 0.12);
  border: 1px solid rgba(255, 248, 241, 0.2);
  color: #fff8f1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms;
  -webkit-tap-highlight-color: transparent;
}

#lb-close:hover { background: rgba(255, 248, 241, 0.22); }

#lb-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Outfit", sans-serif;
  font-size: 0.8rem;
  color: rgba(255, 248, 241, 0.6);
  letter-spacing: 0.1em;
}


/* ═══════════════════════════════════════════════
   CONFETTI RSVP
═══════════════════════════════════════════════ */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8000;
}
