:root {
  --paper: #FBF8F2;
  --paper-2: #F4EEE3;
  --ink: #2B2622;
  --muted: #7A6F64;
  --gold: #A88B5A;
  --gold-soft: #CDB88F;
  --line: #E4DACB;
  --wine: #6B2D35;
  --wine-dark: #4E1F26;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --script: "Pinyon Script", "Snell Roundhand", cursive;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-align: center;
}
body.locked { overflow: hidden; }

.script { font-family: var(--script); font-weight: 400; }
.small-caps {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--serif);
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 0.95rem 2.2rem;
  border: 1px solid var(--gold);
  background: transparent;
  cursor: pointer;
  transition: background .3s, color .3s;
}
.btn:hover { background: var(--gold); color: var(--paper); }
.btn-solid { background: var(--ink); color: var(--paper); border-color: var(--ink); width: 100%; }
.btn-solid:hover { background: var(--wine); border-color: var(--wine); }
.btn[disabled] { opacity: .6; cursor: wait; }
.link-btn {
  background: none; border: 0; font: inherit; color: var(--muted);
  text-decoration: underline; text-underline-offset: 4px; cursor: pointer; margin-top: 1rem;
}

/* ── Envelope intro ──────────────────────── */
#intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #F6F0E5 0%, #E9DFCF 100%);
  transition: opacity .9s ease .2s, visibility 0s linear 1.1s;
}
#intro.gone { opacity: 0; visibility: hidden; }
.intro-hint {
  margin-top: 2.2rem; font-style: italic; color: var(--muted);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .45; } }

