/*
 * Bloc de capture e-mail — pensé pour vivre dans la card WP Recipe Maker
 * (template « test »). Le titre réutilise les classes WPRM natives afin
 * d'hériter police, taille, couleur et filet des sections « Ingrédients » /
 * « Matériel ». Le seul accent est l'orange du site (--theme-palette-color-1)
 * sur le bouton et l'icône. CSS scopé au préfixe .mpre-form, sans style global.
 */

.mpre-form {
  --mpre-accent: var(--theme-palette-color-1, #f0982e);
  --mpre-accent-strong: var(--theme-palette-color-2, #e58b22);
  --mpre-field-border: var(--theme-form-field-border-initial-color, var(--theme-palette-color-5, #e6e2dc));

  box-sizing: border-box;
  width: 100%;
  margin: 1.2em 0;
}

.mpre-form *,
.mpre-form *::before,
.mpre-form *::after {
  box-sizing: border-box;
}

.mpre-form form[hidden],
.mpre-form .mpre-form__result[hidden] {
  display: none;
}

/* Titre : porté par les classes WPRM (flex + gras + filet). On n'ajoute
   que l'icône ; police/taille/couleur restent celles de la card. */
.mpre-form .mpre-form__title {
  margin: 0 0 .35em;
}

.mpre-form__title-text {
  flex: 0 0 auto;
}

.mpre-form__icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  margin-right: 8px;
  color: var(--mpre-accent);
}

.mpre-form__icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Le filet WPRM ne doit pas coller au titre. */
.mpre-form .mpre-form__title .wprm-decoration-line {
  margin-left: 12px;
}

/* Texte courant : hérite police, taille et couleur du corps de la card. */
.mpre-form .mpre-form__note {
  margin: 0 0 .9em;
}

/* Label accessible du champ e-mail : masqué visuellement, lisible par les
   lecteurs d'écran (ce n'est pas le honeypot). */
.mpre-form__email-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Honeypot : sorti du flux et hors écran. Doublé par un style inline sur le
   wrapper pour rester invisible même si cette feuille ne se charge pas. */
.mpre-form .mpre-form__trap {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.mpre-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mpre-form__email {
  flex: 1 1 240px;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--mpre-field-border);
  border-radius: var(--theme-form-field-border-radius, 6px);
  background: var(--theme-form-field-background-initial-color, #fff);
  color: inherit;
  font: inherit;
}

.mpre-form__email::placeholder {
  color: var(--theme-palette-color-3, #765446);
  opacity: .6;
}

.mpre-form__email:focus {
  border-color: var(--mpre-accent);
  outline: 2px solid rgba(240, 152, 46, .35);
  outline-offset: 0;
}

.mpre-form__turnstile {
  flex: 1 1 100%;
  min-height: 0;
}

.mpre-form__turnstile:empty {
  display: none;
}

.mpre-form__submit {
  flex: 0 0 auto;
  min-height: 46px;
  margin: 0;
  padding: 0 22px;
  border: 0;
  border-radius: var(--theme-button-border-radius, 6px);
  background: var(--mpre-accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease;
}

.mpre-form__submit:hover,
.mpre-form__submit:focus-visible {
  background: var(--mpre-accent-strong);
}

/* Accusé de réception après redirection : sobre, ton de la card. */
.mpre-form .mpre-form__result {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 .6em;
  font-weight: 600;
}

.mpre-form .mpre-form__result::before {
  content: "";
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    var(--mpre-accent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E")
    center / 13px no-repeat;
}

/* Mobile : champ et bouton empilés, pleine largeur, zone tactile >= 44px. */
@media (max-width: 480px) {
  .mpre-form__row {
    gap: 8px;
  }

  .mpre-form__email,
  .mpre-form__submit {
    flex: 1 1 100%;
    width: 100%;
  }
}
