@font-face {
  font-family: Jakarta;
  src: url("assets/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
* { box-sizing: border-box; }
:root {
  font-family: Jakarta, Arial, sans-serif;
  color: #261944;
  font-synthesis: none;
}
body { margin: 0; min-width: 280px; background: #241e3b; }
[hidden] { display: none !important; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
h1:focus, h2:focus, h3:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.scene {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  padding: 60px 5vw;
  overflow: hidden;
  animation: enter .45s cubic-bezier(.2,.72,.3,1) both;
}
@keyframes enter { from { opacity: 0; } }
main { position: relative; }
.stickers { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; transition: opacity .55s; }
.stickers span { position: absolute; font-size: clamp(1rem, 2.2vw, 1.65rem); line-height: 1; color: #9b81c2; }
.stickers span:nth-child(1) { left: 13%; top: 16%; transform: rotate(-12deg); }
.stickers span:nth-child(2) { left: 39%; top: 10%; color: #8197c5; }
.stickers span:nth-child(3) { right: 27%; top: 16%; color: #d197b0; transform: rotate(10deg); }
.stickers span:nth-child(4) { right: 10%; top: 28%; color: #c99b61; }
.stickers span:nth-child(5) { left: 6%; top: 42%; color: #789da6; }
.stickers span:nth-child(6) { right: 7%; top: 52%; color: #8197c5; }
.stickers span:nth-child(7) { left: 9%; bottom: 23%; transform: rotate(15deg); color: #d197b0; }
.stickers span:nth-child(8) { right: 12%; bottom: 21%; }
.stickers span:nth-child(9) { left: 26%; bottom: 9%; color: #c99b61; }
.stickers span:nth-child(10) { right: 32%; bottom: 11%; color: #789da6; }
.stickers { opacity: .8; }
.hero:not([data-state="idle"]) .stickers { opacity: 0; }
.hero {
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff0fb;
  background: #241e3b;
  transition: background-color 1.15s;
}
.hero:not([data-state="idle"]) { background: #141027; }
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 22px 3vw;
  border: 1px solid #c6b6e35a;
  border-radius: 28px;
  pointer-events: none;
  transition: opacity .7s;
}
.hero:not([data-state="idle"])::after { opacity: 0; }
#sky { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .38; transition: opacity .9s; }
.hero:not([data-state="idle"]) #sky { opacity: 1; }
.album h2, .letter h2 {
  font-size: clamp(4rem, 10.2vw, 9rem);
  font-weight: 800;
  letter-spacing: -.091em;
  line-height: .91;
  text-wrap: balance;
}
h2 em { font-family: Georgia, serif; letter-spacing: -.08em; font-weight: 400; }
.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .62em;
  border-radius: 99px;
  border: 1px solid transparent;
  padding: .85em 1.35em;
  min-height: 48px;
  font-weight: 800;
  transition: transform .22s, box-shadow .22s;
}
.action:hover { transform: translateY(-3px); }
.action:active { transform: translateY(1px); }
.action span { font-size: 1.18em; line-height: 1; }
.action-light { background: #ffdded; color: #3a2453; box-shadow: 0 6px 0 #af78a0, 0 11px 35px #200c41a8; }
.ready {
  min-width: 162px;
  min-height: 66px;
  padding: .5rem 1.8rem;
  font-size: clamp(1.55rem, 3vw, 2rem);
  letter-spacing: -.055em;
  background: #e3d5ff;
  box-shadow: 0 6px 0 #8373ac, 0 12px 24px #110c2562;
}
.reduced-clock { position: absolute; top: 23%; color: #ffe8f3; font-size: clamp(2.4rem, 10vw, 6rem); font-weight: 800; letter-spacing: -.06em; }
.show-end { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1.25rem; padding: 24px 6%; text-align: center; animation: rise .58s both; }
.show-end h2 { font-size: clamp(2.25rem, 8vw, 6rem); letter-spacing: -.085em; line-height: 1.05; text-shadow: 0 6px 26px #1b1030, 0 0 28px #f7ace880; }
.show-end .action { min-width: 8rem; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.album {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(.95rem, 2.8vh, 1.65rem);
  padding-inline: 0;
  background: #f2f5ff;
  text-align: center;
}
.letter::before { content: ""; position: absolute; inset: 23px 3vw; z-index: -1; pointer-events: none; border: 1px solid #593b782e; border-radius: 30px; }
.album-copy { padding-inline: 5vw; }
.album h2 { font-size: clamp(2.7rem, 7vw, 6rem); }
.album h2 em { margin-inline-start: .09em; color: #765095; }
.gallery-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  column-gap: clamp(1.4rem, 6vw, 6rem);
  row-gap: clamp(3.5rem, 10vw, 7rem);
  width: min(100%, 58rem);
  padding: 2.8rem clamp(2.2rem, 8vw, 7.2rem) 2.2rem;
  text-align: left;
}
.clothesline { position: absolute; inset: 0 0 auto; width: 100%; pointer-events: none; }
.hanging-photo {
  --tilt: -3deg;
  position: relative;
  min-width: 0;
  margin: 0;
}
.hanging-photo:nth-of-type(2n) { --tilt: 2.4deg; }
.hanging-photo:nth-of-type(3) { --tilt: 2deg; }
.hanging-photo:nth-of-type(4) { --tilt: -2.5deg; }
.photo-print {
  position: relative;
  justify-self: center;
  width: min(100%, 20rem);
  padding: .65rem .65rem .9rem;
  background: #fffdf8;
  border: 1px solid #e4dbe4;
  border-radius: .23rem;
  box-shadow: 0 9px 17px #35234424, 0 2px 2px #3f2c4d10;
  transform: rotate(var(--tilt));
  transform-origin: 50% -10px;
  cursor: pointer;
  user-select: none;
}
.photo-print img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; }
.photo-peg {
  position: absolute;
  z-index: 1;
  inset: -1.22rem auto auto 50%;
  width: .75rem;
  height: 2.2rem;
  border: 1px solid #a97852;
  border-radius: .16rem .16rem .23rem .23rem;
  background:
    repeating-linear-gradient(89deg, #98613c30 0 1px, transparent 1px 3px),
    linear-gradient(90deg, #a8734f, #edc59a 42%, #d49c70 78%, #a8734f);
  box-shadow: 1px 2px 3px #64402777, inset 1px 0 #ffe1b78c;
  transform: translateX(-50%);
}
.photo-peg::after { content: ""; position: absolute; inset: .75rem -1px auto; height: 3px; border-block: 1px solid #675c56; background: #c1b7aa; border-radius: 2px; }
.photo-letter {
  padding: .75rem .25rem 0;
  color: #47324e;
  text-align: center;
  font: italic clamp(.94rem, 2.3vw, 1.12rem)/1.35 Georgia, serif;
}
.scroll-cue {
  position: fixed;
  z-index: 3;
  right: max(1.15rem, env(safe-area-inset-right));
  bottom: max(1.35rem, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  width: 3.4rem;
  pointer-events: none;
}
.scroll-cue i {
  display: block;
  position: relative;
  width: 3px;
  height: 1.35rem;
  margin-bottom: .18rem;
  border-radius: 3px;
  background: #c298f1;
  filter: drop-shadow(0 1px 1px #28193f);
  animation: scroll-nudge 1.45s ease-in-out infinite;
}
.scroll-cue i::after {
  content: "";
  position: absolute;
  right: -4.5px;
  bottom: -.12rem;
  width: .56rem;
  height: .56rem;
  border: solid #c298f1;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
@keyframes scroll-nudge { 0%, 100% { transform: translateY(0); } 55% { transform: translateY(7px) rotate(-5deg); } }

.letter {
  display: grid;
  place-items: center;
  color: #4b274e;
  background: #fff2f6;
}
.letter-layout { width: min(100%, 37rem); display: grid; justify-items: center; text-align: center; }
.mail { position: relative; width: min(87%, 412px); aspect-ratio: 1.64; perspective: 850px; }
.envelope { position: absolute; inset: 0; isolation: isolate; transition: transform .3s cubic-bezier(.22,.76,.3,1); }
.mail[data-state="sealed"]:is(:hover, :focus-within) .envelope { transform: rotate(-2.5deg) translateY(-5px); }
.envelope > span { position: absolute; }
.envelope-back { inset: 0; z-index: 1; background: #d490ac; border-radius: 11px; box-shadow: 0 15px 30px #813e6d31, 0 2px 4px #813e6d20; }
.envelope-peek { inset: 8% 7% 6%; z-index: 2; border: 1px solid #f0d4d6; border-radius: 6px; background: #fffaf3; box-shadow: 0 3px 8px #aa5c7926; }
.envelope-pocket {
  inset: 0;
  z-index: 3;
  border-radius: 11px;
  background: #f2afca;
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
}
.envelope-pocket::after { content: ""; position: absolute; inset: 0; background: #f9c1d6; clip-path: polygon(0 100%, 50% 46%, 100% 100%); }
.envelope-flap {
  inset: 0 0 12%;
  z-index: 4;
  border-radius: 11px;
  background: #fbd1e1;
  clip-path: polygon(0 0, 100% 0, 53% 63%, 50% 65%, 47% 63%);
  transform-origin: center top;
}
.envelope-seal {
  inset: 52% auto auto 50%;
  z-index: 5;
  transform: translate(-50%, -50%) rotate(-9deg);
  display: grid;
  place-items: center;
  width: 16%;
  aspect-ratio: 1;
  border-radius: 45% 52% 46% 49%;
  background: #af5f8b;
  box-shadow: inset 0 0 0 3px #dc8bb5, 0 3px 5px #833f6d3d;
  color: #ffe3ea;
  font: italic clamp(1.25rem, 4vw, 2rem) Georgia, serif;
}
.envelope-address {
  right: 8%;
  bottom: 13%;
  z-index: 5;
  color: #6f3657;
  font: italic clamp(1.04rem, 3vw, 1.35rem) Georgia, serif;
}
.envelope-hit { position: absolute; z-index: 6; inset: 0; width: 100%; border: 0; border-radius: 11px; background: transparent; }
.envelope-hit:disabled { pointer-events: none; }
.mail[data-state="opening"] .envelope-flap { animation: unseal .47s ease-in-out both, envelope-away .31s .63s ease both; }
.mail[data-state="opening"] .envelope-seal { animation: envelope-away .22s both; }
.mail[data-state="opening"] :is(.envelope-back, .envelope-pocket, .envelope-address) { animation: envelope-away .36s .60s cubic-bezier(.36,.2,.36,1) both; }
.mail[data-state="opening"] .envelope-peek { animation: lift .62s .34s cubic-bezier(.23,.76,.34,1) both; }
@keyframes unseal {
  0% { transform: rotateX(0); z-index: 4; }
  48% { z-index: 4; }
  49% { z-index: 0; }
  100% { transform: rotateX(180deg); z-index: 0; background: #e5a1bd; }
}
@keyframes envelope-away { to { opacity: 0; } }
@keyframes lift { to { transform: translateY(-58%) rotate(-2deg); } }
.paper {
  width: 100%;
  padding: clamp(1.35rem, 5vw, 3.2rem);
  text-align: left;
  background: #fffaf3;
  border: 1px solid #e5bfd1;
  border-radius: 8px 8px 26px 8px;
  box-shadow: 0 13px 40px #6b366923;
}
.paper-top { display: flex; justify-content: flex-end; color: #865171; font-weight: 700; font-size: .88rem; }
.paper h3 { font-size: clamp(1.55rem, 5vw, 2.55rem); line-height: 1.14; letter-spacing: -.05em; margin: .8em 0 .6em; }
.paper p { line-height: 1.65; }
.paper p + p { margin-top: .7em; }
.signature { margin-top: 1.1rem; font: italic 1.25rem Georgia, serif; }
.letter-line { display: grid; white-space: pre-line; }
.letter-measure, .letter-ink { grid-area: 1 / 1; }
.letter-measure { visibility: hidden; }
.letter-ink.typing::after { content: ""; display: inline-block; width: 1.5px; height: 1em; margin-left: 2px; vertical-align: -.12em; background: #985b80; animation: blink .85s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 680px) {
  .scene { padding: 48px 7vw; }
  .letter::before { inset: 16px 3.2vw; border-radius: 22px; }
  .hero { padding: 0; }
  .hero::after { inset: 13px 3.2vw; border-radius: 22px; }
  .stickers span:nth-child(2), .stickers span:nth-child(3), .stickers span:nth-child(9), .stickers span:nth-child(10) { display: none; }
  .album { padding-inline: 0; }
  .album h2 { font-size: clamp(2.55rem, 10vw, 4.4rem); }
  .gallery-grid {
    grid-template-columns: minmax(0, 1fr);
    width: min(100%, 29rem);
    padding: 2.65rem 3.15rem 1rem;
    row-gap: 4rem;
  }
  .scroll-cue { right: .45rem; width: 2.85rem; }

}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