.envelope {
  --w: min(84vw, 420px);
  --h: calc(var(--w) * 0.64);
  position: relative; width: var(--w); height: var(--h);
  border: 0; background: none; cursor: pointer; perspective: 1200px; font: inherit; color: inherit;
}
.env-back, .env-front, .env-flap {
  position: absolute; inset: 0; display: block;
}
.env-back { background: #E6DAC6; border-radius: 4px; box-shadow: 0 25px 50px -20px rgba(60,40,20,.35); }
.env-front {
  z-index: 3;
  background:
    linear-gradient(to top right, #EFE5D4 49.6%, transparent 50%) left / 50.5% 100% no-repeat,
    linear-gradient(to top left, #EFE5D4 49.6%, transparent 50%) right / 50.5% 100% no-repeat,
    #E3D6BF;
  border-radius: 4px;
}
.env-front::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 58%;
  background: linear-gradient(to top, #F2E9DA, #ECE1CE);
  clip-path: polygon(0 100%, 50% 8%, 100% 100%);
}
.env-flap {
  z-index: 4; height: 58%;
  background: linear-gradient(to bottom, #E2D4BC, #EADFCB);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform .8s cubic-bezier(.6,.05,.3,1), z-index 0s linear .4s;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.08));
}
.env-card {
  position: absolute; z-index: 2; left: 6%; right: 6%; top: 8%; bottom: 6%;
  background: var(--paper); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .2rem;
  padding-top: 8%;
  transition: transform 1s cubic-bezier(.3,.7,.2,1) .55s;
}
.env-names { font-size: clamp(1.6rem, 6vw, 2.3rem); color: var(--ink); }
.seal {
  position: absolute; z-index: 5; left: 50%; top: 58%;
  width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8A3B45, var(--wine) 55%, var(--wine-dark));
  box-shadow: 0 3px 8px rgba(60,10,20,.35), inset 0 0 0 4px rgba(255,255,255,.06), inset 0 0 0 6px rgba(0,0,0,.12);
  display: flex; align-items: center; justify-content: center;
  color: #E9D9B8; font-family: var(--serif); font-size: 1.05rem; letter-spacing: .04em; font-style: italic;
  transition: transform .5s ease, opacity .4s ease;
}
.envelope:hover .seal { transform: scale(1.06); }
.envelope.open .seal { transform: scale(.6); opacity: 0; }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .env-card { transform: translateY(-62%); }

/* ── Hero ────────────────────────────────── */
.hero {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 1.25rem;
  background:
    radial-gradient(ellipse at top, rgba(205,184,143,.18), transparent 60%),
    var(--paper);
}
.frame {
  position: relative;
  width: min(100%, 640px);
  padding: 4.5rem 2rem 4rem;
  border: 1px solid var(--gold-soft);
  outline: 1px solid var(--gold-soft); outline-offset: 7px;
}
.names {
  font-size: clamp(3.4rem, 13vw, 6.2rem);
  line-height: 1.05;
  margin: 1.4rem 0 1.2rem;
  color: var(--ink);
  display: flex; flex-direction: column; align-items: center;
}
.names .amp { font-size: .8em; color: var(--gold); line-height: 1; margin: .1em 0; }
.invite-line { font-style: italic; color: var(--muted); font-size: 1.15rem; }
.vine { color: var(--gold); width: 220px; margin: 1.8rem auto; }
.vine svg { width: 100%; height: auto; display: block; }
.hero-date { font-size: 1.55rem; font-weight: 500; letter-spacing: .04em; }
.hero-place { margin: .4rem 0 2.4rem; }

/* fade-up */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 1s ease, transform 1s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ── Sections ────────────────────────────── */
main { padding: 0 1.25rem; }
.note { max-width: 560px; margin: 5rem auto; font-size: 1.3rem; font-style: italic; color: var(--muted); }
.section-title {
  font-weight: 400; font-size: clamp(1.9rem, 5vw, 2.5rem); letter-spacing: .02em; margin-bottom: 2.5rem;
}
.section-title::after {
  content: ""; display: block; width: 44px; height: 1px; background: var(--gold); margin: 1rem auto 0;
}
.details { max-width: 920px; margin: 0 auto 6rem; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.detail { padding: 1rem 1.5rem; }
.detail + .detail { border-left: 1px solid var(--line); }
.detail-main { font-size: 1.35rem; margin-top: .6rem; }
.detail-sub { color: var(--muted); font-size: 1rem; }
.tbc { font-style: italic; color: var(--muted); }
.map-link {
  display: inline-block; margin-top: .6rem; color: var(--gold); font-size: .95rem;
  text-decoration: none; border-bottom: 1px solid var(--gold-soft);
}

/* ── RSVP card ───────────────────────────── */
.rsvp { padding: 1rem 0 6rem; }
.reply-card {
  max-width: 520px; margin: 0 auto;
  background: #FFFDF9;
  padding: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px -35px rgba(60,40,20,.35);
}
.reply-inner { border: 1px solid var(--gold-soft); padding: 3rem 2rem 2.5rem; }
.rsvp .section-title { font-style: italic; font-size: clamp(1.6rem, 5vw, 2.1rem); margin-bottom: 1rem; }
.rsvp-by { color: var(--muted); font-size: 1rem; margin-bottom: 2rem; min-height: 1em; }

form { text-align: left; }
.field { display: block; margin-bottom: 1.6rem; }
.field span {
  display: block; text-transform: uppercase; letter-spacing: .22em; font-size: .68rem;
  font-weight: 600; color: var(--muted); margin-bottom: .2rem;
}
.field input {
  width: 100%; font: inherit; font-size: 1.2rem; color: var(--ink);
  border: 0; border-bottom: 1px solid var(--line); background: transparent;
  padding: .45rem 0; outline: none; border-radius: 0; transition: border-color .25s;
}
.field input:focus { border-color: var(--gold); }
.hp { position: absolute; left: -9999px; }

.choice { border: 0; margin: .5rem 0 1.5rem; display: grid; gap: .8rem; }
.choice label { display: flex; align-items: center; gap: .9rem; cursor: pointer; font-size: 1.2rem; font-style: italic; }
.choice input { position: absolute; opacity: 0; }
.choice .box {
  width: 20px; height: 20px; border: 1px solid var(--gold); flex: none; position: relative; transition: background .2s;
}
.choice input:checked + .box { background: var(--ink); border-color: var(--ink); }
.choice input:checked + .box::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid var(--paper); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.choice input:focus-visible + .box { outline: 2px solid var(--gold-soft); outline-offset: 3px; }
.form-error { color: var(--wine); min-height: 1.4em; font-size: 1rem; margin-bottom: .6rem; text-align: center; }

.thanks { padding: 1rem 0; }
.thanks-title { font-size: 3rem; color: var(--ink); line-height: 1.2; margin-bottom: .8rem; }
.thanks p { color: var(--muted); }

/* ── Footer ──────────────────────────────── */
footer { padding: 3rem 1rem 4rem; background: var(--paper-2); }
footer .vine { margin-top: 0; }
.footer-names { font-size: 2.4rem; margin-bottom: .3rem; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 720px) {
  body { font-size: 18px; }
  .frame { padding: 3.5rem 1.25rem 3rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail + .detail { border-left: 0; border-top: 1px solid var(--line); }
  .detail { padding: 1.6rem 1rem; }
  .reply-inner { padding: 2.4rem 1.3rem 2rem; }
}

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