/* ─────────────────────────────────────────
   SECTION — RSVP PAGE (rsvp.html), option C
   A photo on the left (sticky on desktop) with the deadline and a countdown;
   the form on the right. One set of fields per person (.rsvp-person);
   "Add another person" (js/rsvp.js) adds the next set.

   Choices are real radio buttons and checkboxes (keyboard + screen readers),
   drawn as options: the picked one is filled clay with a cream tick, the
   others stay outlined; the focused one gets a clay ring.
   Text styles live in foundations/text-styles.css.
───────────────────────────────────────── */

/* a long form: the page scrolls freely (the desktop section snap in
   layout.css would jump past the fields) */
html:has(.rsvp-page) { scroll-snap-type: none; }

.rsvp-page {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  min-height: 100svh;
  background: var(--bg);
}

/* ── the photo ── */
.rsvp-photo {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  color: var(--on-inverse);
}

.rsvp-photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
}

.rsvp-photo::after {            /* clay wash so the cream text always reads */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(110, 48, 22, 0.15) 30%, rgba(110, 48, 22, 0.85) 100%);
}

.rsvp-photo-text {
  position: absolute;
  left: 48px;
  right: 48px;
  bottom: 56px;
  z-index: 1;
}

.rsvp-photo-eyebrow { color: var(--on-inverse-muted); }
.rsvp-photo-title { margin-top: 10px; color: var(--on-inverse); }

.rsvp-photo-sub {
  margin-top: 16px;
  max-width: 40ch;
  color: var(--on-inverse-muted);
}

.rsvp-count {
  margin-top: 24px;
  display: flex;
  align-items: baseline;
  gap: 0.4em;
}

.rsvp-count-label { color: var(--cream-200); }

/* ── the form ── */
.rsvp-main {
  padding: clamp(110px, 14svh, 140px) clamp(24px, 6vw, 96px) 80px;
}

.rsvp-inner { max-width: 640px; }

.rsvp-form-title { color: var(--text-primary); }

.rsvp-form { margin-top: 28px; }

.rsvp-person {
  position: relative;
  margin: 0 0 24px;
  padding: 28px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  display: grid;
  gap: 24px;
  min-width: 0;
}

.rsvp-person.is-new { animation: rsvp-in 400ms var(--ease) both; }

@keyframes rsvp-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.rsvp-person-title {
  float: left;                  /* keeps the legend inside the box */
  width: 100%;
  padding: 0;
  color: var(--text-primary);
}

.rsvp-remove {
  position: absolute;
  top: 28px;
  right: 28px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline dashed;
  text-underline-offset: 4px;
}

.rsvp-remove:hover { color: var(--text-primary); }

.rsvp-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.rsvp-field--short { max-width: 140px; }
.rsvp-field--message { margin-top: 8px; }

.rsvp-label { color: var(--text-muted); }

.rsvp-optional {
  text-transform: none;
  letter-spacing: 0;
}

.rsvp-input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text-primary);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.rsvp-input:focus {
  outline: none;
  border-color: var(--border);
  box-shadow: 0 0 0 3px var(--hairline);
}

.rsvp-input[aria-invalid="true"] { border-color: var(--border); border-width: 2px; }

textarea.rsvp-input { resize: vertical; }

.rsvp-field-error {
  color: var(--border);
  font-weight: 500;
}

/* ── choices ── */
.rsvp-group {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.rsvp-group > legend { padding: 0; margin-bottom: 10px; }

.rsvp-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rsvp-options--cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rsvp-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 200ms var(--ease), color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.rsvp-option:hover { background: var(--surface); }

/* the real input: invisible but still there for keyboard + screen readers */
.rsvp-option-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

/* the drawn control: a circle for one-of, a rounded square for several */
.rsvp-option-mark {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
}

.rsvp-option-input[type="checkbox"] + .rsvp-option-mark { border-radius: 6px; }

/* picked: clay fill, cream text, cream tick */
.rsvp-option:has(.rsvp-option-input:checked) {
  background: var(--inverse);
  border-color: var(--inverse);
  color: var(--on-inverse);
}

.rsvp-option-input:checked + .rsvp-option-mark {
  border-color: var(--on-inverse);
  background: var(--on-inverse);
}

.rsvp-option-input:checked + .rsvp-option-mark::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--inverse);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* keyboard focus: a clear ring around the whole option */
.rsvp-option:has(.rsvp-option-input:focus-visible) {
  outline: 2px solid var(--border);
  outline-offset: 3px;
}

/* the day cards */
.rsvp-option--card {
  display: flex;
  align-items: flex-start;
  border-radius: 16px;
  padding: 16px;
  border-color: var(--hairline);
}

.rsvp-option--card .rsvp-option-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* the tick box sits on the right, so the day names line up on the left edge */
.rsvp-option--card .rsvp-option-mark { order: 1; }

.rsvp-option--card .rsvp-option-sub { text-transform: none; letter-spacing: 0; }

/* child: age + note */
.rsvp-child {
  display: grid;
  gap: 12px;
}

.rsvp-note {
  padding: 12px 16px;
  border-left: 2px solid var(--clay-300);
  color: var(--text-secondary);
}

/* the follow-up for a picked day: indented under the days, with a thin rule */
.rsvp-sub {
  margin-top: -8px;
  padding-left: 16px;
  border-left: 2px solid var(--clay-300);
}

.rsvp-child[hidden],
.rsvp-days[hidden],
.rsvp-sub[hidden] { display: none; }

/* ── errors ── */
.rsvp-errors {
  margin-bottom: 24px;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 16px;
  color: var(--text-primary);
}

.rsvp-errors ul { margin: 8px 0 0; padding-left: 18px; }
.rsvp-errors a { color: var(--border); }

/* ── spam trap ── */
.rsvp-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── buttons: the site's .text-link + .btn.btn--light (components/) ── */
.rsvp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
  margin-top: 32px;
}

.rsvp-add {                     /* a <button> wearing .text-link */
  border-width: 0 0 1px;
  border-style: dashed;
  background: none;
  cursor: pointer;
}

.rsvp-add:focus-visible,
.rsvp-remove:focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 3px;
}

.rsvp-send[disabled] { opacity: 0.6; cursor: progress; }

/* ── thank you ── */
.rsvp-done { padding-top: 24px; }
.rsvp-done:focus { outline: none; }
.rsvp-done-hand { color: var(--border); }
.rsvp-done-title { margin-top: 8px; color: var(--text-primary); }

.rsvp-done-list {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--text-primary);
}

.rsvp-done-text {
  margin-top: 24px;
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .rsvp-person.is-new { animation: none; }
}


/* responsive — tablet: photo on top, form below */
@media (max-width: 1024px) {
  .rsvp-page { grid-template-columns: 1fr; }

  .rsvp-photo {
    position: relative;
    height: 62svh;
    min-height: 420px;
  }

  .rsvp-main { padding-top: 56px; }
  .rsvp-inner { max-width: 680px; margin: 0 auto; }
}


/* responsive — mobile */
@media (max-width: 640px) {
  .rsvp-photo-text { left: 20px; right: 20px; bottom: 32px; }
  .rsvp-main { padding: 40px 20px 64px; }
  .rsvp-person { padding: 20px; }
  .rsvp-remove { top: 20px; right: 20px; }
  .rsvp-options--cards { grid-template-columns: 1fr; }
  .rsvp-actions {               /* "Add another person" above a full-width "Send RSVP" */
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  .rsvp-add { align-self: center; }
}
