:root {
  --ivory: #faf7f1;
  --paper: #f3eee3;
  --ink: #1f3b33;
  --ink-soft: #46594f;
  --gold: #a8834a;
  --gold-text: #7f6130;
  --line: #d9ccb2;
  --band: #1f3b33;
  --band-ink: #f4efe3;
  --band-soft: #c9d3cb;
  --error: #9b2c1f;

  --script: "Great Vibes", cursive;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;

  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6.5rem;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.125rem, 1.05rem + .3vw, 1.25rem);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }

.script { font-family: var(--script); font-weight: 400; }

.visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: var(--space-2); top: -4rem; z-index: 10;
  background: var(--ink); color: var(--ivory); padding: .6rem 1rem;
  font-family: var(--sans); font-size: .875rem; text-decoration: none;
}
.skip:focus { top: var(--space-2); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: .85rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--ivory) 92%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, box-shadow .3s ease;
  font-family: var(--sans); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase;
}
.topbar.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 18px -14px rgb(31 59 51 / .35); }
.topnav { display: flex; gap: clamp(1rem, 3vw, 2.25rem); }
.topnav a { text-decoration: none; color: var(--ink-soft); padding: .35rem 0; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.topnav a:hover { color: var(--ink); border-bottom-color: var(--gold); }

.lang { display: flex; align-items: center; gap: .35rem; color: var(--line); }
.lang button {
  font: inherit; letter-spacing: inherit; background: none; border: 0; cursor: pointer;
  color: var(--ink-soft); padding: .45rem .5rem; min-width: 2.75rem; min-height: 2.5rem;
  border-bottom: 1px solid transparent;
}
.lang button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--gold); font-weight: 600; }
.lang button:hover { color: var(--ink); }

