:root {
  --paper: #F7F2EA;
  --paper-2: #EFE7DA;
  --ink: #2F2A24;
  --ink-2: #6E665B;
  --line: #D9CFBF;
  --sage: #7F8E72;
  --gold: #A88754;
  --wine: #6F2A26;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Manrope', system-ui, sans-serif;
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .2 0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper) var(--noise);
  color: var(--ink);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; height: 100svh; }
[hidden] { display: none !important; }
.is-one [data-if="many"], .is-many [data-if="one"] { display: none !important; }

/* ---------- Cover with envelope ---------- */
#cover {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px;
  background: radial-gradient(120% 80% at 50% 35%, #EFE7DA 0%, #E2D6C3 70%, #D6C8B2 100%);
  cursor: pointer; outline: none;
  transition: opacity .8s ease, visibility 0s .8s;
}
.opened #cover { opacity: 0; visibility: hidden; }
.cover-to {
  font: italic 300 27px/1.2 var(--serif); color: var(--ink); text-align: center; padding: 0 24px;
  transition: opacity .4s;
}
.cover-hint {
  font: 500 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2);
  animation: breathe 2.4s ease-in-out infinite; transition: opacity .3s;
}
.opening .cover-hint, .opening .cover-to { opacity: 0; animation: none; }
@keyframes breathe { 50% { opacity: .35; } }

