@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; }
body[data-scene="album"] { background: #f2f5ff; }
body[data-scene="letter"] { background: #fff2f6; }
[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; }

.site-header {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  min-height: 82px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px max(5vw, env(safe-area-inset-right)) 14px max(5vw, env(safe-area-inset-left));
}
.wordmark { display: flex; align-items: center; gap: .5em; font-size: .92rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.wordmark span { color: #8453a1; font-size: 1.35em; }
.site-header nav { display: flex; padding: 4px; border-radius: 99px; border: 1px solid #4f326326; background: #ffffff38; }
.site-header nav button { border: 0; background: transparent; border-radius: 99px; padding: .51em .86em; font-size: .875rem; font-weight: 750; }
.site-header nav button[aria-current] { background: #fff9f8; box-shadow: 0 1px 4px #2517461a; }
body[data-scene="fireworks"] .site-header { color: #fff3ff; }
body[data-scene="fireworks"] .wordmark span { color: #ffcc9f; }
body[data-scene="fireworks"] .site-header nav { border-color: #f7dfff46; background: #1b133c8c; }
body[data-scene="fireworks"] .site-header nav button[aria-current] { color: #2c1949; background: #fadcf6; }
.site-header nav button:hover:not([aria-current]) { text-decoration: underline; text-underline-offset: .2em; }

.scene {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  padding: 104px 5vw 58px;
  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; }
body[data-scene="fireworks"] .stickers { opacity: .8; }
body[data-scene="fireworks"]:has(.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; }
.action-dark { background: #3d2a5c; color: #fff4fb; box-shadow: 0 5px 0 #b09abf; }
.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-year { position: absolute; top: 43%; color: #ffe8f3; font-size: clamp(2.4rem, 10vw, 6rem); font-weight: 800; letter-spacing: -.06em; }
.skip { position: absolute; bottom: max(52px, 8svh); left: 50%; transform: translateX(-50%); background: #1e153bdf; color: #fff3ff; border: 1px solid #f9d8f55e; border-radius: 99px; padding: .65em 1.1em; white-space: nowrap; font-weight: 700; }
.show-end { position: absolute; inset: auto 6% max(64px, 13svh); 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 { margin-top: 1rem; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.album {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  grid-template-rows: 1fr auto 1fr;
  align-items: center;
  column-gap: clamp(25px, 6vw, 95px);
  padding-inline: max(8vw, calc((100% - 69rem) / 2));
  background: #f2f5ff;
}
.album::before, .letter::before { content: ""; position: absolute; inset: 82px 3vw 25px; z-index: -1; pointer-events: none; border: 1px solid #593b782e; border-radius: 30px; }
.album-copy { grid-area: 2 / 1; }
.album h2 { font-size: clamp(3.25rem, 7.9vw, 7rem); }
.album h2 em { color: #765095; }
.album-copy p, .letter-intro p { margin-top: 1rem; font-size: 1.04rem; }
.scene-spark { display: inline-block; color: #9268b3; font-size: 2.4rem; line-height: 1; margin-bottom: .7rem; }
.album-next { grid-area: 3 / 1; align-self: start; justify-self: start; margin-top: 1.5rem; }
.album-stage { grid-area: 1 / 2 / 4; width: min(100%, 395px); justify-self: center; animation: rise .5s both; }
.photo-stack { position: relative; isolation: isolate; margin: 0 7%; aspect-ratio: .87; user-select: none; }
.photo-card {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: .65rem;
  padding: 4.5% 4.5% 5.5%;
  background: #fffaf6;
  border: 1px solid #f3e9f1;
  border-radius: 5px;
  box-shadow: 0 8px 27px #3b205538;
}
.photo-image { display: block; border-radius: 2px; background-color: #6b467f; background-repeat: no-repeat; }
.photo-card { pointer-events: none; transform-origin: 50% 62%; }
.photo-hit {
  position: absolute;
  inset: 0;
  z-index: 6;
  border-radius: 5px;
  border: 0;
  background: transparent;
  transform: rotate(-3deg);
  touch-action: pan-y;
  cursor: grab;
}
.photo-hit:active { cursor: grabbing; }
.photo-caption { font-family: Georgia, serif; font-style: italic; color: #49365a; font-size: clamp(.94rem, 2.5vw, 1.25rem); }
.photo-controls { display: flex; align-items: center; justify-content: center; gap: .9rem; font-size: .875rem; font-weight: 800; margin-top: 1.2rem; font-variant-numeric: tabular-nums; }
.photo-controls button { width: 44px; height: 44px; font-size: 1.7rem; line-height: 1; border: 1px solid #6d4e8655; border-radius: 50%; background: #fff8ff82; }
.photo-controls button:hover { background: #fff8ff; }

.letter {
  display: grid;
  place-items: center;
  color: #4b274e;
  background: #fff2f6;
}
.letter-layout { width: min(100%, 37rem); display: grid; justify-items: center; gap: 1.55rem; text-align: center; }
.letter h2 { font-size: clamp(3.7rem, 9vw, 7rem); }
.letter .scene-spark { color: #aa537e; }
.mail { position: relative; width: min(82%, 340px); aspect-ratio: 1.65; perspective: 640px; margin: 1rem auto .15rem; }
.envelope { position: absolute; inset: 0; isolation: isolate; transition: transform .25s; }
.mail[data-state="sealed"]:is(:hover, :focus-within) .envelope { transform: rotate(-3deg) translateY(-5px); }
.envelope > span { position: absolute; }
.envelope-back { inset: 0; background: #d984ae; border-radius: 9px; box-shadow: 0 21px 40px #813e6d35; }
.envelope-peek { inset: 9% 7%; border-radius: 6px; background: repeating-linear-gradient(#fff5e9 0 15px, #eedbe8 15px 16px); }
.envelope-pocket { inset: 0; border-radius: 9px; background: linear-gradient(157deg, #ffdeeb, #e8a4c5); clip-path: polygon(0 0, 49% 51%, 100% 0, 100% 100%, 0 100%); }
.envelope-flap { inset: 0 0 27%; background: linear-gradient(160deg,#fbd1e5,#df8eb8); clip-path: polygon(0 0, 100% 0, 53% 76%, 50% 79%, 47% 76%); border-radius: 9px; transform-origin: center top; }
.envelope-seal { inset: 56% auto auto 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 17%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 32% 30%, #c573a4, #8d477f); box-shadow: inset 0 0 0 3px #ffdcf033, 0 4px 9px #6a355a45; color: #ffe1e7; font-size: 1.55rem; }
.envelope-hit { position: absolute; inset: 0; width: 100%; border: 0; border-radius: 9px; background: transparent; }
.mail[data-state="opening"] .envelope-flap { animation: unseal .47s ease-in-out both; }
.mail[data-state="opening"] .envelope-seal { animation: vanish .25s both; }
.mail[data-state="opening"] .envelope-peek { z-index: 2; animation: lift .59s .32s cubic-bezier(.2,.75,.25,1) both; }
@keyframes unseal { to { transform: rotateX(174deg); } }
@keyframes vanish { to { opacity: 0; } }
@keyframes lift { to { transform: translateY(-70%) rotate(-5deg); opacity: .75; } }
.paper {
  width: 100%;
  padding: clamp(1.3rem, 5vw, 3.5rem);
  text-align: left;
  background: #fff9f0;
  border: 1px solid #e5bfd1;
  border-radius: 8px 8px 31px 8px;
  box-shadow: 0 16px 50px #6b366926;
  animation: rise .45s both;
}
.paper-top { display: flex; justify-content: space-between; color: #965081; font-weight: 800; }
.paper h3 { font-size: clamp(1.7rem, 5vw, 2.9rem); line-height: 1.07; letter-spacing: -.065em; margin: .55em 0 .55em; }
.paper p { line-height: 1.68; }
.paper p + p { margin-top: .7em; }
.signature { margin-top: 1rem; font: italic 1.25rem Georgia, serif; }
.text-button { background: transparent; border: 0; font-weight: 800; text-decoration: underline; text-underline-offset: .2em; min-height: 44px; }

@media (max-width: 680px) {
  .site-header { min-height: 64px; padding-inline: 5vw; }
  .site-header nav button { padding-inline: .59em; }
  .scene { padding: 91px 7vw 52px; }
  .album::before, .letter::before { inset: 65px 3.2vw 25px; 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; }
  body:not([data-scene="fireworks"]) .stickers { opacity: .65; }
  .album { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; justify-items: center; align-content: center; gap: 1.3rem; text-align: center; }
  .album-copy { grid-area: 1 / 1; }
  .album h2 { font-size: clamp(3.2rem, 12vw, 5rem); }
  .album h2 br { display: none; }
  .album-copy p { margin: .55rem 0 .25rem; }
  .album-stage { grid-area: 2 / 1; width: min(85%, 290px, max(205px, 43svh)); }
  .album-next { grid-area: 3 / 1; justify-self: center; margin-top: 0; }
  .scene-spark { font-size: 1.8rem; margin-bottom: .5rem; }
  .photo-controls { margin-top: .7rem; }
  .letter-layout { gap: 1.12rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
