/* Photographic envelope layers share one coordinate system for a continuous fold. */
.pearl-cover {
  --cover-ease: cubic-bezier(.25,.65,.25,1);
  --open-cover: url("assets/envelope-pearl-body-v2.webp");
  display: grid;
  padding: 0;
  overflow: hidden;
  background: #270c0c;
  transition: opacity .85s ease-in-out, visibility .85s;
}
.pearl-cover .intro-sheet {
  position: relative;
  display: block;
  width: min(100%,520px);
  height: 100%;
  min-height: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  overflow: visible;
  box-shadow: 0 0 90px #14040560;
}
.pearl-cover .intro-sheet::before,
.pearl-cover .intro-sheet::after { display: none; }
.pearl-cover .envelope-button {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  z-index: 1;
  border-radius: 0;
  outline: none;
}
.pearl-cover .envelope-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  filter: none;
  transform: none;
  opacity: 1;
  perspective: 1700px;
  perspective-origin: 50% 0;
  transition: none;
}
.cover-pocket,.cover-fold-bottom,.cover-lid,.cover-flap,.cover-seal,.cover-front-fold {
  position: absolute;
  display: block;
  inset: 0;
  width: 100%;
  height: 100%;
}
.cover-pocket {
  background: transparent;
}
.cover-fold-bottom,.cover-flap,.cover-seal {
  background-image: var(--open-cover);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  filter: brightness(.77) saturate(.83);
}
.cover-fold-bottom {
  z-index: 2;
  background-image: url("assets/envelope-pearl-body-v2.webp");
  /* The pocket starts at the real dark folds, below the pearl decoration. */
  clip-path: polygon(0 32.6%,43% 50.6%,57.5% 50.6%,100% 33%,100% 100%,0 100%);
}
.cover-lid {
  /* The seal bridges the lid and the front pocket, so both stay above the fold. */
  z-index: 5;
  transform-origin: 50% 0;
  transform: none;
  filter: none;
  transition: transform 1.6s cubic-bezier(.32,.02,.2,1),filter 1.6s ease;
}
.pearl-cover.opening .cover-lid { will-change: transform; }
.cover-flap {
  z-index: 3;
  /* Include the entire burgundy panel down to both photographed fold seams. */
  clip-path: polygon(0 0,100% 0,100% 33.1%,50% 54.1%,0 32.7%);
}
.cover-flap::after {
  content: "";
  position: absolute;
  inset: 0;
  /* Continue the paper below the part previously hidden by the front pocket. */
  clip-path: polygon(38% 49%,62% 49%,50% 54.1%);
  background: var(--open-cover) center top / 100% 300% no-repeat;
  -webkit-mask-image: linear-gradient(transparent 48.8%,#000 50.4%);
  mask-image: linear-gradient(transparent 48.8%,#000 50.4%);
}
.cover-front-fold {
  z-index: 4;
  pointer-events: none;
  clip-path: polygon(0 67.8%,39% 50.7%,43% 50.4%,57.5% 50.4%,62% 50.9%,100% 67.8%,100% 100%,0 100%);
  background: url("assets/envelope-pearl-body-v2.webp") center / 100% 100% no-repeat;
  filter: brightness(.77) saturate(.83);
}
.cover-pearls {
  position: absolute;
  display: block;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.cover-seal {
  z-index: 5;
  inset: 39.3% auto auto 25%;
  width: 50%;
  height: 22.6%;
  background-image: url("assets/envelope-wax-seal-v2.webp");
  background-size: contain;
  background-position: center;
  filter: saturate(.55) drop-shadow(1px 6px 4px #25070560);
}
.pearl-cover .envelope-button:focus-visible::after {
  content: "";
  position: absolute;
  left: 28%;
  top: 39.5%;
  width: 44%;
  height: 22%;
  border: 2px solid #fff0d8;
  border-radius: 50%;
  z-index: 6;
}
.pearl-cover .envelope-tap-cue {
  top: 44%;
  left: 69%;
  right: auto;
  bottom: auto;
  width: 29px;
  height: 29px;
  border: 0;
  color: #f4e9d7;
  background: transparent;
  box-shadow: none;
}
.pearl-cover .envelope-tap-cue svg { width: 23px; height: 23px; }
.pearl-cover .tap-hand { fill: #501a17; stroke: #f4e9d7; stroke-width: 1.7; }
.pearl-cover .envelope-tap-cue::after { border-color: #e8d6b9; }
.pearl-cover .open-instruction {
  position: absolute;
  top: 49%;
  left: 0;
  right: 0;
  margin: 0;
  color: #efdec6;
  font-size: 14px;
  font-weight: 400;
  pointer-events: none;
  text-shadow: 0 1px 2px #240807;
}
.pearl-cover .open-instruction strong { font-weight: 500; }
.pearl-cover .intro-heading {
  position: absolute;
  top: 75%;
  left: 16px;
  right: 16px;
  pointer-events: none;
}
.pearl-cover .intro-heading h2 {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 12px;
  color: #f1e2ca;
  font-size: clamp(31px,8.3vw,42px);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -.8px;
  text-shadow: 0 2px 1px #27091155;
}
.pearl-cover .intro-heading h2 em { color: #dac09a; font-size: .58em; }
.pearl-cover .intro-subtitle { display: none; }
.pearl-cover .intro-foot {
  position: absolute;
  top: 82.5%;
  left: 0;
  right: 0;
  margin: 0;
  z-index: 5;
  pointer-events: none;
}
.pearl-cover .intro-foot p { color: #e6d1b4; font-family: var(--sans); font-size: 12px; letter-spacing: .03em; }
.pearl-cover .intro-foot > span { display: none; }
.pearl-cover .intro-photo-link {
  position: absolute;
  bottom: max(4%,env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  min-height: 44px;
  min-width: 160px;
  padding: 10px 25px;
  border: 1px solid #d6bd9645;
  border-radius: 2px;
  color: #e8d6bc;
  background: #26090620;
  font-size: 14px;
}
.pearl-cover .intro-photo-link:hover { background: #f2e8d610; border-color: #d6bd96; }
.pearl-cover .intro-photo-link:focus-visible { outline-color: #f4e9d7; }
.pearl-cover.flap-open .cover-lid {
  transform: rotateX(62deg);
  filter: drop-shadow(0 20px 12px #14030270);
}
.pearl-cover.opening { background: transparent; }
.pearl-cover.releasing { pointer-events: none; background: transparent; }
.pearl-cover.releasing .envelope-art { transform: none; opacity: 1; }
.pearl-cover.opening .intro-sheet { box-shadow: 0 0 90px #14040560; }
/* The unveiling blur sits on the page's children, never on the page itself:
   a filter on this wrapper would make the fixed header scroll with the page. */
.invitation-page { transition: opacity .28s ease-out; }
.invitation-page > * { transition: filter .85s ease-out; }
body.unsealing .invitation-page { opacity: 1; }
body.unsealing .invitation-page > * { filter: blur(4px); }
body.unsealing.unveiling .invitation-page > * { filter: blur(0); }
@media(min-width:761px) {
  .pearl-cover { padding: 16px; }
  .pearl-cover .intro-sheet { width: min(520px,calc((100vh - 32px)*.52)); }
}
@media(max-height:600px) {
  .pearl-cover .intro-heading { top: 69%; }
  .pearl-cover .intro-heading h2 { font-size: 28px; }
  .pearl-cover .intro-foot { top: 80%; }
  .pearl-cover .intro-photo-link { bottom: max(1%,env(safe-area-inset-bottom)); min-height: 40px; font-size: 12px; }
  .pearl-cover .open-instruction { font-size: 12px; }
}
@media(max-height:500px) and (orientation:landscape) {
  .pearl-cover .intro-sheet { width: min(100%,300px); }
  .pearl-cover .intro-heading { top: 63%; }
  .pearl-cover .intro-heading h2 { font-size: 25px; }
  .pearl-cover .intro-foot { top: 76%; }
  .pearl-cover .intro-photo-link { bottom: 0; min-height: 35px; }
  .pearl-cover .open-instruction { top: 50%; }
}
@media(prefers-reduced-motion:reduce) {
  .pearl-cover *, .pearl-cover *::after { animation: none !important; }
}
