:root {
  --bg: #e6e1da;
  --paper: #f5f2ed;
  --ink: #45403b;
  --ink-soft: #5d5751;
  --muted: #7d766e;
  --line: rgba(69, 64, 59, .16);
  --taupe: #857c72;
  --taupe-dark: #6f675e;
  --col: 460px;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --script: "Pinyon Script", cursive;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .32 0 0 0 0 .29 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100svh;
  background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: 18px; line-height: 1.55; font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; height: 100svh; }
body.locked .sheet > * { visibility: hidden; } /* keep only the blank arch peeking behind the cover */
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Backdrop (outside the paper) ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 0%, #f1ede7 0%, var(--bg) 60%, #dcd6ce 100%);
}
.backdrop::after { content: ""; position: absolute; inset: 0; background: var(--noise); }
.backdrop__fl { position: absolute; width: min(56vw, 520px); opacity: .7; filter: blur(1.5px); }
.backdrop__fl--l { left: -14vw; top: -4vh; transform: rotate(-12deg); }
.backdrop__fl--r { right: -14vw; bottom: -10vh; transform: scaleX(-1) rotate(-18deg); }

/* ---------- Paper ---------- */
.paper {
  position: relative; background-color: var(--paper);
  background-image: var(--noise), linear-gradient(180deg, #f7f5f1, #f1ede7);
  box-shadow: 0 18px 50px rgba(60, 50, 40, .18), 0 2px 6px rgba(60, 50, 40, .08);
}

/* Embossed floral on the edges of a section */
.fl { position: absolute; z-index: 0; width: 40%; max-width: 190px; pointer-events: none; user-select: none; }
.fl--l { left: -23%; top: 8%; }
.fl--r { right: -23%; top: 10%; transform: scaleX(-1); }
.fl--top { top: 18%; }

/* ---------- Type ---------- */
.caps {
  font-family: var(--serif); font-weight: 600; font-size: 15px; line-height: 1.55;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink); margin: 0 auto 14px; max-width: 330px;
}
.caps--sm { font-size: 13.5px; font-weight: 500; }
.caps--xs { font-size: 12px; font-weight: 500; letter-spacing: .2em; color: var(--muted); margin-bottom: 6px; }
.caps b { font-weight: 600; letter-spacing: .1em; }
.names { margin: 4px auto 22px; font-family: var(--script); font-weight: 400; font-size: clamp(50px, 15vw, 66px); line-height: 1.05; color: var(--ink); width: max-content; max-width: 100%; }
.names span { display: block; text-align: left; }
.names .names__amp { padding-left: 1.05em; }
.title { font-family: var(--script); font-weight: 400; font-size: 50px; line-height: 1.1; margin: 0 0 18px; color: var(--ink); }
.body { font-size: 18px; line-height: 1.6; color: var(--ink-soft); max-width: 340px; margin: 0 auto 14px; }
.body--it { font-style: italic; }
.mono { width: 92px; height: auto; margin: 0 auto 18px; }
.mono--lg { width: 104px; margin-bottom: 26px; }
.mono--sm { width: 54px; margin-bottom: 10px; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--serif); font-weight: 600; font-size: 14px; letter-spacing: .12em; text-transform: uppercase;
  padding: 13px 30px; border-radius: 999px; border: 0; text-decoration: none;
  background: var(--taupe); color: #fbf9f6; box-shadow: 0 6px 16px rgba(80, 70, 60, .22);
  transition: background .25s, transform .2s;
}
.btn:hover { background: var(--taupe-dark); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn--sm { font-size: 12.5px; padding: 10px 20px; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--taupe); box-shadow: none; }
.btn--ghost:hover { background: rgba(133, 124, 114, .1); }
.link { background: none; border: 0; color: var(--taupe-dark); font-size: 16px; text-decoration: underline; text-underline-offset: 4px; padding: 6px; }