/* Ornamental rule */
.rule { display: flex; align-items: center; justify-content: center; gap: .75rem; width: min(18rem, 70%); margin: var(--space-3) auto; color: var(--gold); }
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .7; }
.rule span { width: .45rem; height: .45rem; transform: rotate(45deg); border: 1px solid currentColor; }
.rule-sm { width: min(11rem, 50%); margin: var(--space-2) auto var(--space-3); }
.rule-light { color: #c9a96b; }

/* Hero */
.hero {
  min-height: calc(100svh - 3.6rem);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: var(--space-5) var(--space-3) var(--space-5);
  position: relative;
  isolation: isolate;
}
.hero::before {
  content: ""; position: absolute; inset: clamp(.75rem, 2.5vw, 1.75rem); z-index: -1;
  border: 1px solid var(--line);
  outline: 1px solid var(--line); outline-offset: -7px;
  pointer-events: none;
}

.crest { width: clamp(4.5rem, 10vw, 6rem); color: var(--gold); margin-bottom: var(--space-3); }
.crest svg { display: block; width: 100%; height: auto; }
.crest text { font-family: var(--serif); font-size: 30px; fill: var(--ink); letter-spacing: .04em; }

.hero-lede, .hero-invite {
  font-family: var(--sans); font-size: .8125rem; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft);
}
.names {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: .25em;
  margin: var(--space-2) 0 .25rem;
  font-size: clamp(4rem, 2.2rem + 9vw, 8rem); line-height: 1.05;
}
.names .script { font-size: 1em; color: var(--ink); }
.amp { font-family: var(--serif); font-style: italic; font-size: .5em; color: var(--gold); padding: 0 .1em; }
.fullnames { font-family: var(--serif); font-size: clamp(1.125rem, 1rem + .5vw, 1.375rem); letter-spacing: .08em; color: var(--ink-soft); margin-bottom: var(--space-3); }
.hero-date { line-height: 1.3; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem); letter-spacing: .02em; }
.hero-place { font-style: italic; font-size: clamp(1.25rem, 1.1rem + .6vw, 1.5rem); color: var(--ink-soft); }
.countdown { margin-top: var(--space-3); font-family: var(--sans); font-size: .875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-text); min-height: 1.4em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: var(--space-4);
  min-height: 3.25rem; padding: .9rem 2.4rem;
  background: var(--ink); color: var(--ivory);
  border: 1px solid var(--ink); border-radius: 0;
  font-family: var(--sans); font-size: .875rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px rgb(201 169 107 / .7);
  transition: background .25s var(--ease-out), box-shadow .25s var(--ease-out), transform .25s var(--ease-out);
}
.btn:hover { background: #18302a; transform: translateY(-1px); box-shadow: inset 0 0 0 3px #18302a, inset 0 0 0 4px rgb(201 169 107 / 1), 0 10px 22px -14px rgb(31 59 51 / .6); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

/* Hero entrance: the one authored moment */
@media (prefers-reduced-motion: no-preference) {
  .js .hero > * { animation: rise 1.4s var(--ease-out) both; }
  .js .hero > :nth-child(1) { animation-delay: .05s; }
  .js .hero > :nth-child(2) { animation-delay: .2s; }
  .js .hero > :nth-child(3) { animation: ink-in 1.8s var(--ease-out) .3s both; }
  .js .hero > :nth-child(4) { animation-delay: .7s; }
  .js .hero > :nth-child(5) { animation-delay: .8s; }
  .js .hero > :nth-child(n+6) { animation-delay: .95s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes ink-in { from { opacity: 0; filter: blur(8px); letter-spacing: .04em; } }

/* Note */
.note {
  max-width: 40rem; margin: 0 auto; text-align: center;
  padding: var(--space-6) var(--space-3) var(--space-5);
}
.note-text { font-size: clamp(1.25rem, 1.1rem + .6vw, 1.5rem); line-height: 1.55; }
.note-sign { margin-top: var(--space-3); font-size: clamp(2rem, 1.6rem + 1.5vw, 2.6rem); color: var(--gold-text); }

/* Details */
.details { padding: var(--space-5) var(--space-3) var(--space-6); background: var(--paper); text-align: center; }
.section-title { font-family: var(--script); font-size: clamp(3rem, 2.2rem + 3.5vw, 4.5rem); line-height: 1.1; }

.events {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-4);
  max-width: 56rem; margin: var(--space-4) auto 0; text-align: center;
}
.event-divider { width: 1px; background: var(--line); }
.event-name { font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem); letter-spacing: .01em; }
.event-kind { font-style: italic; color: var(--ink-soft); margin-top: .15rem; }
.facts { margin: var(--space-3) 0 0; display: grid; gap: var(--space-2); }
.facts div { display: grid; gap: .1rem; }
.facts dt { font-family: var(--sans); font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-text); }
.facts dd { margin: 0; }
.tba { font-style: italic; color: var(--ink-soft); }
.details-foot { margin-top: var(--space-5); font-style: italic; color: var(--ink-soft); font-size: 1rem; }

