:root {
  --background: #f5f0e8;
  --surface: #fdfbf7;
  --text: #2f332c;
  --text-muted: #5f645a;
  --sage: #4f6b52;
  --sage-dark: #3f5742;
  --sage-tint: #e6ece2;
  --gold: #b08a4e;
  --border: #d9d2c4;
  --danger: #9b3b32;
  --focus: #4f6b52;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

p,
h1,
h2,
dl,
dd {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--sage-dark);
  text-underline-offset: 0.18em;
}

main {
  width: min(32rem, 100%);
  margin-inline: auto;
  padding: var(--space-7) var(--space-4) var(--space-8);
}

h1,
.thanks h2 {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 500;
  line-height: 1.1;
}

.lede {
  margin-top: var(--space-2);
  margin-bottom: var(--space-6);
  color: var(--text-muted);
}

/* Invitation page */

.invite-page main.layout {
  width: min(70rem, 100%);
  padding: var(--space-4) var(--space-4) var(--space-8);
}

.card-side {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.invitation {
  width: 100%;
  max-width: 30rem;
  margin: 0;
}

.invitation img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 18px 40px -18px rgba(63, 87, 66, 0.35);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-5);
}

.jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 var(--space-7);
  border-radius: 999px;
  background: var(--sage);
  color: #fdfbf7;
  font-weight: 600;
  text-decoration: none;
}

.jump:hover {
  background: var(--sage-dark);
}

.map-link {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  font-weight: 600;
}

.reply-side {
  margin-top: var(--space-6);
  padding: var(--space-6) var(--space-5);
  background: var(--surface);
  border-radius: 8px;
  border-top: 3px solid var(--gold);
  scroll-margin-top: var(--space-4);
}

.eyebrow {
  margin-bottom: var(--space-2);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-style: italic;
}

.reply-side h1 {
  margin-bottom: var(--space-5);
}

@media (min-width: 56rem) {
  .invite-page {
    background:
      radial-gradient(60rem 40rem at 15% 10%, #fbf8f2 0%, transparent 70%),
      var(--background);
  }

  .invite-page main.layout {
    --card-w: min(30rem, calc((100vh - 7rem) * 0.719), 40vw);
    width: 100%;
    display: grid;
    grid-template-columns: var(--card-w) minmax(0, 32rem);
    justify-content: center;
    align-content: center;
    align-items: start;
    gap: var(--space-7);
    min-height: 100vh;
    padding-block: var(--space-5);
  }

  .card-side {
    position: sticky;
    top: var(--space-5);
    align-self: start;
  }

  .invitation {
    max-width: none;
  }

  .card-actions {
    margin-top: var(--space-3);
  }

  .jump {
    display: none;
  }

  .reply-side {
    margin-top: 0;
    padding: var(--space-5) var(--space-7);
    box-shadow: 0 18px 40px -24px rgba(63, 87, 66, 0.3);
  }

  .reply-side h1 {
    margin-bottom: var(--space-4);
  }

  .reply-side fieldset {
    margin-bottom: var(--space-4);
  }

  .field {
    margin-bottom: var(--space-4);
  }

  .reply-side textarea {
    min-height: 0;
  }

  .reply-side .reassure {
    margin-top: var(--space-2);
  }
}

/* Form */

fieldset {
  border: 0;
  margin: 0 0 var(--space-5);
  padding: 0;
  min-inline-size: 0;
}

legend {
  padding: 0;
  margin-bottom: var(--space-3);
  font-weight: 600;
}

.opt {
  font-weight: 400;
  color: var(--text-muted);
}

.choices {
  display: grid;
  gap: var(--space-3);
}

.choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.25rem;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.choice input {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--sage);
}

.choice:has(input:checked) {
  border-color: var(--sage);
  background: var(--sage-tint);
  font-weight: 600;
}

.choice input:focus-visible {
  outline: none;
}

.choice:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (hover: hover) {
  .choice:hover {
    border-color: var(--sage);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  min-width: 0;
}

.field label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.field-row {
  display: grid;
  gap: 0 var(--space-4);
}

.field-label {
  font-size: 0.9375rem;
  font-weight: 600;
}

#party {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
}

textarea#others {
  min-height: 0;
  resize: none;
}

.is-disabled label {
  color: var(--text-muted);
}

input:disabled,
textarea:disabled {
  border-color: var(--border);
  background: var(--background);
  color: var(--text-muted);
  cursor: not-allowed;
}

.stepper {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
}

.step {
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--sage-dark);
  font: inherit;
  font-size: 1.375rem;
  line-height: 1;
  cursor: pointer;
}

