/* ==========================================================
   ENVELOPE FINAL - SVG INLINE RESPONSIVE
   Proyecto: Elena & Alvaro
========================================================== */

.welcome-envelope {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100%;
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: #06111f;
}

.welcome-envelope.is-opening {
  pointer-events: none;
}

.envelope-stage {
  position: relative;
  width: 100%;
  max-width: var(--invitation-width, 480px);
  min-height: 100svh;
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-card, 0 0 45px rgba(0,0,0,.55));
  perspective: 2500px;
}

/* SOLAPAS LATERALES AJUSTABLES */

.envelope-side-flap {
  position: absolute;
  z-index: 4;

  width: 65%;
  height: 95%;

  pointer-events: none;

   filter: drop-shadow(0 -10px 12px rgba(0,0,0,.16));
}

.envelope-side-flap svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* IZQUIERDA */
.envelope-side-left {
  left: -54%;
  bottom: 20%;

  transform: rotate(-30deg);
  transform-origin: center;
}

/* DERECHA */
.envelope-side-right {
  right: -54%;
  bottom: 20%;
  transform: rotate(30deg);
  transform-origin: center;
}



/* MARCO */

.envelope-border {
  position: absolute;
  inset: 20px;
  z-index: 3;
  border: 2px solid #dcb165;
  pointer-events: none;
}

/* SOLAPA INFERIOR */

.envelope-bottom-flap {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 5;
  width: 100%;
  height: 50%;
  filter: drop-shadow(0 -10px 12px rgba(0,0,0,.16));
}

.envelope-bottom-flap svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* SÍMBOLO CORAZÓN Y LLAVE */

.envelope-symbol {
  position: absolute;
  left: 50%;
  top: 29%;
  z-index: 6;
  width: 56%;
  max-width: 270px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.envelope-symbol::before {
  content: "";
  position: absolute;
  inset: 8%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(
      circle,
      rgba(220,177,101,.30) 0%,
      rgba(220,177,101,.16) 35%,
      rgba(220,177,101,0) 72%
    );
  filter: blur(8px);
  animation: symbolGlow 4.8s ease-in-out infinite;
}

.envelope-symbol img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  opacity: .98;
  filter:
    drop-shadow(0 8px 12px rgba(0,0,0,.36))
    drop-shadow(0 0 14px rgba(220,177,101,.34));
  animation: symbolFloatGold 4.8s ease-in-out infinite;
}

/* SOLAPA SUPERIOR */

.envelope-flap-wrap {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  width: 100%;
  height: 50%;
  transform-origin: top center;
  transform-style: preserve-3d;
  will-change: transform;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.16));
}

.envelope-flap {
  width: 100%;
  height: 100%;
  display: block;
}

/* SELLO PNG */

