/* ── Sealed envelope artwork (template thumbnails + invitation intro) ──
   Colours come from inline vars: --env (paper), --seal (wax), --seal-ink (monogram).
   Sized with container units so one markup works from a 160px thumbnail to a full screen. */
.env {
  --env: #efe4c8;
  --seal: #b8912f;
  --seal-ink: #fff8ea;
  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
  background: var(--env);
  perspective: 1400px;
}

.env__paper {
  position: absolute;
  inset: 0;
  background-image:
    url("../images/resources/emboss-light.svg"),
    url("../images/resources/emboss-dark.svg"),
    radial-gradient(ellipse 80% 60% at 50% 45%, rgba(255,255,255,.14), transparent 70%);
  background-size: 34cqw 34cqw, 34cqw 34cqw, 100% 100%;
  background-position: 0 0, .4cqw .4cqw, 0 0;
  box-shadow: inset 0 0 12cqw rgba(0,0,0,.28);
}

.env__flap {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.env__flap i {
  position: absolute;
  inset: 0;
  background-color: var(--env);
  background-image:
    url("../images/resources/emboss-light.svg"),
    url("../images/resources/emboss-dark.svg");
  background-size: 34cqw 34cqw;
  background-position: 17cqw 0, 17.4cqw .4cqw;
}
.env__flap--side { z-index: 2; filter: drop-shadow(0 .3cqw .8cqw rgba(0,0,0,.18)); }
.env__flap--side i { clip-path: polygon(0 0, 50% 50%, 100% 0, 100% 100%, 0 100%); }
.env__flap--bottom { z-index: 2; filter: drop-shadow(0 -.5cqw 1.2cqw rgba(0,0,0,.3)); }
.env__flap--bottom i {
  clip-path: polygon(0 100%, 0 99%, 50% 50%, 100% 99%, 100% 100%);
  background-image:
    linear-gradient(to top, rgba(255,255,255,.1), rgba(0,0,0,.06)),
    url("../images/resources/emboss-light.svg"),
    url("../images/resources/emboss-dark.svg");
  background-size: 100% 100%, 34cqw 34cqw, 34cqw 34cqw;
}
.env__flap--top {
  z-index: 3;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  filter: drop-shadow(0 .8cqw 1.4cqw rgba(0,0,0,.34));
}
.env__flap--top i {
  clip-path: polygon(0 0, 100% 0, 50% 50%);
  background-image:
    linear-gradient(to bottom, rgba(255,255,255,.12), rgba(0,0,0,.05)),
    url("../images/resources/emboss-light.svg"),
    url("../images/resources/emboss-dark.svg");
  background-size: 100% 100%, 34cqw 34cqw, 34cqw 34cqw;
}

.env__seal {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: 27cqw;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 47% 53% 51% 49% / 52% 47% 53% 48%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.45), transparent 42%),
    radial-gradient(circle at 70% 78%, rgba(0,0,0,.22), transparent 55%),
    var(--seal);
  box-shadow:
    0 1.2cqw 2.4cqw rgba(0,0,0,.35),
    inset 0 -.8cqw 1.4cqw rgba(0,0,0,.22),
    inset 0 .6cqw 1cqw rgba(255,255,255,.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.env__seal::before {
  content: "";
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  box-shadow:
    inset 0 .5cqw .9cqw rgba(0,0,0,.28),
    0 .3cqw 0 rgba(255,255,255,.3);
}
.env__seal span {
  position: relative;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 7.4cqw;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--seal-ink);
  text-shadow: 0 .25cqw .3cqw rgba(0,0,0,.35), 0 -.15cqw 0 rgba(255,255,255,.3);
  white-space: nowrap;
}

.env__tap {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 4.5%;
  text-align: center;
  font-family: 'Jost', sans-serif;
  font-size: max(9px, 2.3cqw);
  font-weight: 500;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--tap, color-mix(in srgb, var(--seal) 70%, #000));
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
}
.env__tap::before {
  content: "\2726";
  display: block;
  margin-bottom: .8em;
  letter-spacing: 0;
  animation: envPulse 2.2s ease-in-out infinite;
}
@keyframes envPulse { 0%, 100% { opacity: .4; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* Letter that slides out on open (intro only) */
.env__letter {
  position: absolute;
  z-index: 1;
  left: 9%;
  right: 9%;
  top: 8%;
  bottom: 30%;
  border-radius: 1.2cqw;
  background: linear-gradient(160deg, #fffdf8, #f4ecdd);
  box-shadow: 0 1cqw 3cqw rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6cqw;
  text-align: center;
  color: #3b2c1c;
  font-family: 'Cormorant Garamond', Georgia, serif;
}
.env__letter small { font-family: 'Jost', sans-serif; font-size: 2.2cqw; letter-spacing: .32em; text-transform: uppercase; opacity: .7; }
.env__letter strong { font-weight: 400; font-size: 9cqw; line-height: 1; }
.env__letter em { font-size: 4.5cqw; color: var(--seal); }

/* Opening sequence — toggled by adding .is-open */
.env.is-open .env__seal { animation: envSeal .7s cubic-bezier(.4,0,.2,1) forwards; }
.env.is-open .env__flap--top { animation: envFlap 1.1s cubic-bezier(.55,0,.25,1) .45s forwards; }
.env.is-open .env__letter { animation: envLetter 1.2s cubic-bezier(.2,.7,.2,1) 1.25s forwards; }
@keyframes envSeal {
  30% { transform: translate(-50%, -50%) scale(1.12); }
  100% { transform: translate(-50%, -50%) scale(.4) rotate(-25deg); opacity: 0; }
}
@keyframes envFlap {
  0% { transform: rotateX(0); z-index: 3; }
  49% { z-index: 3; }
  50% { z-index: 0; }
  100% { transform: rotateX(180deg); z-index: 0; }
}
@keyframes envLetter {
  0% { transform: translateY(0); }
  100% { transform: translateY(-34%) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .env__tap::before { animation: none; }
}