.step:hover:not(:disabled) {
  background: var(--sage-tint);
}

.step:disabled {
  color: var(--border);
  cursor: default;
}

.stepper output {
  min-width: 2.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
}

@media (min-width: 30rem) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }

  .choices {
    grid-template-columns: 1fr 1fr;
  }
}

input,
textarea,
select {
  width: 100%;
  min-height: 3rem;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--sage);
  outline-offset: 0;
}

[aria-invalid="true"] {
  border-color: var(--danger);
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
}

.error:empty {
  display: none;
}

.submit {
  width: 100%;
  min-height: 3.25rem;
  padding: var(--space-3) var(--space-6);
  border: 0;
  border-radius: 999px;
  background: var(--sage);
  color: #fdfbf7;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease;
}

@media (hover: hover) {
  .submit:hover {
    background: var(--sage-dark);
  }
}

.submit:active {
  transform: scale(0.98);
}

.submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.reassure,
.preview-note {
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.thanks {
  padding-block: var(--space-6);
  text-align: center;
}

.thanks p {
  margin-top: var(--space-3);
  color: var(--text-muted);
}

.thanks:focus {
  outline: none;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Replies page */

.admin main {
  width: min(60rem, 100%);
  padding-top: var(--space-6);
}

.admin-login main {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding-block: var(--space-6);
}

.login {
  width: 100%;
  max-width: 24rem;
  padding: var(--space-7) var(--space-6);
  border-top: 3px solid var(--gold);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 40px -24px rgba(63, 87, 66, 0.3);
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

.admin-actions form {
  margin: 0;
}

.button-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 var(--space-5);
  border: 1px solid var(--sage);
  border-radius: 999px;
  color: var(--sage-dark);
  font-weight: 600;
  text-decoration: none;
}

.button-secondary:hover {
  background: var(--sage-tint);
}

.text-btn {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.stat {
  padding: var(--space-4);
  border-radius: 8px;
  background: var(--surface);
}

.stat dt {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.stat dd {
  margin-top: var(--space-1);
  font-family: var(--font-display);
  font-size: 2.25rem;
  line-height: 1;
}

.stat-main {
  background: var(--sage);
  color: #fdfbf7;
}

.stat-main dt {
  color: #e6ece2;
}

.tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: 0 var(--space-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-current="page"] {
  border-bottom-color: var(--sage);
  color: var(--sage-dark);
}

.tab-count {
  color: var(--text-muted);
  font-weight: 400;
}

.search {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.search label {
  font-size: 0.875rem;
  font-weight: 600;
}

.guest-list {
  border-radius: 8px;
  background: var(--surface);
}

.guest {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "who status"
    "note note"
    "meta meta";
  gap: 0 var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.guest:last-child {
  border-bottom: 0;
}

.guest[hidden] {
  display: none;
}

.guest-who {
  grid-area: who;
  min-width: 0;
}

.guest-name {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.guest-others {
  margin-top: 0.125rem;
  color: var(--text);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.guest-contact {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.guest-contact a {
  color: inherit;
}

.guest-note {
  grid-area: note;
  margin-top: var(--space-2);
  padding-inline-start: var(--space-3);
  border-inline-start: 2px solid var(--gold);
  font-style: italic;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.guest-status {
  grid-area: status;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: end;
}

.status-label {
  font-weight: 600;
}

.is-yes .status-label {
  color: var(--sage-dark);
}

.is-no .status-label {
  color: var(--text-muted);
}

.status-count {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.guest-meta {
  grid-area: meta;
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.guest-meta form {
  margin: 0;
}

.remove {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--danger);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.empty {
  padding: var(--space-7) var(--space-5);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  text-align: center;
}

.empty-title {
  margin-bottom: var(--space-2);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.5rem;
}

@media (min-width: 48rem) {
  .admin main {
    padding-top: var(--space-7);
  }

  .guest {
    grid-template-columns: minmax(0, 1fr) 8rem 11rem;
    grid-template-areas:
      "who status meta"
      "note status meta";
    align-items: start;
    padding: var(--space-4) var(--space-5);
  }

  .guest-status {
    align-items: flex-start;
    text-align: start;
  }

  .guest-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    margin-top: 0;
  }

  .remove {
    min-height: 2rem;
  }
}

@media (max-width: 26rem) {
  .stat {
    padding: var(--space-3);
  }

  .stat dd {
    font-size: 1.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .choice,
  .submit {
    transition: none;
  }

  .submit:active {
    transform: none;
  }
}