.envelope-seal-button {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 12;
  width: 240px;
  height: 240px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  transform: translate(-50%, 50%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
  appearance: none;
  -webkit-appearance: none;
  filter:
    drop-shadow(0 9px 14px rgba(0,0,0,.34))
    drop-shadow(0 0 10px rgba(220,177,101,.28));

  opacity: 0;
pointer-events: none;
visibility: hidden;
}

.envelope-seal-button.seal-ready {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  animation: sealBreath 2.6s ease-in-out infinite;
}

.envelope-seal-button.seal-ready::before {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;

  border: 1px solid rgba(220,177,101,.55);

  box-shadow:
    0 0 8px rgba(220,177,101,.35),
    0 0 22px rgba(220,177,101,.22);

  animation: sealPulse 2.6s ease-in-out infinite;

  pointer-events: none;
}

@keyframes sealBreath {
  0%, 100% {
    transform: translate(-50%, 50%) scale(1);
  }

  50% {
    transform: translate(-50%, 50%) scale(1.045);
  }
}

@keyframes sealPulse {
  0%, 100% {
    opacity: .25;
    transform: scale(.88);
  }

  50% {
    opacity: .9;
    transform: scale(1.08);
  }
}

.envelope-seal-button:focus,
.envelope-seal-button:focus-visible,
.envelope-seal-button:active {
  outline: none;
  box-shadow: none;
  border: 0;
}

.envelope-seal-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* TEXTO */

.envelope-text {
  position: absolute;
  left: 50%;
  top: calc(50% + 132px);
  z-index: 7;
  width: 86%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.envelope-label {
  margin: 0 0 10px;
  font-family: var(--font-title, 'Cinzel', serif);
  font-size: .76rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: #9a690e;
}

.envelope-guest {
  margin: 0;
  font-family: var(--font-script, 'Alex Brush', cursive);
  font-size: clamp(2.7rem, 13.5vw, 3.7rem);
  font-weight: 400;
  line-height: .9;
  color: #9a690e;
  text-shadow:
    0 1px 0 rgba(255,255,255,.8),
    0 2px 4px rgba(0,0,0,.16);
  position: relative;
  top: 12px;
}

.envelope-message {
  max-width: 310px;
  margin: 16px auto 0;
  font-size: 1.05rem;
  line-height: 1.35;
  color: #9a690e;
}

/* ANIMACIÓN */

.welcome-envelope.is-opening .envelope-flap-wrap {
  animation: flapOpenWithSeal 5.8s cubic-bezier(.55, 0, .18, 1) forwards;
}

.welcome-envelope.is-fading .envelope-stage {
  animation: envelopeFadeOut .48s ease forwards;
}

.welcome-envelope.show-flash::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10060;
  background:
    radial-gradient(
      circle at 50% 50%,
      rgba(255,255,255,1) 0%,
      rgba(255,255,255,.88) 28%,
      rgba(255,255,255,.35) 58%,
      rgba(255,255,255,0) 100%
    );
  animation: whiteFlash .62s ease forwards;
  pointer-events: none;
}

/* BOTÓN MÚSICA */

.music-toggle {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 999999;

  width: 50px;
  height: 50px;

  display: none;
  justify-content: center;
  align-items: center;

  border: 1px solid rgba(130, 88, 10, .45);
  border-radius: 50%;

  background:
    linear-gradient(
      180deg,
      #f6e4b5 0%,
      #e4c67b 35%,
      #dcb165 65%,
      #9a690e 100%
    );

  color: #041326;

  font-size: 0;
  line-height: 0;

  cursor: pointer;

  box-shadow:
    0 4px 12px rgba(0,0,0,.25),
    0 0 10px rgba(220,177,101,.25),
    inset 0 1px 2px rgba(255,255,255,.45);

  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  transition:
    background .25s ease,
    transform .25s ease,
    opacity .25s ease;

  opacity: .55;

  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
}

.music-toggle.playing {
  display: flex;
}

.music-toggle:hover {
  opacity: .90;
  transform: scale(1.06);
  background:
    linear-gradient(
      180deg,
      #fff0c8 0%,
      #e8cb82 35%,
      #dcb165 65%,
      #8f640f 100%
    );
}

.music-toggle:active {
  transform: scale(.94);
}

.music-toggle:focus,
.music-toggle:focus-visible,
.music-toggle:active {
  outline: none;
}

/* ICONO PLAY / PAUSA - COMPATIBLE CON iPHONE */

.music-toggle::before {
  content: "";
  display: block;

  width: 0;
  height: 0;

  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 15px solid #041326;

  transform: translateX(2px);
}

.music-toggle::after {
  content: none;
}

.music-toggle.is-pause::before {
  width: 16px;
  height: 18px;

  border: 0;

  background:
    linear-gradient(
      90deg,
      #041326 0 35%,
      transparent 35% 65%,
      #041326 65% 100%
    );

  transform: translateX(0);
}

/* KEYFRAMES */

@keyframes flapOpenWithSeal {
  from {
    transform: rotateX(0deg);
  }

  to {
    transform: rotateX(155deg);
  }
}

@keyframes envelopeFadeOut {
  to {
    opacity: 0;
    transform: scale(.985);
  }
}

@keyframes whiteFlash {
  0% {
    opacity: 0;
  }

  35% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes symbolFloatGold {
  0% {
    transform: translateY(0) scale(1);
    filter:
      drop-shadow(0 7px 11px rgba(0,0,0,.30))
      drop-shadow(0 0 10px rgba(220,177,101,.20));
  }

  50% {
    transform: translateY(-3px) scale(1.035);
    filter:
      drop-shadow(0 11px 18px rgba(0,0,0,.42))
      drop-shadow(0 0 22px rgba(245,226,190,.52));
  }

  100% {
    transform: translateY(0) scale(1);
    filter:
      drop-shadow(0 7px 11px rgba(0,0,0,.30))
      drop-shadow(0 0 10px rgba(220,177,101,.20));
  }
}

@keyframes symbolGlow {
  0% {
    opacity: .35;
    transform: scale(.92);
  }

  50% {
    opacity: .85;
    transform: scale(1.08);
  }

  100% {
    opacity: .35;
    transform: scale(.92);
  }
}

/* RESPONSIVE */

@media (max-width: 480px) {
  .envelope-seal-button {
    width: 240px;
    height: 240px;
  }

  .envelope-text {
    top: calc(50% + 132px);
  }
}
@media (min-width: 601px) {

/* SOLAPAS LATERALES AJUSTABLES */

.envelope-side-flap {
  position: absolute;
  z-index: 4;

  width: 65%;
  height: 95%;

  pointer-events: none;

   filter: drop-shadow(0 -10px 12px rgba(0,0,0,.16));
}

.envelope-side-flap svg {
  width: 100%;
  height: 150%;
  display: block;
}

/* IZQUIERDA */
.envelope-side-left {
  left: -54%;
  bottom: 30%;

  transform: rotate(-30deg);
  transform-origin: center;
}

/* DERECHA */
.envelope-side-right {
  right: -54%;
  bottom: 30%;
  transform: rotate(30deg);
  transform-origin: center;
}

}