:root {
  color-scheme: light;
  --paper: #fbf4ea;
  --ink: #381b26;
  --muted: #6e4855;
  --wine: #86213e;
  --wine-dark: #65152e;
  --rule: #e4c8c2;
  --white: #fffbf7;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 81% 37%, #f7dcd9 0, transparent 54%),
    radial-gradient(ellipse at 10% 100%, #f3e3d2 0, transparent 50%),
    var(--paper);
}

.collage {
  position: fixed;
  inset: -2.4vmin;
  z-index: 0;
  display: grid;
  grid-template-columns: .95fr 1.06fr .92fr 1.13fr .94fr;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: clamp(2px, .65vmin, 9px);
  overflow: hidden;
  pointer-events: none;
}

.collage-desktop { display: contents; }
.collage-reel { display: none; }

.collage-desktop img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  object-position: center 40%;
  border: clamp(2px, .5vmin, 7px) solid #fff8eb;
  box-shadow: 0 4px 13px #411e2c60;
  transform: rotate(var(--tilt, -2deg)) scale(var(--size, 1.04));
}

.collage-desktop img:nth-child(3n) { --tilt: 3.5deg; --size: 1.08; }
.collage-desktop img:nth-child(4n+1) { --tilt: -5deg; --size: 1.09; }
.collage-desktop img:nth-child(5n+2) { --tilt: 4deg; --size: 1.02; }

.collage::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, #f8e9d14d, #f1d1d155);
}

.has-collage .masthead,
.has-collage main { position: relative; }

.has-collage .masthead {
  min-height: 3.7rem;
  padding-inline: 1rem;
  background: #fff8eeed;
  border-radius: 0 0 .65rem .65rem;
}

.has-collage .cover-copy,
.has-collage .album {
  padding-inline: clamp(1rem, 3.8vw, 3rem);
  border: 1px solid #fff8ee;
  border-radius: .85rem;
  background: #fff8eff0;
  box-shadow: 0 10px 30px #451d2f25;
}

.has-collage .cover-copy { padding-block: clamp(1.5rem, 5vw, 3rem); }
.has-collage .cover h1 { font-size: clamp(3.3rem, 7vw, 6.5rem); }
.has-collage .album { margin-block: 1.25rem; }
.has-collage .envelope-art { filter: drop-shadow(0 6px 14px #4b263d2b); }

@media (max-width: 760px) {
  .collage {
    inset: -2vw;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    column-gap: 0.5rem;
  }

  .collage-desktop { display: none; }

  .collage-reel {
    display: block;
    align-self: start;
    min-width: 0;
    animation: collage-scroll 92s linear -8s infinite;
  }

  .collage-reel:last-child { animation-duration: 100s; animation-delay: -18s; }

  .collage-group {
    display: grid;
    gap: 0.5rem;
    padding-block-end: 0.5rem;
  }

  .collage-group img {
    display: block;
    width: 100%;
    height: auto;
    border: 3px solid #fff8eb;
    box-shadow: 0 3px 9px #411e2c44;
    rotate: -2deg;
  }

  .collage-group img:nth-child(even) { rotate: 2deg; }

  .has-collage .cover { padding-top: 1.3rem; }
  .has-collage .cover h1 { font-size: clamp(3.25rem, 12vw, 6rem); }
}

@keyframes collage-scroll {
  from { transform: translateY(-50%); }
  to { transform: translateY(0); }
}

button, a, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #ac4161; outline-offset: 5px; }
h1, h2, p { margin: 0; }

.masthead {
  width: min(100% - 3rem, 72rem);
  margin-inline: auto;
  min-height: 5.35rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.96rem;
  font-weight: 650;
  color: var(--wine);
}

.masthead span:first-child { font-size: 1.27rem; }

main {
  width: min(100% - 3rem, 67rem);
  margin-inline: auto;
}

.cover {
  min-height: min(42rem, calc(100svh - 5.35rem));
  display: grid;
  grid-template-columns: 1.04fr 1fr;
  align-items: center;
  gap: clamp(2rem, 6vw, 5.5rem);
  padding-block: 3.8rem 5.6rem;
}

.cover h1, .album h1 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.075em;
}

.cover h1 {
  font-size: clamp(4.7rem, 9.8vw, 8.55rem);
  line-height: 0.86;
}

.cover h1 em, .album h1 em { color: var(--wine); }

.cover-copy > p {
  margin-top: 2.05rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  max-width: 24ch;
  line-height: 1.55;
}

.action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  min-height: 3.5rem;
  padding: 0.84rem 1.45rem;
  border-radius: 2rem;
  border: 1px solid transparent;
  background: var(--wine);
  color: white;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 8px 20px #73163320;
  transition: background 180ms ease, transform 180ms ease;
}

