:root {
  color-scheme: dark;
  --rose: #efb6bd;
  --ink: #3c2730;
  background: #25171e;
  color: #fff1e9;
  font-family: system-ui, sans-serif;
  scroll-behavior: smooth;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 18rem, #563041 0, transparent 38rem), #25171e;
}
main { padding: clamp(12px, 4vw, 48px); }
.cover {
  border: 1px solid #eab2bb50;
  border-radius: 2px;
  min-height: min(810px, calc(100svh - 8vw));
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: clamp(32px, 7vw, 100px) 12px;
}
.eyebrow { font-size: .875rem; letter-spacing: .24em; font-weight: 600; color: var(--rose); margin: 0; }
h1, h2, .signature { font-family: Georgia, serif; font-weight: 400; }
h1 {
  font-size: clamp(3.2rem, 11vw, 8rem);
  line-height: .96;
  letter-spacing: -.055em;
  margin: .25em 0 .36em;
}
h1 em { color: var(--rose); font-weight: 400; }
.open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 40px;
  padding: 10px 24px;
  color: #35202a;
  background: #f0c2c6;
  text-decoration: none;
  font-weight: 650;
}
.open:hover { background: #ffe0dc; }
.open:focus-visible { outline: 2px solid #fff1e9; outline-offset: 5px; }
.paper {
  color-scheme: light;
  color: var(--ink);
  background: #fff6ed;
  max-width: 780px;
  border: 1px solid #f3d9cf;
  margin: clamp(24px, 6vw, 84px) auto;
  padding: clamp(22px, 7vw, 78px);
  scroll-margin-top: 16px;
  box-shadow: 0 22px 65px #140b1155;
}
.letter-copy { max-width: 57ch; margin-inline: auto; }
.paper .eyebrow { color: #854658; }
h2 { font-size: clamp(2.4rem, 8vw, 5rem); line-height: 1.05; margin: .35em 0 .55em; letter-spacing: -.045em; }
.paper p:not(.eyebrow, .signature) { font-size: clamp(1.0625rem, 2.4vw, 1.2rem); line-height: 1.7; margin: 0 0 1.1em; }
.signature { font-style: italic; color: #854658; font-size: 1.75rem; margin: 32px 0 0; }
.signature span { font-size: .8em; }
.photo { margin: 32px 0; padding: 8px; border: 1px solid #dcbab9; }
.photo img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
@media (prefers-reduced-motion: reduce) { :root { scroll-behavior: auto; } }

body {
  background:
    radial-gradient(ellipse at 50% 25rem, #502438 0, transparent 38rem),
    radial-gradient(ellipse at 75% 4rem, #39243b 0, transparent 38rem),
    #1c131c;
}
main { max-width: 1540px; margin-inline: auto; }
.cover {
  border-color: #eab2bb40;
  min-height: max(42rem, calc(100svh - 8vw));
  position: relative;
  padding-block: 35px;
}
.cover::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid #eab2bb19;
}
h1 { font-size: clamp(3.2rem, 8vw, 6.5rem); }
.open { border: 0; font: inherit; font-weight: 650; cursor: pointer; }
.envelope {
  --width: clamp(174px, 30vw, 238px);
  width: var(--width);
  aspect-ratio: 1.55;
  position: relative;
  perspective: 700px;
  margin: clamp(100px, 13vw, 140px) 0 30px;
  background: linear-gradient(150deg, #854557, #4a2336);
  border-radius: 6px;
  box-shadow: 0 20px 36px #160912aa, inset 0 0 0 1px #e6acb850;
}
.pocket, .envelope i { position: absolute; inset: 0; pointer-events: none; }
.pocket {
  z-index: 2;
  overflow: hidden;
  border-radius: inherit;
  background:
    linear-gradient(36deg, #ad6d81 49.5%, transparent 50%) bottom left / 51% 100% no-repeat,
    linear-gradient(-36deg, #98596e 49.5%, transparent 50%) bottom right / 51% 100% no-repeat,
    linear-gradient(145deg, #a66378, #69394f);
  clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
}
.envelope i {
  z-index: 3;
  height: 65%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(#d18e9f, #a95f77);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
}
.envelope span {
  position: absolute;
  z-index: 4;
  top: 53%;
  left: 50%;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #ffe4dc;
  background: radial-gradient(circle at 34% 30%, #c76982, #8a344e 72%);
  box-shadow: inset 0 0 0 3px #fbb4bf38, 0 3px 8px #391524aa;
}
.envelope .photo {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 13%;
  width: 74%;
  margin: 0;
  padding: 6px 6px 15px;
  background: #fff3e8;
  box-shadow: 0 8px 24px #15091280;
  visibility: hidden;
}
.envelope .photo img { aspect-ratio: 1; }
.is-open .envelope i { animation: flip-flap 590ms cubic-bezier(.36,.03,.24,1) both; }
.is-open .envelope span { animation: lift-seal 300ms ease-in both; }
.is-open .envelope .photo { animation: extract-photo 1200ms 540ms cubic-bezier(.25,.68,.24,1) both; }

@keyframes flip-flap {
  0% { transform: rotateX(0); }
  52% { transform: rotateX(-90deg); }
  53% { z-index: 0; }
  100% { z-index: 0; transform: rotateX(-174deg); }
}
@keyframes lift-seal { to { opacity: 0; transform: translateY(10px) scale(.8); } }
@keyframes extract-photo {
  0% { visibility: visible; transform: translateY(8%); clip-path: inset(0 0 25% 0); }
  60% { transform: translateY(-76%); clip-path: inset(0); }
  100% { visibility: visible; transform: translateY(-69%) rotate(-7deg); }
}
@media (prefers-reduced-motion: reduce) {
  .is-open .envelope i { animation: none; transform: rotateX(-174deg); z-index: 0; }
  .is-open .envelope span { animation: none; opacity: 0; }
  .is-open .envelope .photo { animation: none; visibility: visible; transform: translateY(-69%) rotate(-7deg); }
}
.open[hidden] { display: none; }
.cover:has(.open[hidden]) { grid-template-rows: auto auto auto 48px; }
.photo-slot {
  width: min(58%, 210px);
  aspect-ratio: 1;
  margin: 0 0 1.5rem;
}
.photo-slot .photo, .flying-photo {
  background: #fff3e8;
  border: 1px solid #dcbab9;
  padding: 6px 6px 15px;
  margin: 0;
  box-shadow: 0 8px 24px #15091240;
}
.photo-slot .photo { width: 100%; height: 100%; }
.photo-slot img, .flying-photo img { width: 100%; height: 100%; object-fit: cover; }
.flying-photo {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  transform-origin: top left;
}

.signature { line-height: 1.25; }

@media (prefers-reduced-motion: no-preference) {
  .letter-copy p span { transition: opacity 150ms ease-out; }
  .letter-copy .pending-ink { opacity: 0; }
}