/* Vietnam */
.vietnam {
  background: var(--band); color: var(--band-ink);
  padding: var(--space-6) var(--space-3);
  text-align: center;
  position: relative; overflow: hidden;
}
.vietnam::before {
  content: ""; position: absolute; inset: clamp(.75rem, 2.5vw, 1.75rem);
  border: 1px solid rgb(201 169 107 / .45);
  outline: 1px solid rgb(201 169 107 / .25); outline-offset: -7px;
  pointer-events: none;
}
.vietnam-inner { max-width: 38rem; margin: 0 auto; position: relative; }
.vietnam-year { font-family: var(--serif); font-size: clamp(4.5rem, 3rem + 7vw, 7.5rem); line-height: 1; letter-spacing: .06em; color: #c9a96b; }
.vietnam-title { margin-top: var(--space-2); font-family: var(--script); font-size: clamp(2.4rem, 1.8rem + 2.6vw, 3.5rem); line-height: 1.15; }
.vietnam-body { font-size: clamp(1.15rem, 1.05rem + .4vw, 1.35rem); }
.vietnam-tba { margin-top: var(--space-3); font-family: var(--sans); font-size: .875rem; letter-spacing: .06em; color: var(--band-soft); }

/* RSVP */
.rsvp { padding: var(--space-6) var(--space-3); text-align: center; }
.rsvp-intro { color: var(--ink-soft); }
.rsvp-form { max-width: 32rem; margin: var(--space-4) auto 0; text-align: left; display: grid; gap: var(--space-3); }
.field { display: grid; gap: .45rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label:not(.choice), .field legend {
  font-family: var(--sans); font-size: .8125rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
  padding: 0; margin-bottom: .45rem;
}
.optional { text-transform: none; letter-spacing: 0; color: var(--ink-soft); }
input[type="text"], select, textarea {
  width: 100%; font: inherit; font-size: 1.125rem; color: var(--ink);
  background: #fffdf8; border: 1px solid var(--line); border-radius: 0;
  padding: .75rem .9rem; min-height: 3rem;
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 5.5rem; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 1.3rem) 55%, calc(100% - .95rem) 55%;
  background-size: .35rem .35rem; background-repeat: no-repeat;
  max-width: 8rem;
}
input[type="text"]:hover, select:hover, textarea:hover { border-color: #c6b48f; }
input[type="text"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgb(168 131 74 / .2); }
::placeholder { color: #75806f; opacity: 1; }
[aria-invalid="true"] { border-color: var(--error) !important; }

.choice { display: flex; align-items: center; gap: .75rem; min-height: 2.75rem; cursor: pointer; font-size: 1.15rem; }
.choice input { appearance: none; width: 1.25rem; height: 1.25rem; margin: 0; border: 1px solid var(--gold); border-radius: 50%; display: grid; place-items: center; flex: none; cursor: pointer; background: #fffdf8; }
.choice input::after { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform .2s var(--ease-out); }
.choice input:checked::after { transform: scale(1); }
.attend[aria-invalid="true"] .choice input { border-color: var(--error); }

.error { font-family: var(--sans); font-size: .875rem; color: var(--error); }
.btn-submit { margin-top: var(--space-2); width: 100%; }
.form-status { font-family: var(--sans); font-size: .9rem; color: var(--error); text-align: center; min-height: 1.2em; }

[data-when-attending][hidden] { display: none; }

.rsvp-thanks { max-width: 32rem; margin: var(--space-4) auto 0; }
.rsvp-thanks:focus { outline: none; }
.thanks-script { font-size: clamp(3rem, 2.4rem + 2.6vw, 4.25rem); color: var(--gold-text); line-height: 1.1; }
.rsvp-thanks p + p { margin-top: var(--space-1); }
.link-btn { margin-top: var(--space-3); background: none; border: 0; padding: .5rem; font-family: var(--sans); font-size: .875rem; letter-spacing: .08em; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }

/* Footer */
.footer { padding: var(--space-5) var(--space-3) var(--space-5); text-align: center; border-top: 1px solid var(--line); }
.crest-sm { width: 3.5rem; margin: 0 auto var(--space-2); }
.footer-names { letter-spacing: .06em; }
.footer-date { font-family: var(--sans); font-size: .8125rem; letter-spacing: .18em; color: var(--ink-soft); margin-top: .25rem; }

/* Mobile */
@media (max-width: 720px) {
  .events { grid-template-columns: 1fr; gap: var(--space-4); }
  .event-divider { width: 4rem; height: 1px; margin: 0 auto; }
  .topnav a:not([href="#rsvp"]) { display: none; }
  .hero { padding-top: var(--space-4); }
  .names { font-size: clamp(3rem, 1rem + 10vw, 4rem); }
}
@media (max-width: 380px) {
  .topbar { letter-spacing: .1em; }
}
