:root {
  --sage: #b9c6ae;
  --sage-deep: #93a68c;
  --paper: #f1f3e9;
  --ink: #2e4a3b;
  --gold: #b8913f;
  --gold-text: #7a5c1e;
  --error: #8f2f2a;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --script: "Birthstone", "Snell Roundhand", "Segoe Script", cursive;
  --arch: min(calc(50vw - 16px), 270px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  background:
    radial-gradient(90vmax 70vmax at 0% 0%, var(--sage-deep), transparent 70%),
    radial-gradient(90vmax 70vmax at 100% 100%, var(--sage-deep), transparent 70%),
    var(--sage);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-variant-numeric: lining-nums;
  line-height: 1.5;
}

.card {
  position: relative;
  width: 100%;
  max-width: 540px;
  padding: calc(var(--arch) * 0.52) 28px 44px;
  background: var(--paper);
  border: 1.5px solid var(--gold);
  border-radius: var(--arch) var(--arch) 4px 4px;
  box-shadow: 0 18px 50px rgb(46 74 59 / 0.18);
  text-align: center;
}

.card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgb(184 145 63 / 0.45);
  border-radius: calc(var(--arch) - 8px) calc(var(--arch) - 8px) 2px 2px;
  pointer-events: none;
}

.eyebrow {
  display: block;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.names {
  margin: 12px 0 14px;
  font-family: var(--script);
  font-size: clamp(4rem, 19vw, 5.75rem);
  font-weight: 400;
  line-height: 0.95;
}

.amp {
  display: block;
  font-size: 0.6em;
  line-height: 0.9;
  color: var(--gold-text);
}

.invite {
  margin: 0;
  font-style: italic;
}

.date {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 16px;
  max-width: 340px;
  margin: 30px auto 24px;
}

.date-side {
  padding: 8px 0;
  border-block: 1px solid var(--gold);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.date-day {
  font-size: 3.25rem;
  font-weight: 500;
  line-height: 1;
  color: var(--gold-text);
}

.date-year {
  grid-column: 1 / -1;
  margin-top: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
}

.date-time {
  grid-column: 1 / -1;
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 500;
}

.venue {
  font-style: normal;
}

.venue a {
  display: inline-block;
  margin-top: 4px;
  color: inherit;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.button {
  appearance: none;
  min-height: 48px;
  padding: 12px 44px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.button:hover { background: #1f3529; }
.button:disabled { opacity: 0.65; cursor: progress; }

.rsvp-open { margin-top: 30px; }

.deadline {
  margin: 12px 0 0;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--gold-text);
}

.notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 34px 0 0;
  padding-top: 26px;
  border-top: 1px solid rgb(184 145 63 / 0.45);
  font-size: 0.95rem;
}

.notes dt {
  margin-bottom: 4px;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-text);
}

.notes dd { margin: 0; }

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

dialog {
  width: min(100% - 32px, 440px);
  max-height: calc(100dvh - 32px);
  padding: 34px 28px 30px;
  overflow-y: auto;
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}

dialog::backdrop { background: rgb(46 74 59 / 0.55); }

dialog h2 {
  margin: 0 0 22px;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-align: center;
}

.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover { background: rgb(46 74 59 / 0.08); }

.field {
  min-width: 0;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.field label,
.field legend {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  font-weight: 500;
}

input[type="text"],
input[type="number"],
textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--sage-deep);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 1rem;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field .choice {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.choice input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--sage-deep);
  border-radius: 6px;
  background: #fff;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.choice input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-error {
  margin: 0 0 16px;
  color: var(--error);
  font-size: 0.95rem;
}

#rsvp-send { width: 100%; }

.thanks {
  text-align: center;
  outline: none;
}

.thanks p { margin: 0 0 24px; }

.thanks .thanks-title {
  margin-bottom: 6px;
  font-size: 1.2rem;
  font-weight: 500;
}

@media (max-width: 400px) {
  .card { padding-inline: 16px; }
  .eyebrow { font-size: 0.68rem; letter-spacing: 0.14em; }
  .invite, .venue a { font-size: 0.92rem; }
  .notes { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: rise 0.2s ease-out; }
  dialog[open]::backdrop { animation: fade 0.2s ease-out; }
}

@media (prefers-reduced-motion: reduce) {
  .button, .choice span { transition: none; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
