/* RSVP page. Header, footer, fonts and colours come from ../theme.css;
   this file styles the reply form. Sizes are in em of the page's base
   text size (24px on desktop), measured from the form designs. */

body[data-page="rsvp"] {
  --rsvp-card: #FDE0E4;
  --rsvp-field: #FEEAED;
  --rsvp-wine: #842B3F;
  --rsvp-line: rgba(132, 43, 63, 0.55);
  --rsvp-placeholder: rgba(144, 65, 77, 0.55);
  --rsvp-error: #B83D58;
}

/* The letter is smaller than the other pages' illustrations */
.rsvp-illustration {
  width: calc(var(--fs) * 11.1);
}

.rsvp-subtitle {
  font-family: var(--font-garland);
  font-size: 1.4em;
  line-height: 1.2;
  text-align: center;
  color: var(--color-green);
  margin: 1.2em 0 0;
}

.rsvp-card {
  max-width: 38.8em;
  margin: 1.6em auto 0;
  padding: 3.9em 3.67em 3.6em;
  background: var(--rsvp-card);
  font-family: var(--font-serif);
  color: var(--rsvp-wine);
}

.rsvp-form {
  display: flex;
  flex-direction: column;
  gap: 2.6em;
}

.rsvp-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

/* Fieldset legends don't take part in flex layout, so give them the
   same spacing as the span labels */
.rsvp-label {
  display: block;
  padding: 0;
  font-size: 0.77em;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.3;
  margin-bottom: 1.15em;
}

.rsvp-optional {
  font-weight: 400;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.02em;
  margin-left: 0.4em;
}

.rsvp-hint,
.rsvp-question {
  font-size: 0.85em;
  font-style: italic;
  line-height: 1.3;
  margin: -0.9em 0 1em;
}

.rsvp-question {
  font-size: 1em;
  font-style: normal;
  margin: -0.6em 0 0.4em;
}

.rsvp-error {
  font-size: 0.8em;
  font-style: italic;
  line-height: 1.3;
  color: var(--rsvp-error);
  margin: 0.8em 0 0;
}

.rsvp-error[hidden] {
  display: none;
}

/* Native inputs stay in the DOM (for keyboard + screen readers) but are
   visually replaced by the custom radio/checkbox below */
.rsvp-choice input,
.rsvp-event input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

/* "Kommer du?" choices */
.rsvp-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.67em;
}

.rsvp-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75em;
  min-height: 4.95em;
  padding: 0.9em 1.3em;
  border: 1px solid var(--rsvp-wine);
  font-size: 1.03em;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.rsvp-radio {
  flex-shrink: 0;
  width: 0.92em;
  height: 0.92em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.rsvp-choice:has(input:checked) {
  background: var(--rsvp-wine);
  color: var(--rsvp-card);
}

.rsvp-choice:has(input:checked) .rsvp-radio::after {
  content: "";
  width: 0.42em;
  height: 0.42em;
  border-radius: 50%;
  background: currentColor;
}

.rsvp-choice:has(input:focus-visible),
.rsvp-event:has(input:focus-visible) {
  outline: 2px solid var(--color-green);
  outline-offset: 3px;
}

/* Name / e-mail side by side */
.rsvp-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.83em;
}

.rsvp-input {
  width: 100%;
  font-family: inherit;
  font-size: 1.03em;
  color: var(--rsvp-wine);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rsvp-line);
  border-radius: 0;
  padding: 0.25em 0 0.55em;
}

.rsvp-textarea {
  width: 100%;
  min-height: 6.3em;
  font-family: inherit;
  font-size: 1em;
  line-height: 1.35;
  color: var(--rsvp-wine);
  background: var(--rsvp-field);
  border: 1px solid var(--rsvp-line);
  border-radius: 0;
  padding: 0.7em 0.9em;
  resize: vertical;
}

.rsvp-input::placeholder,
.rsvp-textarea::placeholder {
  font-style: italic;
  color: var(--rsvp-placeholder);
}

.rsvp-input:focus,
.rsvp-textarea:focus {
  outline: none;
  border-color: var(--rsvp-wine);
}

.rsvp-input:focus {
  box-shadow: 0 1px 0 0 var(--rsvp-wine);
}

/* Events (only when "Ja") */
.rsvp-yes-only {
  display: flex;
  flex-direction: column;
  gap: 2.6em;
}

.rsvp-yes-only[hidden] {
  display: none;
}

.rsvp-events {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75em;
}

.rsvp-event {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  padding: 0.85em 0.85em 1em;
  border: 1px solid var(--rsvp-line);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.rsvp-event-day {
  font-size: 0.75em;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rsvp-event-name {
  font-family: var(--font-garland);
  font-size: 0.9em;
  line-height: 1.15;
  overflow-wrap: break-word;
}

.rsvp-checkbox {
  position: absolute;
  top: 0.8em;
  right: 0.8em;
  width: 0.85em;
  height: 0.85em;
  border: 1px solid currentColor;
  opacity: 0.8;
}

.rsvp-event:has(input:checked) {
  background: var(--rsvp-wine);
  color: var(--rsvp-card);
  border-color: var(--rsvp-wine);
}

.rsvp-event:has(input:checked) .rsvp-checkbox {
  opacity: 1;
}

.rsvp-event:has(input:checked) .rsvp-checkbox::after {
  content: "";
  position: absolute;
  left: 0.27em;
  top: 0.08em;
  width: 0.22em;
  height: 0.48em;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* Send button + note */
.rsvp-submit {
  align-self: flex-start;
  font-family: var(--font-serif);
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rsvp-card);
  background: var(--rsvp-wine);
  border: 0;
  border-radius: 0;
  padding: 1.15em 2.15em;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.rsvp-submit:hover {
  opacity: 0.88;
}

.rsvp-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.rsvp-submit:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 3px;
}

.rsvp-actions {
  display: flex;
  flex-direction: column;
}

.rsvp-note {
  font-size: 0.8em;
  font-style: italic;
  margin: 1.4em 0 0;
}

/* After sending */
.rsvp-success[hidden] {
  display: none;
}

.rsvp-success {
  text-align: center;
}

.rsvp-success-title {
  font-family: var(--font-garland);
  font-size: 1.6em;
  line-height: 1.25;
  margin: 0;
}

@media (max-width: 700px) {
  .rsvp-card {
    padding: 2.2em 1.4em 2.4em;
  }

  .rsvp-choices,
  .rsvp-row,
  .rsvp-events {
    grid-template-columns: 1fr;
  }

  .rsvp-row {
    gap: 2.6em;
  }

  .rsvp-choice {
    min-height: 0;
  }
}