/* ---------- PAGE 1 · Cover ---------- */
.cover {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px;
  transition: transform 1.1s var(--ease), opacity 1.1s var(--ease);
}
.cover.gone { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.cover__card {
  width: min(100%, 420px); min-height: min(88svh, 700px); border-radius: 26px; overflow: hidden;
  display: flex; align-items: center;
}
.cover__card .fl { width: 46%; }
.cover__card .fl--l { top: 30%; }
.cover__card .fl--r { top: 34%; }
.cover__inner { position: relative; z-index: 1; width: 100%; text-align: center; padding: 44px 34px 40px; }
.cover__inner .caps--sm { max-width: 290px; }
.cover__guest { margin: 22px 0 4px; }
.cover__name { font-size: 24px; font-weight: 600; margin: 0; line-height: 1.25; }
.cover__inner .btn { margin-top: 22px; }
.cover__inner > * { opacity: 0; transform: translateY(12px); animation: rise 1s var(--ease) forwards; }
.cover__inner > :nth-child(2) { animation-delay: .15s; }
.cover__inner > :nth-child(3) { animation-delay: .3s; }
.cover__inner > :nth-child(4) { animation-delay: .45s; }
.cover__inner > :nth-child(5) { animation-delay: .6s; }
.cover__inner > :nth-child(6) { animation-delay: .75s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Sheet ---------- */
.sheet {
  z-index: 1; width: calc(100% - 28px); max-width: var(--col); margin: 18px auto 0;
  border-top-left-radius: 50% 210px; border-top-right-radius: 50% 210px; overflow: clip;
}
.sec { position: relative; padding: 64px 30px; text-align: center; }
.sec > :not(.fl) { position: relative; z-index: 1; }
.sec--arch { padding-top: 92px; }

/* Couple */
.couple { padding-top: 24px; }
.person__name { font-family: var(--script); font-weight: 400; font-size: 46px; line-height: 1.15; margin: 0 0 10px; }
.person__parents { font-size: 17px; font-weight: 500; line-height: 1.55; color: var(--ink-soft); margin: 0; }
.couple__amp { font-family: var(--script); font-size: 54px; line-height: 1; margin: 24px 0 18px; color: var(--taupe); }
.couple__joy { margin-top: 40px; }

/* Date + countdown */
.date { padding-top: 24px; padding-bottom: 54px; }
.date__day { font-weight: 600; font-size: 20px; letter-spacing: .3em; text-transform: uppercase; margin: 0 0 2px; }
.date__row { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 34px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; font-size: 20px; }
.date__row b { font-size: 52px; font-weight: 500; letter-spacing: 0; line-height: 1; }
.date__row span:first-child::after, .date__row b::after { content: "•"; margin-left: 14px; font-size: 18px; vertical-align: middle; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 340px; margin: 0 auto; }
.countdown div {
  padding: 14px 2px 10px; border-radius: 12px; background: rgba(255, 255, 255, .55);
  border: 1px solid var(--line); box-shadow: inset 0 1px 0 #fff, 0 3px 10px rgba(80, 70, 60, .08);
}
.countdown span { display: block; font-size: 30px; font-weight: 500; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.countdown small { display: block; margin-top: 7px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.countdown__done { font-family: var(--script); font-size: 34px; margin: 0; }

/* Ornamental band between groups */
.band {
  position: relative; z-index: 1; height: 30px; margin: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 12px 15px, transparent 5px, rgba(133, 124, 114, .35) 5.5px, transparent 6.5px) 0 0 / 24px 30px,
    linear-gradient(var(--line), var(--line)) 0 6px / 100% 1px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 23px / 100% 1px no-repeat,
    rgba(255, 255, 255, .35);
}

/* Location */
.icon { display: block; margin: 0 auto 14px; fill: none; stroke: var(--ink-soft); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.icon--temple { width: 128px; }
.icon--rings { width: 66px; margin-top: 44px; }
.venue { font-weight: 600; font-size: 20px; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 18px; }
.time { font-weight: 600; font-size: 26px; letter-spacing: .08em; margin: 0 0 2px; }

/* Cards + forms */
.card {
  text-align: left; margin-top: 24px; padding: 24px 20px; border-radius: 18px;
  background: rgba(255, 255, 255, .5); border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(80, 70, 60, .07);
}
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { font-size: 12.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding: 0; margin-bottom: 7px; }
.field input[type=text], .field textarea {
  width: 100%; font: 500 18px/1.4 var(--serif); color: var(--ink);
  background: rgba(255, 255, 255, .85); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px;
  transition: border-color .25s; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--taupe); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices--stack { grid-template-columns: 1fr; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, .6); font-size: 17px; font-weight: 500; transition: border-color .25s, background .25s;
}
.choice span::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--muted); flex: none; transition: background .25s, box-shadow .25s; }
.choice input:checked + span { border-color: var(--taupe); background: rgba(133, 124, 114, .12); }
.choice input:checked + span::before { background: var(--taupe); border-color: var(--taupe); box-shadow: inset 0 0 0 3px #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--taupe); outline-offset: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form__msg { margin: -4px 0; font-size: 15px; font-weight: 500; color: #a4503c; }
.form__msg:empty { display: none; }
.thanks { text-align: center; }
.thanks__title { font-family: var(--script); font-size: 42px; margin: 0; line-height: 1.2; }
.thanks__text { color: var(--ink-soft); margin: 6px 0 10px; }

/* Gift */
.bank {
  position: relative; max-width: 320px; margin: 24px auto 0; padding: 24px 22px; border-radius: 18px; text-align: center;
  background: rgba(255, 255, 255, .55); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(80, 70, 60, .08);
}
.bank__name { font-weight: 600; letter-spacing: .3em; font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.bank__no { font-size: 30px; font-weight: 500; letter-spacing: .08em; margin: 0; font-variant-numeric: lining-nums tabular-nums; }
.bank__holder { font-weight: 600; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; margin: 2px 0 16px; }

/* Wishes */
.wishes__count { font-size: 12.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 30px 0 12px; }
.wishes__count:empty { display: none; }
.wishes { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 480px; overflow-y: auto; text-align: left; display: grid; gap: 10px; scrollbar-width: thin; }
.wishes li { background: rgba(255, 255, 255, .5); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.wishes .w__name { font-weight: 600; font-size: 18px; margin: 0; }
.wishes .w__time { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.wishes .w__msg { margin: 0; color: var(--ink-soft); white-space: pre-line; overflow-wrap: anywhere; }
.wishes li.fresh { animation: rise .8s var(--ease) both; }

/* Our moments: black & white collage */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid > * { padding: 0; border: 0; border-radius: 6px; overflow: hidden; aspect-ratio: 4 / 5; background: #e1dcd4; }
.grid > :nth-child(3n + 1) { grid-column: span 2; aspect-ratio: 16 / 11; }
.grid img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); transition: transform .6s var(--ease), filter .6s; }
.grid button:hover img { transform: scale(1.04); filter: grayscale(0); }
.grid .ph { display: grid; place-items: center; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; border: 1px dashed rgba(69, 64, 59, .25); }

/* Footer */
.foot { position: relative; z-index: 1; text-align: center; padding: 30px 20px max(80px, calc(env(safe-area-inset-bottom) + 70px)); border-top: 1px solid var(--line); }
.foot__thanks { font-family: var(--script); font-size: 42px; margin: 0 0 4px; line-height: 1.2; }

/* ---------- Falling petals ---------- */
.petals { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.petal {
  position: absolute; top: -30px; width: 14px; height: 10px; border-radius: 80% 0 80% 0;
  background: linear-gradient(135deg, #fff, #e4ded5); box-shadow: 1px 2px 3px rgba(80, 70, 60, .18); opacity: .85;
  animation: fall linear infinite;
}
@keyframes fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(40px, 55vh, 0) rotate(200deg); }
  100% { transform: translate3d(-20px, 110vh, 0) rotate(420deg); }
}

/* ---------- Music button ---------- */
.music {
  position: fixed; z-index: 40; bottom: max(18px, env(safe-area-inset-bottom)); right: max(18px, calc(50% - var(--col) / 2 + 14px));
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); padding: 0;
  background: rgba(255, 255, 255, .85); box-shadow: 0 6px 16px rgba(80, 70, 60, .2);
  -webkit-appearance: none; appearance: none;
}
.music svg { position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.music .music__off { display: none; }
.music.paused .music__on { display: none; }
.music.paused .music__off { display: block; }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(30, 27, 24, .94); display: grid; place-items: center; }
.lb__img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 4px; user-select: none; }
.lb__close, .lb__nav { position: absolute; background: none; border: 0; color: #f5f2ed; line-height: 1; padding: 12px; }
.lb__close { top: max(10px, env(safe-area-inset-top)); right: 12px; font-size: 38px; }
.lb__nav { top: 50%; transform: translateY(-50%); font-size: 52px; opacity: .8; }
.lb__prev { left: 4px; }
.lb__next { right: 4px; }
.lb__count { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); margin: 0; font-size: 13px; letter-spacing: .2em; color: rgba(245, 242, 237, .6); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 120; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fbf9f6; font-size: 15px; font-weight: 500; padding: 9px 18px; border-radius: 999px;
  transition: opacity .3s, transform .3s var(--ease); white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Scroll reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(20px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

@media (min-width: 700px) {
  .sheet { margin-top: 40px; margin-bottom: 40px; }
  .foot { padding-bottom: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .cover__inner > * { opacity: 1; transform: none; }
  .js .reveal { opacity: 1; transform: none; }
  .petals { display: none; }
  html { scroll-behavior: auto; }
}
