/* ============================================================
   components/envelope.css - Save-the-Date envelope + open animation.
   ============================================================ */
.gate{
  position:relative;
  z-index:1;
  min-height:100svh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:clamp(40px,6vh,72px) var(--space-5);
  transition:opacity 0.5s ease, transform 0.5s ease;
}
/* Parallax image container.
   Extends 30vh below the gate so the photo bleeds into the open-announcement
   and the start of the invite section, then fades out via ::after gradient. */
.gate-bg{
  position:absolute;
  top:0;left:0;right:0;
  bottom:-30vh;
  z-index:0;
  overflow:hidden;
  pointer-events:none;
}
/* Photo-to-paper gradient occupying the bottom 30vh of gate-bg
   (i.e. the extension that bleeds below the gate).
   Starts transparent at the gate's bottom edge, full paper at the
   "We are getting married" line (~30vh below). */
.gate-bg::after{
  content:'';
  position:absolute;
  bottom:0;left:0;right:0;
  height:30vh;
  background:linear-gradient(to bottom, rgba(243,239,230,0), var(--paper));
  pointer-events:none;
}
/* Background image — oversized to cover the gate-bg's extended height (gate + 30vh)
   plus the GSAP parallax travel range. object-fit:cover handles aspect-ratio
   at any viewport. */
.gate-parallax-img{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:115%;
  object-fit:cover;
  user-select:none;
  -webkit-user-drag:none;
}
.is-desktop .gate-parallax-img{ will-change:transform; }
/* Mobile: no parallax — contain the photo within the gate, no bleed below.
   The ::after gradient fades the photo over the bottom of the gate itself. */
.is-mobile  .gate-parallax-img{ height:100%; }
.is-mobile  .gate-bg{ bottom:0; }
.gate-header{
  position:relative;
  z-index:2;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:1.1rem 2.8rem 1.3rem;
  margin-bottom:clamp(26px,4.4vh,44px);
  border-radius:20px;
  background:rgba(255,255,255,.26);
  backdrop-filter:blur(18px) saturate(1.5);
  -webkit-backdrop-filter:blur(18px) saturate(1.5);
  border:1px solid rgba(255,255,255,.45);
  box-shadow:0 8px 32px rgba(60,52,38,.08), inset 0 1px 0 rgba(255,255,255,.55);
  transition:opacity 1.2s ease;
}
.gate .save{
  font-family:'Bonheur Royale', cursive;
  font-weight:400;
  font-size:clamp(3rem,8.8vw,4.45rem);
  line-height:.82;
  letter-spacing:0;
  text-transform:none;
  color:#111;
  text-shadow:none;
}
.gate .the-date{
  font-family:var(--ui);
  font-weight:500;
  letter-spacing:.42em;
  text-transform:uppercase;
  font-size:.7rem;
  color:#111;
  margin:.75rem 0 0;
}

.env-wrap{
  position:relative;
  z-index:2;
  width:min(82vw,660px);
  perspective:1500px;
}
.envelope{
  position:relative;
  width:100%;
  aspect-ratio:1.58;
  cursor:pointer;
  filter:drop-shadow(0 34px 34px rgba(60,52,38,.22));
}
.env-img{
  position:absolute;
  left:50%;
  pointer-events:none;
  user-select:none;
  -webkit-user-drag:none;
  transition:opacity .55s ease,transform var(--dur-slow) ease;
}
.env-img-closed{
  inset:0;
  left:0;
  z-index:4;
  width:100%;
  height:100%;
  object-fit:contain;
}
.env-img-open{
  bottom:-60%;
  z-index:3;
  width:100%;
  height:auto;
  opacity:0;
  transform:translateX(-50%) translateY(8%) scale(.96);
  filter:drop-shadow(0 18px 24px rgba(72,58,36,.18));
}

.photo{
  position:absolute;
  left:50%;
  top:48%;
  width:42%;
  background:#fff;
  padding:11px 11px 30px;
  box-shadow:var(--shadow-photo);
  z-index:2;
  opacity:0;
  transition:transform 1s var(--ease) .55s,opacity var(--dur) .55s;
}
.photo img{
  width:100%;
  height:clamp(140px,24vw,202px);
  object-fit:cover;
}
.photo.p1{transform:translateX(-82%) translateY(2%) rotate(-5deg);}
.photo.p2{transform:translateX(-18%) translateY(2%) rotate(5deg);}

.seal{
  position:absolute;
  top:61%;
  left:50%;
  z-index:6;
  width:82px;
  height:82px;
  border-radius:50%;
  transform:translate(-50%,-50%);
  background:url("../../assets/images/gm-sticker.png") center/contain no-repeat;
  filter:drop-shadow(0 15px 18px rgba(20,18,16,.38));
  transition:transform .45s ease,opacity .45s ease;
}
.seal span{
  display:none;
}

/* Clickable pill — same visual language as the home "Click to continue" CTA
   (.holder-cta): dark translucent pill, uppercase Jost, on its own line. */
