/* ============================================================
   The RSVP form.

   Hand-written, unlike site.css, which is generated from the design
   export. The markup is built by rsvp.js inside the design's RSVP card,
   so everything here borrows that card's palette: cream paper, gold
   hairlines, and the rose of the one button that matters.

   Type is not set here: every size, weight and tracking comes from the
   roles in typography.css, which name these classes directly.
============================================================ */

/* The design sets display inline on several of the blocks rsvp.js hides,
   which would otherwise beat the hidden attribute. */
#rsvp [hidden] { display: none !important; }

.rsvp-form,
.rsvp-panel {
  width: 100%;
  max-width: 440px;
  text-align: left;
  color: #342B29;
}

.rsvp-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rsvp-form label,
.rsvp-form legend,
.rsvp-label {
  display: block;
  margin: 0 0 6px;
  padding: 0;
  color: #9E5642;
}

.rsvp-form input[type="text"],
.rsvp-form input[type="email"],
.rsvp-form input[type="tel"],
.rsvp-form select,
.rsvp-form textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #C9A978;
  border-radius: 4px;
  background: #FFFEFA;
  color: #342B29;
  -webkit-appearance: none;
  appearance: none;
}

.rsvp-form textarea { resize: vertical; }

.rsvp-form ::placeholder {
  color: #9C8460;
  opacity: 1;
}

.rsvp-form select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239E5642' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.rsvp-form input:focus-visible,
.rsvp-form select:focus-visible,
.rsvp-form textarea:focus-visible,
.rsvp-submit:focus-visible,
.rsvp-link:focus-visible {
  outline: 2px solid #C25859;
  outline-offset: 2px;
}

.rsvp-form [aria-invalid="true"] { border-color: #C25859; }

/* A found invitation: the name is settled, so it stops looking editable. */
.rsvp-form input[readonly] {
  border-style: dashed;
  background: transparent;
  color: #6E5F51;
}

.rsvp-found {
  margin-top: -8px;
  color: #6E5F51;
}

.rsvp-details {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Persistent helper text between a label and its field. */
.rsvp-hint {
  margin: -2px 0 8px;
  color: #6E5F51;
}

.rsvp-error {
  margin-top: 6px;
  color: #9E4344;
}

.rsvp-send-error {
  margin: 0;
  text-align: center;
}

/* ------------------------------------------------ accept / decline */
.rsvp-reply {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.rsvp-seg {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

/* The radios stay in the accessibility tree and keep their keyboard
   behaviour; only their labels are drawn. */
.rsvp-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rsvp-form .rsvp-seg label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid #C9A978;
  border-radius: 4px;
  background: #FFFEFA;
  color: #6E5F51;
  text-align: center;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.rsvp-seg input:checked + label {
  border-color: #C25859;
  background: #C25859;
  color: #F5F0E9;
}

.rsvp-seg input:focus-visible + label {
  outline: 2px solid #C25859;
  outline-offset: 2px;
}

/* ---------------------------------------------------------- layout */
.rsvp-attending,
.rsvp-rest {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rsvp-label { margin-bottom: -8px; }

.rsvp-guests {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* One guest's three answers, kept together so a four-seat household reads as
   four blocks rather than twelve loose fields. */
.rsvp-guest {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(201, 169, 120, 0.45);
  border-radius: 3px;
  background: rgba(252, 248, 240, 0.5);
}

/* The after-party tick: the box beside its label, on a full-size tap target. */
.rsvp-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.rsvp-check input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #C25859;
  cursor: pointer;
}

.rsvp-check input:focus-visible {
  outline: 2px solid #C25859;
  outline-offset: 2px;
}

.rsvp-form .rsvp-check label {
  margin: 0;
  cursor: pointer;
}

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

/* --------------------------------------------------------- actions */
.rsvp-submit {
  align-self: center;
  min-height: 52px;
  padding: 0 40px;
  border: 0;
  border-radius: 999px;
  background: #C25859;
  color: #F5F0E9;
  box-shadow: 0 6px 18px rgba(158, 67, 68, 0.28);
  cursor: pointer;
  transition: background .25s ease, box-shadow .25s ease, transform .25s ease;
}

.rsvp-submit:hover { background: #9E4344; }
.rsvp-submit:active { transform: scale(0.98); }
.rsvp-submit:disabled { opacity: 0.6; cursor: default; }

.rsvp-panel {
  text-align: center;
  outline: none;
}

.rsvp-panel p {
  margin: 0 0 18px;
  color: #6E5F51;
}

.rsvp-thanks {
  margin: 0 0 8px;
  color: #A75858;
}

/* Set by rsvp.js when the heading is too long for one line: "Thank you,"
   above, the greeting below. */
.rsvp-thanks--split > span { display: block; }

.rsvp-link {
  padding: 6px 2px;
  border: 0;
  border-bottom: 1px dashed #C25859;
  background: none;
  color: #9E4344;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .rsvp-submit,
  .rsvp-form .rsvp-seg label { transition: none; }
}

/* The quieter second line of the thank-you panel. */
.rsvp-panel .rsvp-aside {
  color: #8A7F72;
  margin-top: 2px;
}

/* While a reply is being sent the whole form is disabled, so it has to look
   it — otherwise the segmented Yes/No still reads as pressable. */
/* The segmented Yes/No hides its real radios with opacity 0, and this rule
   out-specifies that — so it has to leave radios alone or the native dot
   reappears while a reply is being sent. */
.rsvp-form input:disabled:not([type="radio"]),
.rsvp-form select:disabled,
.rsvp-form textarea:disabled {
  opacity: 0.55;
  cursor: default;
}

.rsvp-seg input:disabled + label {
  opacity: 0.55;
  cursor: default;
}

.rsvp-form[aria-busy="true"] label,
.rsvp-form[aria-busy="true"] legend,
.rsvp-form[aria-busy="true"] .rsvp-label,
.rsvp-form[aria-busy="true"] .rsvp-found {
  opacity: 0.7;
}

/* The rest of the form grows out of nothing on the first Yes/No, rather than
   snapping to full height. Animating grid-template-rows is what lets it
   settle at its own height without one being measured or guessed. */
.rsvp-reveal {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .32s cubic-bezier(.22,.61,.36,1), opacity .28s ease;
}

.rsvp-reveal.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}

/* min-height:0 lets the row actually collapse; the clipping it needs while
   opening would otherwise cut off focus rings, so it's dropped once open. */
.rsvp-reveal > .rsvp-rest { min-height: 0; overflow: hidden; }
.rsvp-reveal.is-done > .rsvp-rest { overflow: visible; }

/* Once it's open the grid has done its job, so the wrapper goes back to being
   an ordinary block and the content simply takes its own height. Without
   this, a transition that never ran -- a backgrounded tab pauses them -- would
   leave the track stuck at zero and the fields spilling out of a flat box. */
.rsvp-reveal.is-done {
  display: block;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .rsvp-reveal { transition: none; }
}
