:root {
  color-scheme: dark;
  background: #120d24;
  color: #fff4eb;
  font: 16px/1.55 system-ui, sans-serif;
  --pink: #ffc2d6;
  --muted: #e3cdda;
}
* { box-sizing: border-box; }
body, h1, h2, p, figure { margin: 0; }
h1, h2 { font: normal clamp(2.3rem, 7vw, 4.8rem)/1.05 Georgia, serif; letter-spacing: -.045em; }
.stage { position: relative; padding: clamp(1.25rem, 5vw, 4.5rem); }
.intro {
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(1.35rem, 4svh, 3rem);
  text-align: center;
  isolation: isolate;
  overflow: clip;
  background: radial-gradient(ellipse at 50% 24%, #5a3158, #1c102d 65%, #120d24);
}
.sky { position: fixed; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.sky span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  color: #ffc2d6;
  font: var(--size)/1 Georgia, serif;
  opacity: .34;
  text-shadow: 0 0 .65rem #ff9ccb66;
}
.intro-copy { width: min(100%, 38rem); }
.envelope {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(6.2rem, 18vw, 9rem);
  aspect-ratio: 1.52;
  margin: 0 auto 1.8rem;
  border: 1px solid #ffe2e3;
  border-radius: .5rem;
  background: linear-gradient(32deg, #eb9bb9 49%, transparent 50%) left bottom / 50% 82% no-repeat,
              linear-gradient(-32deg, #eb9bb9 49%, transparent 50%) right bottom / 50% 82% no-repeat,
              #f7bdd2;
  box-shadow: 0 0 3rem #f0a0c557, 0 1rem 2.5rem #10091c91;
}
.envelope::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #ffdae5;
  clip-path: polygon(0 0, 100% 0, 50% 67%);
}
.envelope span {
  position: relative;
  margin-top: 14%;
  display: grid;
  place-items: center;
  width: 1.8rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #8d3659;
  color: #fff0f2;
  font: bold 1.05rem/1 Georgia, serif;
}
.intro h1 { font-size: clamp(3.5rem, 10vw, 7.5rem); }
.intro p { margin: .95rem auto 0; color: var(--muted); max-width: 23rem; font-size: clamp(1.05rem, 2.5vw, 1.25rem); }
.surprise-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: .65rem;
  margin-top: 1.65rem;
  padding: .65rem 1.2rem;
  border-radius: 100px;
  background: #ffd4df;
  box-shadow: 0 0 26px #e884af50;
  color: #351b30;
  font-weight: 650;
  text-decoration: none;
}
.surprise-link:is(:hover, :focus-visible) { background: #ffe4eb; }
.surprise-link:focus-visible { outline: 2px solid #ffe0a5; outline-offset: 5px; }
.memories { background: radial-gradient(ellipse at 20% 18%, #322242, transparent 65%), #120d24; }
.stage-head { width: min(100%, 63rem); margin: 0 auto clamp(2rem, 7vw, 5rem); }
.scenes {
  width: min(100%, 63rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(.7rem, 3vw, 1.75rem);
  align-items: stretch;
  margin-inline: auto;
}
.scene { min-width: 0; }
.photo { position: relative; display: grid; justify-items: center; }
.photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 66svh;
  object-fit: contain;
  border-radius: .6rem;
  box-shadow: 0 12px 45px #09051675;
}
figcaption { margin-top: .8rem; color: var(--muted); font-size: 1.07rem; }
.mirror-note {
  position: absolute; bottom: .8rem; right: 6%; color: #4b233d;
  background: #ffe2e8; padding: .4rem .65rem; rotate: -7deg; border-radius: .25rem;
}
.film, .special, .letter { text-align: center; padding-block: clamp(3.5rem, 10vw, 9rem); }
.film { background: #1b122e; }
.film h2 { margin-bottom: 1.25rem; }
video { display: block; width: auto; max-width: 100%; max-height: 69svh; margin: 0 auto .8rem; border-radius: .85rem; background: #0f091c; }
.special { background: radial-gradient(ellipse at 50% 30%, #594068, transparent 72%), #1b132c; }
.prayer-card figcaption h2 { color: #fff4eb; font-size: clamp(2rem, 5vw, 3.5rem); margin: 1.4rem 0 .8rem; }
.prayer-card figcaption p { max-width: 31rem; margin: auto; }
.favorite-card figcaption p { margin-top: .5rem; }
.signature { color: var(--pink); font-weight: bold; }
.letter { background: radial-gradient(ellipse at 50% 0%, #54354f, transparent 72%), #120d24; }
.letter article { max-width: 38rem; margin: auto; }
.letter h2 { margin-bottom: 1.45rem; }
.letter p { margin: .9rem 0; font-size: clamp(1rem, 2.4vw, 1.2rem); }
.letter .last-line { font: normal clamp(2.2rem, 7vw, 4rem)/1.04 Georgia, serif; margin: 1.7rem 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .sky span { animation: heart-drift var(--duration) var(--delay) ease-in-out infinite alternate; }
  html { scroll-behavior: smooth; }
  .envelope { animation: envelope-arrive .85s ease-out both; }
  .in-view { animation: lift .7s ease-out both; }
  .in-view .mirror-note { animation: lift .5s .35s ease-out both; }

  @keyframes lift { from { opacity: .15; transform: translateY(1.05rem); } to { opacity: 1; transform: translateY(0); } }
  @keyframes envelope-arrive {
    from { opacity: .4; transform: translateY(1.25rem) rotate(-9deg) scale(.86); }
    to { opacity: 1; transform: rotate(-4deg); }
  }
  @keyframes heart-drift {
    from { transform: translate(-.4rem, 1.25rem) rotate(-13deg); opacity: .2; }
    to { transform: translate(.8rem, -2rem) rotate(14deg); opacity: .42; }
  }
}


.surprise-link { border: 0; font: inherit; font-weight: 650; cursor: pointer; }
.stage-head p { margin-top: .7rem; color: var(--muted); }
#memories-title:focus { outline: none; }
.sealed-memory { text-align: center; }
.memory-seal {
  display: grid;
  justify-items: center;
  gap: .8rem;
  margin: 0 auto;
  padding: .8rem 1.2rem;
  border: 0;
  border-radius: .65rem;
  background: transparent;
  color: var(--pink);
  font: inherit;
  cursor: pointer;
}
.memory-seal .envelope { margin: 0; }
.memory-seal:focus-visible { outline: 2px solid #ffe0a5; outline-offset: 4px; }
.memory-seal:hover .seal-label { text-decoration: underline; text-underline-offset: .18em; }
.memory-seal[aria-expanded="true"] .envelope { display: none; }
.memory-seal[aria-expanded="true"] { padding-block: .25rem .65rem; font-size: .9rem; }
@media (prefers-reduced-motion: no-preference) {
  .memory-seal .envelope { animation: none; }
  .sealed-memory.in-view .envelope { animation: envelope-arrive .8s ease-out both; }
  .sealed-memory figure:not([hidden]) { animation: lift .65s ease-out both; }
}

@media (max-width: 600px) {
  .stage {
    padding-left: max(1.15rem, env(safe-area-inset-left));
    padding-right: max(1.15rem, env(safe-area-inset-right));
  }
  .intro {
    min-height: 100vh;
    min-height: 100svh;
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
  .intro h1 { font-size: clamp(2.9rem, 12vw, 4.1rem); }
  .intro p { max-width: 18rem; }
  .memory-seal { min-width: 7.5rem; min-height: 44px; }
  .letter { padding-bottom: max(3.5rem, calc(env(safe-area-inset-bottom) + 1.5rem)); }
}

.stack-slides { touch-action: pan-y pinch-zoom; }
.stack-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .9rem;
  margin-top: .9rem;
}
.stack-controls button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #ffc2d68c;
  border-radius: 50%;
  background: #2d1e3e;
  color: #ffe0ea;
  font: 1.65rem/1 Georgia, serif;
  cursor: pointer;
}
.stack-controls button:focus-visible { outline: 2px solid #ffe0a5; outline-offset: 4px; }
.stack-count { min-width: 3rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.first-envelope.is-opening .memory-seal[aria-expanded="true"] .envelope {
  display: grid;
  margin-top: .8rem;
  perspective: 400px;
}
.first-envelope .envelope::before { transform-origin: center top; }
.first-envelope.is-opening .memory-seal[aria-expanded="true"] .envelope::before { transform: rotateX(165deg); }
.first-envelope.is-opening .memory-seal[aria-expanded="true"] .envelope > span { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .first-envelope .envelope::before { transition: transform .48s ease-in-out; }
  .first-envelope .envelope > span { transition: opacity .19s ease; }
  .first-envelope.is-opening .photo-stack:not([hidden]) { animation: slide-from-envelope .7s .32s ease-out both; }
  @keyframes slide-from-envelope {
    from { opacity: 0; transform: translateY(-2.6rem) scale(.88); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}

.intro-copy .envelope { perspective: 450px; }
.intro-copy .envelope::before { transform-origin: center top; }
.intro.is-opening .envelope::before { transform: rotateX(166deg); }
.intro.is-opening .envelope > span { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .intro.is-opening .envelope { animation: opening-envelope .86s cubic-bezier(.2, .7, .25, 1) both; }
  .intro-copy .envelope::before { transition: transform .49s .17s ease-in-out; }
  .intro-copy .envelope > span { transition: opacity .2s ease; }
  @keyframes opening-envelope {
    0% { transform: rotate(-4deg) scale(1); }
    60%, 100% { transform: translateY(-.36rem) scale(1.55); }
  }
}

.scenes .sealed-memory {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid #ffc2d647;
  border-radius: 1rem;
  background: linear-gradient(150deg, #362443, #231733);
  box-shadow: 0 .55rem 1.5rem #0f091752;
}
.scenes .memory-seal {
  width: 100%;
  min-width: 0;
  flex: 1;
  align-content: center;
  min-height: 9.25rem;
  padding: 1rem .55rem;
  overflow-wrap: anywhere;
}
.scenes .memory-seal .envelope { width: clamp(4rem, 13vw, 7.5rem); }
.scenes .memory-seal[aria-expanded="true"] {
  flex: 0;
  min-height: 44px;
  padding: .65rem;
}
.scenes .sealed-memory:has(> :is(.photo-stack, figure):not([hidden])) { grid-column: 1 / -1; }
.scenes :is(.photo-stack, .sealed-memory > figure) { width: min(100%, 34rem); margin-inline: auto; padding: 0 .75rem 1rem; }

.sky { opacity: .68; }
body:has(.surprise-link[aria-expanded="true"]) .sky {
  -webkit-mask-image: linear-gradient(90deg, #000, #0003 27%, #0003 73%, #000);
  mask-image: linear-gradient(90deg, #000, #0003 27%, #0003 73%, #000);
}
.intro-copy, .stage-head, .scenes, .film > *, .letter article {
  position: relative;
  z-index: 3;
}
.scenes .sealed-memory {
  border-color: #e8a9ce72;
  background: linear-gradient(150deg, #412b51, #261a36);
}

.favorite-card .wax-seal {
  width: auto;
  aspect-ratio: auto;
  min-height: 1.45rem;
  padding: .22rem .35rem;
  border: 1px solid #edb2c8;
  border-radius: 45% 48% 46% 50%;
  background: radial-gradient(ellipse at 36% 32%, #a7496b, #6e274a 85%);
  box-shadow: inset 0 0 0 2px #6e274a55, 0 2px 4px #4c153b63;
  font: 700 .62rem/1 system-ui, sans-serif;
  transform: rotate(-6deg);
}
@media (prefers-reduced-motion: no-preference) {
  .favorite-card:has(> figure:not([hidden])) { animation: favorite-glow 1.1s ease-out; }
  @keyframes favorite-glow {
    30% { box-shadow: 0 0 2.1rem #edacd875, inset 0 0 1.5rem #ec90be42; }
  }
}

.stack-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .42rem;
  min-height: .65rem;
  margin-top: .65rem;
}
.stack-dots span {
  width: .34rem;
  height: .34rem;
  border-radius: 100px;
  background: #e9bad16b;
}
.stack-dots .is-current {
  width: .8rem;
  background: #ffd4e6;
}
.letter article {
  padding: clamp(1.25rem, 5vw, 3rem);
  border: 1px solid #e6bfd1;
  border-radius: .45rem;
  color: #40273b;
  background: linear-gradient(135deg, transparent 49%, #e5bdd0 50% 100%) top right / 1.35rem 1.35rem no-repeat,
              linear-gradient(165deg, #fff5ed, #f6e0e9);
  box-shadow: 0 1rem 2.25rem #0d091ab8;
  transform-origin: center top;
}
.letter .signature { color: #873b65; }
.letter .last-line { color: #753955; }
@media (prefers-reduced-motion: no-preference) {
  .stack-dots span { transition: width .24s ease, background-color .24s ease; }
  .letter article.in-view { animation: letter-unfold .7s ease-out both; }
  @keyframes letter-unfold {
    from { transform: perspective(750px) rotateX(-19deg) translateY(1rem); opacity: .55; }
    to { transform: none; opacity: 1; }
  }
}

.mirror-photo {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
}
.mirror-photo img { width: auto; max-width: 100%; }
.mirror-spot {
  position: absolute;
  left: 58%;
  top: 56%;
  transform: translate(-50%, -50%) rotate(-9deg);
  width: clamp(44px, 29%, 7rem);
  aspect-ratio: 1.1;
  border: 2px dashed #ffdfebbd;
  border-radius: 48% 53% 47% 54%;
  background: transparent;
  box-shadow: 0 0 .65rem #29152e8c;
  cursor: pointer;
}
.mirror-spot:focus-visible { outline: 2px solid #ffe0a5; outline-offset: 4px; }
.mirror-photo.found .mirror-spot { border-style: solid; border-color: #ffd2e7; }
.sky.quiet { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .sky { transition: opacity .8s ease; }
  .mirror-photo.found .mirror-spot { animation: circle-appear .4s ease-out both; }
  @keyframes circle-appear {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0); }
  }
}