.tap{
  position:relative;
  z-index:2;
  margin-top:clamp(28px,5vh,46px);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:38px;
  padding:.5rem 1.5rem;
  border-radius:var(--radius-pill);
  background:rgba(51,48,42,.5);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  border:1px solid rgba(244,239,230,.7);
  cursor:pointer;
  font-family:var(--ui);
  font-weight:400;
  font-size:.6rem;
  letter-spacing:.24em;
  text-transform:uppercase;
  line-height:1;
  color:#f4efe6;
  transition:background .2s ease, opacity .4s;
}
.tap:hover{background:rgba(51,48,42,.64);}
.tap i{display:none;}

/* --- open state --- */
.envelope.open{cursor:default;}
.envelope.open .env-img-closed{opacity:0;transform:scale(.98);}
.envelope.open .env-img-open{opacity:1;transform:translateX(-50%) translateY(0) scale(1);}
.envelope.open .seal{transform:translate(-50%,-50%) scale(0);opacity:0;}
.envelope.open .photo{z-index:5;opacity:1;}
.envelope.open .photo.p1{transform:translateX(-92%) translateY(-122%) rotate(-11deg);}
.envelope.open .photo.p2{transform:translateX(-8%) translateY(-122%) rotate(11deg);}
.gate.opening .gate-header,
.gate.opening .tap{opacity:0;pointer-events:none;}

/* --- flowers --- */
.env-flower{
  position:absolute;
  pointer-events:none;
  user-select:none;
  -webkit-user-drag:none;
  opacity:0;
  transition:opacity .9s ease .6s, transform .9s ease .6s;
}
/* flower3 — top-right corner, behind envelope (DOM order keeps it under) */
.env-flower-top{
  width:55%;
  right:-20%;
  top:-48%;
  z-index:0;
  transform:translateY(-12px);
}
/* flower4 — bottom-left corner, in front; golden ratio: 61.8% outside / 38.2% overlapping */
.env-flower-front{
  width:48%;
  left:-20%;
  bottom:-80%;
  z-index:15;
  transform:translateX(-12px);
}
.gate.opening .env-flower-top{
  opacity:1;
  transform:translateY(0);
}
.envelope.open ~ .env-flower-front{
  opacity:1;
  transform:translateX(0);
}

@media(max-width:640px){
  .gate{padding:clamp(22px,4vh,36px) clamp(12px,4vw,20px) clamp(22px,4vh,36px);}
  .gate-bg{bottom:0;}
  .gate-header{
    width:min(100%,420px);
    margin-bottom:clamp(22px,4vh,34px);
    padding:.85rem clamp(.8rem,5vw,1.5rem) 1rem;
    background:rgba(255,255,255,.48);
  }
  .gate .save{font-size:clamp(2.6rem,14vw,3.7rem);}
  .gate .the-date{font-size:clamp(.52rem,2.5vw,.62rem);letter-spacing:.22em;line-height:1.55;}
  .env-wrap{width:min(84vw,430px);}
  .photo{top:50%;width:43%;}
  .photo{padding:6px 6px 16px;}
  /* taller crop so the portrait photos aren't squashed wider than on desktop */
  .photo img{height:clamp(112px,30vw,168px);}
  .seal{width:clamp(52px,16vw,66px);height:clamp(52px,16vw,66px);}
  .tap{
    margin-top:clamp(22px,4vh,34px);
    min-height:44px;
    padding:.55rem 1.4rem;
    font-size:.62rem;
    letter-spacing:.22em;
  }
  .env-flower-top{width:46%;right:-12%;top:-42%;}
  .env-flower-front{width:40%;left:-12%;bottom:-62%;}
  .env-wrap .suite-card-date{
    right:-2%;
    bottom:-62%;
    width:38%;
    min-height:0;
    padding:.75rem .35rem;
  }
  .env-wrap .suite-day,.env-wrap .suite-year{font-size:clamp(.9rem,4.5vw,1.2rem);}
  .env-wrap .suite-month{font-size:clamp(1.7rem,9vw,2.4rem);}
  .env-wrap .suite-place{font-size:clamp(.55rem,2.6vw,.72rem);margin-top:.6rem;}
}
@media(prefers-reduced-motion:reduce){
  .seal{animation:none;}
  .envelope.open .env-img,.envelope.open .photo{transition:none;}
}

/* Touch / mobile: backdrop-filter:blur is expensive and gains nothing on solid
   backgrounds. Replace with a slightly more opaque solid tint. */
@media(hover:none),(pointer:coarse){
  .gate-header{
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
    background:rgba(255,255,255,.82);
    box-shadow:0 4px 16px rgba(60,52,38,.07), inset 0 1px 0 rgba(255,255,255,.7);
  }
  .tap{
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
    background:rgba(51,48,42,.76);
  }
}

/* --- suite-card-date in env-wrap — mirrors flower4 on the opposite (right) side.
   All card dimensions, fonts, and visual styling come from collage.css .suite-card.
   Only the position and entrance animation are overridden here. */
.env-wrap .suite-card-date{
  right:-3%;
  left:auto;
  top:auto;
  bottom:-70%;
  opacity:0;
  z-index:14;
  transform:translateX(12px);
  transition:opacity .9s ease .6s, transform .9s ease .6s;
}
.envelope.open ~ .suite-card-date{
  opacity:1;
  transform:translateX(0);
}