.env {
  position: relative; width: min(82vw, 360px); aspect-ratio: 1.5; perspective: 1400px;
  filter: drop-shadow(0 28px 34px rgba(80, 55, 30, .28));
  transition: transform 1s cubic-bezier(.2, .8, .2, 1) .9s;
}
.opening .env { transform: translateY(24vh) scale(.94); }
.env-back { position: absolute; inset: 0; background: #E8DDCB; border-radius: 3px; }
.letter {
  position: absolute; left: 5%; right: 5%; top: 5%; height: 90%; z-index: 2;
  background: #FFFDF8 var(--noise); border-radius: 2px;
  display: grid; place-items: center;
  font: 300 34px/1 var(--serif); color: var(--ink); letter-spacing: .04em;
  box-shadow: 0 0 0 1px rgba(0,0,0,.03);
  transition: transform 1.05s cubic-bezier(.2, .8, .2, 1) .5s;
}
.letter i { color: var(--gold); font-style: italic; }
.letter span { opacity: .9; }
.opening .letter { transform: translateY(-78%); }
.env-front {
  position: absolute; inset: 0; z-index: 3; border-radius: 3px;
  background: #F3EBDD var(--noise);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}
.env-front::before, .env-front::after { content: ""; position: absolute; inset: 0; }
.env-front::before { background: linear-gradient(100deg, rgba(120, 90, 50, .07), transparent 60%); clip-path: polygon(0 0, 50% 56%, 0 100%); }
.env-front::after { background: linear-gradient(260deg, rgba(120, 90, 50, .07), transparent 60%); clip-path: polygon(100% 0, 50% 56%, 100% 100%); }
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 60%; z-index: 4;
  background: linear-gradient(180deg, #EEE4D4, #E6DAC6) ;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform .7s cubic-bezier(.4, 0, .2, 1) .15s, z-index 0s .5s;
}
.opening .env-flap { transform: rotateX(180deg); z-index: 1; }
.seal {
  position: absolute; left: 50%; top: 60%; z-index: 5; width: 68px; height: 68px; margin: -34px 0 0 -34px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #9C4740 0%, #7A2C27 45%, #5C1E1A 100%);
  box-shadow: 0 3px 6px rgba(60, 15, 10, .35), inset 0 0 0 5px rgba(0,0,0,.08), inset 0 0 0 7px rgba(255,255,255,.06);
  display: grid; place-items: center;
  font: 500 17px/1 var(--serif); letter-spacing: .06em; color: #E5C891;
  transition: transform .45s ease, opacity .35s ease;
}
.seal::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #8E3E38, #63211C);
  z-index: -1;
  clip-path: polygon(50% 0, 61% 4%, 72% 2%, 80% 10%, 91% 13%, 94% 25%, 100% 35%, 97% 47%, 100% 58%, 94% 68%, 93% 80%, 83% 86%, 76% 96%, 64% 96%, 53% 100%, 42% 96%, 30% 98%, 22% 89%, 10% 85%, 7% 73%, 0 63%, 3% 51%, 0 39%, 6% 29%, 8% 17%, 19% 12%, 27% 3%, 39% 4%);
}
.opening .seal { transform: scale(1.25) rotate(-12deg); opacity: 0; }

/* ---------- Page ---------- */
main { max-width: 560px; margin: 0 auto; padding: 0 28px; }
main > section { padding: 76px 0; border-bottom: 1px solid var(--line); text-align: center; }
main > section:last-of-type { border-bottom: 0; }
h2 { font: 300 40px/1.1 var(--serif); margin-bottom: 22px; letter-spacing: .01em; }
p + p { margin-top: 12px; }
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

.hero {
  min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-bottom: 0 !important; position: relative;
}
.opened .hero > * { animation: rise 1.2s cubic-bezier(.2, .8, .2, 1) both; }
.opened .hero > :nth-child(2) { animation-delay: .15s; }
.opened .hero > :nth-child(3) { animation-delay: .3s; }
.opened .hero > :nth-child(4) { animation-delay: .4s; }
.opened .hero > :nth-child(5) { animation-delay: .7s; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }
.kicker { font: 500 12px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); }
.names { font: 300 clamp(64px, 19vw, 96px)/.95 var(--serif); margin: 34px 0 30px; display: flex; flex-direction: column; align-items: center; }
.names i { font: italic 300 .62em/1.1 var(--serif); color: var(--gold); margin: 6px 0; }
.date { font: 400 25px/1 var(--serif); letter-spacing: .14em; font-variant-numeric: lining-nums; }
.date b { color: var(--gold); font-weight: 400; margin: 0 .25em; }
.sub { font: italic 300 20px/1 var(--serif); color: var(--ink-2); margin-top: 14px !important; }
.scroll-line { position: absolute; bottom: 30px; width: 1px; height: 54px; background: linear-gradient(var(--ink-2), transparent); opacity: .5; animation: drip 2.4s ease-in-out infinite; }
@keyframes drip { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

.greet { font: italic 300 36px/1.15 var(--serif); margin-bottom: 20px; }
.letter-text p { font-size: 17px; color: var(--ink); max-width: 420px; margin-left: auto; margin-right: auto; }
.sign { font: italic 300 24px/1 var(--serif) !important; color: var(--gold); margin-top: 26px !important; }

.label { font: 500 12px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 24px; }
.cd { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 400px; margin: 0 auto; }
.cd div { display: flex; flex-direction: column; align-items: center; }
.cd div + div { border-left: 1px solid var(--line); }
.cd b { font: 300 46px/1 var(--serif); font-variant-numeric: tabular-nums lining-nums; }
.cd span { font-size: 12px; color: var(--ink-2); margin-top: 8px; }

.program ol { list-style: none; text-align: left; max-width: 420px; margin: 0 auto; }
.program li { display: grid; grid-template-columns: 82px 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.program li:first-child { border-top: 0; }
.program time { font: 400 26px/1.1 var(--serif); color: var(--gold); font-variant-numeric: tabular-nums lining-nums; }
.program b { display: block; font-weight: 600; font-size: 16px; }
.program span { color: var(--ink-2); font-size: 15px; }

.place-name { font: 400 28px/1.2 var(--serif); }
.place-addr { color: var(--ink-2); margin-bottom: 26px !important; }
.note { font-size: 14px; color: var(--ink-2); margin-top: 22px !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 50px; padding: 0 28px;
  border: 1px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink);
  font: 500 15px/1 var(--sans); letter-spacing: .02em; text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-solid { background: var(--ink); color: var(--paper); width: 100%; margin-top: 28px; }
.btn-solid:hover { background: #000; }

.swatches { list-style: none; display: flex; justify-content: center; gap: 22px; margin-top: 28px; flex-wrap: wrap; }
.swatches li { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); width: 62px; text-align: center; line-height: 1.25; }
.swatches i { width: 52px; height: 52px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

.details { text-align: left !important; }
.details h2 { text-align: center; }
.detail { max-width: 420px; margin: 0 auto; padding: 18px 0; border-top: 1px solid var(--line); }
.detail:first-of-type { border-top: 0; }
.detail b { display: block; font: 400 24px/1.2 var(--serif); margin-bottom: 6px; }
.detail p { color: var(--ink-2); }

.lead { color: var(--ink-2); margin-bottom: 30px; }
#rsvp { text-align: left; max-width: 420px; margin: 0 auto; }
fieldset { border: 0; }
.choice { display: grid; gap: 10px; }
.choice label { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: flex; align-items: center; height: 56px; padding: 0 20px 0 52px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.45); font-weight: 500; transition: border-color .15s, background .15s; }
.choice span::before { content: ""; position: absolute; left: 20px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--ink-2); }
.choice input:checked + span { border-color: var(--ink); background: #fff; }
.choice input:checked + span::before { border: 6px solid var(--ink); }
.choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.when-yes { overflow: hidden; transition: opacity .3s; }
#rsvp.is-no .when-yes { display: none; }
.q { font-weight: 600; margin: 28px 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; }
.chips span { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; font-size: 15px; background: rgba(255,255,255,.45); transition: all .15s; }
.chips input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.field { display: block; margin-top: 22px; }
.field > span { display: block; font-weight: 600; margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.6);
  font: 400 16px/1.4 var(--sans); color: var(--ink); padding: 14px 16px; outline: none; appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: right 20px center, right 15px center; background-size: 5px 5px; background-repeat: no-repeat; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); background: #fff; }
.done { padding: 10px 0; }
.done-big { font: italic 300 52px/1 var(--serif); color: var(--gold); margin-bottom: 14px; }
.link { margin-top: 20px; background: none; border: 0; color: var(--ink-2); font: 500 14px var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

footer { text-align: center; padding: 60px 0 calc(64px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.foot-names { font: 300 34px/1 var(--serif); margin-top: 40px; }
.foot-names i { color: var(--gold); }
.foot-q { font-size: 14px; color: var(--ink-2); margin-top: 16px !important; }
.foot-q a { color: var(--ink); }

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

.choice.need span { border-color: var(--wine); }
