@font-face {
  font-family: "Bad Script";
  src: url("assets/bad-script.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("assets/caveat.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Marck Script";
  src: url("assets/marck-script.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --night: #000;
  --pen: "Bad Script", "Segoe Print", "Bradley Hand", cursive;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--night); }
body, button { font: 400 18px/1.5 var(--pen); }
body { color: #f5ddd7; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
:is(button, a):focus-visible { outline: 1px solid #e7bab7; outline-offset: 5px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.stage, .note-scene {
  background: var(--night);
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: clip;
  min-height: 100vh;
  min-height: 100svh;
}
.love-rain {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.vignette {
  position: relative; width: min(95vw, 80vh, 670px); width: min(95vw, 80svh, 670px);
  aspect-ratio: 1.2;
}
.ascii { display: block; width: 100%; height: 100%; }
.cake-action {
  position: absolute; inset: 0 3% 0; border: 0; border-radius: 42%; background: transparent;
  touch-action: manipulation;
}
.cake-action:disabled { pointer-events: none; }
.hint {
  position: absolute; top: calc(100% + 4px); left: 50%; transform: translate(-50%, 9px);
  margin: 0; padding-block: 4px; width: max-content; max-width: calc(100vw - 24px);
  font-size: clamp(16px, 2.1vw, 23px); letter-spacing: .015em; color: #ecd1c9;
  text-align: center; text-wrap: balance; cursor: pointer;
  opacity: 0; visibility: hidden; transition: opacity .7s, transform .7s, visibility .7s;
}
[data-phase="lit"] .hint { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.sound-toggle {
  position: fixed; z-index: 2; right: max(13px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 7px 12px; border: 1px solid #493b3e; border-radius: 40px;
  background: #000; color: #c5aab0; font-size: 17px;
}
.sound-toggle:hover, .sound-toggle[aria-pressed="true"] { color: #f4d5c7; }
.sound-toggle svg { width: 17px; height: 17px; }
.sound-toggle[aria-pressed="true"] .sound-slash { display: none; }
.note-wrap {
  width: min(80vw, 354px); margin: 24px auto 0; text-align: center;
  perspective: 950px; container-type: inline-size;
}
.paper {
  --paper: #f6ecda;
  position: relative; display: grid; grid-template-rows: repeat(2, 1fr);
  transform-style: preserve-3d;
  transform: translateY(25%) rotateZ(-5deg);
  transition: transform 1.55s cubic-bezier(.32,.02,.2,1);
}
.note-scene.open .paper { transform: translateY(0) rotateZ(-2deg); }
.photo-row, .outside, .inside {
  background-color: var(--paper);
  background-image: repeating-linear-gradient(7deg, transparent 0 3px, #7d604509 3px 4px);
}
.photo-row {
  display: flex; justify-content: center; align-items: center; gap: 7%;
  padding: 18px 0 13px;
  background-image: linear-gradient(to top,#9e79551b,transparent 12%),repeating-linear-gradient(7deg,transparent 0 3px,#7d604509 3px 4px);
}
.fold {
  position: relative; transform-origin: center top; transform-style: preserve-3d;
  transform: translateZ(1px) rotateX(179.8deg);
  transition: transform 1.55s cubic-bezier(.42,.015,.18,1);
}
.note-scene.open .fold { transform: translateZ(1px) rotateX(0deg); }
.outside, .inside {
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.outside {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center;
  transform: rotateX(180deg);
  color: #a45962; font: 400 clamp(26px,10cqi,36px)/1.35 Georgia, serif;
}
.inside {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  height: 100%; padding: 12px 8px 15px; color: #603a45;
  background-image: linear-gradient(to bottom,#a18b7024,transparent 8%),repeating-linear-gradient(0deg,transparent 0 22px,#a6948340 22px 23px);
  clip-path: polygon(0 0,100% 0,100% 99.6%,91% 99.2%,78% 100%,62% 99.4%,46% 99.8%,31% 99.2%,14% 100%,0 99.5%);
}
.print {
  position: relative; display: block; margin: 0; width: 33%; aspect-ratio: 1 / 1.02;
  background: #fff9ec; padding: 1.4% 1.4% 3.7%;
  box-shadow: .5px 2px 3px #43332835;
}
.photo-slot {
  position: relative; display: block; width: 100%; height: 100%; overflow: hidden;
  background: #e2d3c3;
  outline: 1px solid #b7a38d66; outline-offset: -1px; box-shadow: inset 0 1px 4px #5e453417;
}
.print-right .photo-slot { background-color: #ddd0c7; }
.photo-slot::before, .photo-slot::after {
  content: ""; position: absolute; width: 14%; aspect-ratio: 1; background: #9c7c7280;
  clip-path: polygon(0 0,100% 0,0 100%);
}
.photo-slot::before { top: -1px; left: -1px; }
.photo-slot::after { right: -1px; bottom: -1px; transform: rotate(180deg); }
.print::before {
  content: ""; position: absolute; z-index: 1; top: -2.4%; left: 34%; width: 32%; height: 7%;
  background: repeating-linear-gradient(51deg,#f4d8ac99 0 3px,#e5c59999 3px 5px);
  transform: rotate(3deg); box-shadow: 0 1px 1px #7e664119;
  clip-path: polygon(2% 1%,100% 0,98% 19%,100% 39%,98% 62%,100% 91%,0 100%,2% 76%,0 55%,2% 29%);
}
.print-left { transform: rotate(-4deg); }
.print-right { transform: rotate(4deg); }
.print-right::before { transform: rotate(-7deg); }
.dedication {
  margin: 0;
  font: 400 clamp(21px,8.3cqi,30px)/1.55 var(--note-font, var(--pen));
}
.note-scene[data-font="caveat"] .dedication { --note-font: "Caveat", cursive; font-weight: 500; }
.note-scene[data-font="marck"] .dedication { --note-font: "Marck Script", cursive; }
.dedication:focus { outline: none; }
.section-link, .replay {
  display: inline-block; margin-top: 13px; min-height: 44px; padding: 7px 11px;
  font: 400 16px/1.45 var(--pen); color: #c8a8b2; border: 0; background: transparent;
  text-decoration: underline; text-decoration-color: #a17c8877; text-underline-offset: 5px;
}
.section-link {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
}
.more {
  visibility: hidden; opacity: 0; transition: opacity .6s;
}
.note-scene.ready .more { visibility: visible; opacity: 1; }
.section-link span { color: #e7b1be; font: 15px/1 system-ui, sans-serif; }
.memories {
  display: grid; justify-items: center; align-content: center; gap: 30px;
  min-height: 100svh; padding: clamp(40px, 7svh, 96px) max(22px, 5vw) 82px;
  overflow: clip; background: var(--night);
}
.memories:focus { outline: none; }
.collage {
  width: min(100%, 1100px);
  display: grid; grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: start; gap: 28px clamp(12px, 1.8vw, 24px);
}
.memory { min-width: 0; margin: 0; }
.memory figcaption {
  margin-block: 10px;
  color: #f0ddd7;
  font: 500 clamp(20px, 2.2vw, 29px)/1.02 "Caveat", var(--pen);
  text-wrap: pretty;
}
.memory-photo {
  position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  aspect-ratio: var(--format, 1);
  padding: clamp(4px, .65vw, 8px); background: #e9ddcb;
  transform: rotate(var(--tilt, 0deg)); transform-origin: center;
}
.memory-photo.instant { padding-bottom: clamp(10px, 1.8vw, 22px); background: #f4e9d9; }
.memory-photo.stamp { padding: 9px; background: #f4e9d9; }
.memory-photo.stamp::before, .memory-photo.stamp::after {
  content: ""; position: absolute; left: 0; right: 0; height: 5px;
  background: radial-gradient(circle at 6px 0, #000 3px, transparent 3.75px) 0 0 / 12px 5px repeat-x;
}
.memory-photo.stamp::before { top: 0; }
.memory-photo.stamp::after { bottom: 0; transform: rotate(180deg); }
.photo-slot img, .memory-photo :is(img, video) {
  display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover;
}
.print-left img, .memory-last img { object-position: 50% 37%; }
.print-right img, .memory-square img { object-position: 50% 41%; }
.memory-small img { object-position: 50% 36%; }
.memory-photo video { object-fit: contain; background: #000; }
.memory-first { grid-column: 1 / 5; display: grid; grid-template-columns: .8fr 2fr; gap: 11px; margin-top: 19px; }
.memory-first .memory-photo { grid-column: 2; grid-row: 1; --format: .8; --tilt: -3deg; }
.memory-first figcaption { grid-column: 1; grid-row: 1; margin: 4px 0 0; }
.memory-stamp { grid-column: 5 / 8; margin-top: 11%; }
.memory-stamp .memory-photo { --format: 2.23; --tilt: -3deg; }
.memory-wide { grid-column: 8 / -1; margin-top: -11px; }
.memory-wide .memory-photo { --format: 592 / 336; --tilt: -2deg; }
.memory-wide figcaption { text-align: center; }
.memory-square { grid-column: 2 / 5; margin-top: -12px; }
.memory-square .memory-photo { --format: 1.04; --tilt: -4deg; }
.memory-small { grid-column: 5 / 8; margin-top: 16%; }
.memory-small .memory-photo { --format: 1.28; --tilt: -3deg; }
.memory-tall { grid-column: 8 / 12; display: grid; grid-template-columns: 1.85fr 1fr; gap: 12px; }
.memory-tall .memory-photo { --format: .66; --tilt: -4deg; }
.memory-last { grid-column: 12 / -1; margin-top: 12%; }
.memory-last .memory-photo { --format: .82; --tilt: -7deg; }
.finale {
  display: grid; place-items: center; align-content: center; gap: clamp(42px, 8svh, 86px);
  min-height: 100svh; padding: clamp(54px, 10svh, 110px) max(18px, 5vw) 65px;
  background: var(--night); overflow: clip;
}
.finale:focus { outline: none; }
.finale-layout {
  position: relative; isolation: isolate; width: min(100%, 690px);
  display: grid; grid-template-columns: minmax(0, 1fr) 27%; align-items: center;
}
.final-letter {
  grid-area: 1 / 1 / 2 / 3; width: 75%; margin-left: 7%;
  padding: clamp(21px, 3.5vw, 39px) clamp(28px, 5.6vw, 66px) clamp(30px, 4.8vw, 57px);
  padding-right: 14%;
  border-radius: 2px 1px 3px 1px; transform: rotate(-5.7deg);
  background-color: #f3e7d2;
  background-image:
    linear-gradient(122deg, #fff8e590, transparent 55%, #b9986226),
    repeating-linear-gradient(112deg, transparent 0 3px, #9067370a 3px 4px);
  box-shadow: 0 1px 1px #e3c69b inset, 0 15px 35px #32192935;
  color: #573c43; text-align: center;
  font: 500 clamp(20px, 3vw, 25px)/1.10 "Caveat", var(--pen);
}
.final-letter h2 {
  font: inherit; font-size: clamp(30px, 4.7vw, 42px); line-height: 1;
  margin: 0 0 .42em; color: #653e4b;
}
.final-letter p { margin: 0; text-wrap: pretty; }
.final-letter p + p { margin-top: .55em; }
.final-signature { color: #8a4e5c; font-size: 1.12em; }
.final-bow {
  display: block; position: relative; width: 43px; height: 29px;
  margin: 0 auto 6px; color: #6a8792;
}
.final-bow::before, .final-bow::after {
  content: ""; position: absolute; top: 4px; width: 17px; height: 11px; border: 1.4px solid currentColor;
}
.final-bow::before { left: 3px; border-radius: 65% 48% 27% 68%; transform: rotate(26deg); }
.final-bow::after { right: 3px; border-radius: 48% 65% 68% 27%; transform: rotate(-26deg); }
.final-bow i::before, .final-bow i::after {
  content: ""; position: absolute; top: 12px; width: 8px; height: 14px;
  border-right: 1.4px solid currentColor; border-radius: 0 0 6px 0;
}
.final-bow i::before { left: 10px; transform: rotate(23deg); }
.final-bow i::after { right: 10px; transform: scaleX(-1) rotate(23deg); }
.final-photo {
  position: relative; grid-area: 1 / 2; z-index: 1;
  width: 100%; margin: 30% 0 0 -8%;
  padding: 8px 8px 23px; transform: rotate(6deg); background: #fff5e7;
  box-shadow: 3px 9px 24px #160e14bd;
}
.final-photo img { display: block; width: 100%; aspect-ratio: 1 / 1.12; object-fit: cover; object-position: 50% 60%; }
.final-decoration { position: absolute; z-index: 2; display: block; height: auto; pointer-events: none; }
.final-lily { left: -4%; bottom: -24%; width: 28%; transform: rotate(-14deg); }
.final-toys { right: 9%; bottom: -17%; width: 22%; transform: rotate(7deg); }
@media (max-width: 600px) {
  .finale { padding-top: 51px; gap: 24px; }
  .finale-layout { grid-template-columns: minmax(0, 1fr) 34%; width: min(100%, 450px); }
  .final-letter { width: 100%; margin-left: 0; padding: 21px clamp(28px, 5.6vw, 40px) 44px; transform: rotate(-3deg); }
  .final-photo { grid-area: 2 / 2; margin: -22px 0 0 -3%; padding: 5px 5px 14px; }
  .final-lily { left: -3%; bottom: 5%; width: 34%; }
  .final-toys { right: 26%; bottom: -3%; width: 25%; }
}
@media (max-width: 800px) {
  .collage { max-width: 560px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 19px; }
  .memory { grid-column: auto; display: block; margin-top: 0; }
  .memory-first figcaption { margin-top: 10px; }
  .memory-stamp { margin-top: 17%; }
  .memory-wide { grid-column: 1 / -1; }
  .memory-small, .memory-last { margin-top: 14%; }
}
@media (max-height: 420px) and (orientation: landscape) {
  .vignette { width: min(72svh,65vw); }
  .note-wrap { width: min(80vw, 294px); margin: 12px auto; }
  .photo-row { padding-block: 10px; }
  .section-link, .replay { margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
