/* ==========================================================================
   Formulaire « Serez-vous des nôtres ? »
   ========================================================================== */
.rsvp-form {
  display: grid;
  gap: 22px;
  padding: 26px 20px;
  border-radius: 22px;
  background: var(--ivory-card);
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -40px rgba(75, 85, 48, 0.45);
}
@media (min-width: 640px) { .rsvp-form { padding: 40px 44px; } }

.form-note { margin: 0; font-size: 0.85rem; color: var(--olive-muted); }
.req { color: #a05a3c; }
.optional { font-weight: 400; color: var(--olive-muted); font-size: 0.85em; }

.form-step {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 18px;
  min-width: 0;
}
.form-step + .form-step { padding-top: 22px; border-top: 1px solid var(--line); }
.form-step__title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  margin-bottom: 4px;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--olive);
}
.form-step__num {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sage-light);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--sage-deep);
}

.field { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field__label { padding: 0; font-weight: 500; font-size: 0.98rem; color: var(--olive); }
.field__hint { margin: -2px 0 2px; font-size: 0.85rem; color: var(--olive-muted); line-height: 1.5; }

.rsvp-form input[type='text'],
.rsvp-form input[type='email'],
.rsvp-form textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(75, 85, 48, 0.22);
  background: var(--ivory);
  color: var(--olive);
  font: inherit;
  font-size: 16px; /* évite le zoom automatique sur iOS */
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.rsvp-form textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.rsvp-form input::placeholder,
.rsvp-form textarea::placeholder { color: #a9ad97; }
.rsvp-form input:focus,
.rsvp-form textarea:focus {
  outline: none;
  border-color: var(--sage-deep);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(159, 174, 138, 0.25);
}

/* Oui / Non */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmented__option { position: relative; display: block; cursor: pointer; }
.segmented__option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(75, 85, 48, 0.22);
  background: var(--ivory);
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.segmented__option input:checked + span {
  background: var(--olive);
  border-color: var(--olive);
  color: var(--ivory);
}
.segmented__option input:focus-visible + span { box-shadow: 0 0 0 4px rgba(159, 174, 138, 0.35); }

/* Moments (cases indépendantes) */
.moment-choices { display: grid; gap: 10px; }
.moment-choice {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(75, 85, 48, 0.22);
  background: var(--ivory);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.moment-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.moment-choice__box {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1.5px solid rgba(75, 85, 48, 0.4);
  display: grid;
  place-items: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.moment-choice__box::after {
  content: '';
  width: 11px;
  height: 6px;
  border: solid var(--ivory);
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform 0.2s var(--ease-out);
}
.moment-choice__text { display: grid; line-height: 1.3; }
.moment-choice__text strong { font-weight: 500; }
.moment-choice__text small { font-size: 0.82rem; color: var(--olive-muted); }
.moment-choice:has(input:checked) { border-color: var(--sage-deep); background: var(--sage-mist); }
.moment-choice input:checked ~ .moment-choice__box { background: var(--olive); border-color: var(--olive); }
.moment-choice input:checked ~ .moment-choice__box::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.moment-choice input:focus-visible ~ .moment-choice__box { box-shadow: 0 0 0 4px rgba(159, 174, 138, 0.35); }

/* Blocs conditionnels */
.conditional,
[data-show-when] { display: grid; gap: 18px; }
[data-show-when][hidden] { display: none !important; }
.is-revealing { animation: field-in 0.45s var(--ease-out) both; }
@keyframes field-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.meal-block {
  display: grid;
  gap: 18px;
  padding: 18px 16px;
  border-radius: 14px;
  background: var(--sage-mist);
}
.meal-block__title {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.3rem;
  color: var(--sage-deep);
}
.meal-block .segmented__option input:not(:checked) + span,
.meal-block input[type='text'],
.meal-block textarea { background: var(--ivory-card); }
@media (min-width: 640px) { .meal-block { padding: 22px 24px; } }

/* Erreurs */
.field__error { margin: 0; font-size: 0.86rem; color: #a3412e; min-height: 0; }
.field__error:empty { display: none; }
.has-error input[type='text'],
.has-error input[type='email'],
.has-error textarea,
.has-error .segmented__option span,
.has-error .moment-choice { border-color: #c0705c; }

/* Envoi */
.form-submit { display: grid; gap: 12px; padding-top: 6px; }
.form-message {
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
}
.form-message.is-error { background: #f7e6e0; color: #8e3b28; }
.form-message.is-info { background: var(--sage-mist); color: var(--olive); }
.form-privacy { margin: 0; text-align: center; font-size: 0.82rem; color: var(--olive-muted); }

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(250, 246, 238, 0.35);
  border-top-color: var(--ivory);
  animation: spin 0.8s linear infinite;
}
.btn.is-loading .btn__spinner { display: inline-block; }
.btn.is-loading { pointer-events: none; opacity: 0.85; }
.btn[disabled] { cursor: not-allowed; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Piège anti-robots */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Confirmation */
.rsvp-success {
  padding: 44px 24px;
  border-radius: 22px;
  text-align: center;
  background: var(--ivory-card);
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -40px rgba(75, 85, 48, 0.45);
  animation: field-in 0.6s var(--ease-out) both;
}
.rsvp-success:focus { outline: none; }
.rsvp-success .section-ornament { margin-top: 0; }
.rsvp-success__title { margin: 14px 0 10px; font-family: var(--font-serif); font-weight: 500; font-size: 2.2rem; }
.rsvp-success__text { margin: 0 auto 24px; max-width: 26em; color: var(--olive-soft); }