.action:hover { background: var(--wine-dark); transform: translateY(-2px); }
.cover .action { margin-top: 1.75rem; }
.cover .action span { color: #ffd0d8; }
.cover-copy > .cover-notice { max-width: 36ch; margin-top: 1rem; font-size: 0.96rem; }

.envelope-art {
  position: relative;
  display: grid;
  align-items: center;
  aspect-ratio: 1.13;
  padding-inline: 7%;
  isolation: isolate;
}

.envelope-art::before {
  content: '';
  position: absolute;
  inset: 13% 3%;
  z-index: -1;
  border: 1px solid #e8bdbb;
  border-radius: 50%;
  rotate: -16deg;
}

.envelope-art::after {
  content: '';
  position: absolute;
  inset: 10% 7%;
  z-index: -1;
  border: 1px solid #ebc8c3;
  border-radius: 50%;
  rotate: 18deg;
}

.envelope {
  position: relative;
  aspect-ratio: 1.57;
  rotate: -7deg;
  filter: drop-shadow(0 22px 20px #74293d2c);
  transition: rotate 500ms ease, transform 500ms ease;
  margin-top: 2%;
}

.envelope-back, .envelope-pocket {
  position: absolute;
  inset: 0;
  border-radius: 5px;
}

.envelope-back { background: #c67883; }

.stationery {
  position: absolute;
  inset: -20% 10% 15%;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 9%;
  color: var(--wine);
  background: #fff9ee;
  border: 1px solid #e4c9bc;
  box-shadow: 0 5px 18px #66263419;
  rotate: 8deg;
  transition: transform 520ms cubic-bezier(.2,.85,.3,1), rotate 520ms ease;
}

.stationery::before {
  content: '';
  position: absolute;
  inset: 6%;
  border: 1px solid #eddbd1;
}

.stationery span { font: italic clamp(2rem, 5vw, 3.55rem)/1.2 var(--serif); }
.stationery b { color: #b85372; font-size: 1rem; }

.envelope-pocket {
  background:
    linear-gradient(31deg, #e4a2a7 49%, #cd879155 50%, transparent 51%) left / 51% 100% no-repeat,
    linear-gradient(-31deg, #eab0af 49%, #cd879155 50%, transparent 51%) right / 51% 100% no-repeat,
    linear-gradient(155deg, #efbeb9, #e4a1a7);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}

.seal {
  position: absolute;
  display: grid;
  place-items: center;
  left: 50%;
  top: 56%;
  width: 16%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 49% 51% 48% 52%;
  border: clamp(3px, .48vw, 6px) solid #9e3b52;
  background: #8a2341;
  color: #f1b7b9;
  box-shadow: 0 3px 5px #6e1a3155, inset 0 0 0 1px #c66b7a;
  font-size: clamp(1rem, 2.6vw, 2rem);
  line-height: 1;
}

.spark {
  position: absolute;
  color: #a6405d;
  font: 2.1rem var(--serif);
}

.spark-large { top: 7%; right: 11%; }
.spark-small { top: 23%; right: 4%; font-size: 1.4rem; }
.spark-bottom { bottom: 8%; left: 1%; font-size: 1.3rem; }
.opening .envelope { rotate: 0deg; transform: translateY(5%); }
.opening .stationery { rotate: 1deg; transform: translateY(-35%); }

.album { padding-block: 2.5rem 4rem; animation: appear 350ms ease both; }

.album-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.album h1 { font-size: clamp(2.1rem, 7vw, 4.6rem); line-height: 1.03; }

.quiet-button {
  background: transparent;
  padding: 0.7rem 0.95rem;
  border-radius: 2rem;
  border: 1px solid #d8b0b1;
  color: var(--wine-dark);
  font-size: 0.92rem;
  font-weight: 650;
  text-wrap: nowrap;
}

.quiet-button:hover { background: #f8e5e2; }

.tabs {
  display: grid;
  grid-template-columns: 1.22fr .92fr .96fr;
  gap: clamp(.2rem, 1vw, .48rem);
  max-width: 32rem;
  padding-inline: .24rem;
  border-bottom: 1px solid #c99da2;
}

.tabs button {
  position: relative;
  top: 1px;
  min-width: 0;
  min-height: 2.85rem;
  padding: .5rem .22rem;
  border: 1px solid #dbb8b9;
  border-radius: .65rem .65rem 0 0;
  background: #f2dedd;
  color: var(--wine-dark);
  font: 700 clamp(.76rem, 3.35vw, 1rem)/1.1 var(--serif);
  overflow-wrap: anywhere;
}

.tabs button:hover { background: #f9ebe5; }

.tabs [aria-selected="true"] {
  border-color: #c99da2;
  border-bottom-color: #fff8ee;
  background: #fff8ee;
  box-shadow: inset 0 3px 0 var(--wine);
}

.panel {
  padding-block: clamp(1.65rem, 5vw, 3rem);
  animation: appear 280ms ease both;
}

.panel-title { margin-bottom: 1.6rem; }
.panel-title p { color: var(--muted); line-height: 1.55; margin-top: 0.55rem; }

.panel h2 {
  color: var(--wine-dark);
  font: 400 clamp(2.2rem, 5vw, 3.6rem)/1.02 var(--serif);
  letter-spacing: -0.05em;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.6rem);
}

.memory-grid > :nth-child(4n+1) { rotate: -2deg; }
.memory-grid > :nth-child(4n+3) { rotate: 1.7deg; }
.memory-grid > :nth-child(5n+2) { rotate: 1deg; }
.memory-grid > :focus-within { position: relative; z-index: 1; }

.photo {
  display: block;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid #ecd6cb;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 8px 19px #7b374014;
  text-align: left;
}

.photo-frame { aspect-ratio: 2.06; }

.photo-frame {
  position: relative;
  display: block;
  aspect-ratio: 1;
  perspective: 900px;
  background: #f6e4df;
}

.photo-front, .photo-back {
  position: absolute;
  inset: 0;
  min-width: 0;
  backface-visibility: hidden;
  transition: transform 380ms ease;
}

.photo-front img { display: block; width: 100%; height: 100%; object-fit: cover; }

.photo-back {
  display: grid;
  place-items: center;
  padding: 0.8rem;
  background: #f9e7e3;
  color: var(--wine-dark);
  font: italic clamp(1rem, 2.8vw, 1.4rem)/1.3 var(--serif);
  text-align: center;
  transform: rotateY(180deg);
  overflow: auto;
}

.photo[aria-pressed="true"] .photo-front { transform: rotateY(-180deg); }
.photo[aria-pressed="true"] .photo-back { transform: rotateY(0); }
.photo-label { display: block; padding: 0.6rem 0.15rem 0.25rem; font: italic 1.04rem var(--serif); }

.future-photo {
  padding: 1.15rem;
  border: 1px dashed #bd7a8b;
  border-radius: 0.65rem;
  background: #fffaf4a0;
  color: var(--muted);
  text-align: center;
}

.future-photo span { color: var(--wine); font-size: 2.1rem; }
.panel-next { margin-top: 1.6rem; }

.movie {
  min-width: 0;
  grid-column: span 2;
  margin: 0;
  padding: 0.62rem;
  border: 1px solid #ecd6cb;
  background: var(--white);
  box-shadow: 0 8px 19px #7b374014;
}

.movie--portrait { grid-column: span 1; }

.movie video, .movie img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: var(--ink);
}

.movie--portrait video { aspect-ratio: 4 / 5; object-fit: cover; }

.movie figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.2rem 0.2rem;
  font: italic 1.12rem var(--serif);
}

.movie-toggle {
  border: 1px solid var(--rule);
  border-radius: 2rem;
  background: var(--white);
  color: var(--wine-dark);
  padding: 0.4rem 0.7rem;
  font: 650 0.88rem system-ui, sans-serif;
}

.movie-notice { margin: 0.45rem 0.2rem 0.2rem; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 580px) {
  .movie--portrait video { aspect-ratio: 9 / 16; }
  .movie--portrait figcaption { flex-wrap: wrap; }
}

.letter-paper {
  position: relative;
  isolation: isolate;
  max-width: 42rem;
  margin-inline-start: clamp(.25rem, 1.4vw, 1.2rem);
  padding: clamp(1.4rem, 5vw, 3.3rem);
  border: 1px solid #e7c9bd;
  background: #fffbf2;
  box-shadow: .34rem .42rem 0 #d4a5aa, .62rem .73rem 0 #f6dfd7, 0 12px 30px #71344228;
}

.letter-paper::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: .45rem;
  border: 1px solid #eed9cd;
  pointer-events: none;
}

.letter-mark {
  display: grid;
  place-items: center;
  width: 2.8rem;
  aspect-ratio: 1;
  margin: 0 0 1rem auto;
  rotate: -10deg;
  border: 3px double #e0a6ad;
  border-radius: 50%;
  background: var(--wine);
  color: #ffe0de;
  font-size: 1.15rem;
  box-shadow: 0 3px 5px #762d3c31;
}

.letter-paper h2 { margin-top: -.3rem; font-style: italic; }

.letter-paper p {
  margin-top: 1.12rem;
  font: 400 clamp(1.05rem, 2vw, 1.2rem)/1.62 var(--serif);
}

.letter-paper p:first-child {
  margin-top: 1.25rem;
  padding-top: .95rem;
  border-top: 1px solid #e8cfc7;
}

.gift-grid {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.gift { min-width: 0; position: relative; cursor: pointer; }

.gift input {
  appearance: none;
  position: absolute;
  z-index: 1;
  top: 0.9rem;
  right: 0.9rem;
  width: 1.19rem;
  height: 1.19rem;
  margin: 0;
  border: 1.5px solid #b87485;
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
}

.gift input:checked { border: 5px solid var(--wine); }

.gift-card {
  height: 100%;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 0.85rem;
  background: var(--white);
  transition: border-color 180ms ease, background 180ms ease;
}

.gift:hover .gift-card { border-color: #b87485; }
.gift input:checked + .gift-card { border-color: var(--wine); background: #f8e1e1; }
.gift-icon { font-size: 1.95rem; }
.gift-name { font: 400 1.45rem var(--serif); color: var(--wine-dark); }
.gift-note { font-size: 0.92rem; color: var(--muted); line-height: 1.35; }

.gift-response { margin-top: 1.4rem; animation: appear 250ms ease both; }
.gift-response p { margin-top: 0.65rem; color: var(--muted); font-size: 0.95rem; }
.future-photo { display: grid; place-items: center; width: min(100%, 19rem); margin-top: 2.2rem; }

.confetti { pointer-events: none; overflow: hidden; position: fixed; inset: 0; }

.confetti span {
  position: absolute;
  top: -2rem;
  left: var(--x);
  color: #a63c62;
  animation: fall 1.15s var(--delay) ease-in both;
}

.confetti span:nth-child(3n) { color: #b27a31; }
.confetti span:nth-child(4n) { color: #db7796; }

@keyframes fall {
  0% { opacity: 0; transform: translate3d(0, 0, 0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--drift), 92vh, 0) rotate(220deg); }
}

@keyframes appear {
  from { opacity: 0; transform: translateY(0.45rem); }
  to { opacity: 1; transform: translateY(0); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.no-script { margin: 0 auto 2rem; padding: 0 1.5rem; text-align: center; }

@media (max-width: 760px) {
  .cover { grid-template-columns: 1fr; padding-block: 2.8rem 2rem; gap: 0.9rem; text-align: center; }
  .cover h1 { font-size: clamp(4.2rem, 13vw, 6.35rem); }
  .cover-copy > p { margin: 1.45rem auto 0; }
  .cover .action { margin-top: 1.15rem; }
  .envelope-art { width: min(100%, 23rem); margin-inline: auto; }
  .masthead { min-height: 3.6rem; }
  .album { padding-top: 1.65rem; }
  .memory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  main, .masthead { width: calc(100% - 2rem); }
  .gift-grid { grid-template-columns: 1fr; gap: 0.55rem; }
  .gift-card { grid-template-columns: 2.7rem 1fr; padding-right: 2.6rem; }
  .gift-icon { grid-row: span 2; align-self: center; }
  .quiet-button { padding-inline: 0.68rem; }
  .photo { padding: 0.42rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
