/**
 * E ESPACE 94 — Formulaire de contact / Contact Form 7
 * Version premium 1.3.0 — styles locaux, sans dépendance JavaScript.
 * Chargement conditionnel page Contact (functions.php existant).
 * Les couleurs respectent la palette du design system.
 */
.e94-form {
  --e94-form-ink: #1c1b18;
  --e94-form-text-muted: #5c564c;
  --e94-form-stone: #787062;
  --e94-form-border-subtle: #dad3c5;
  --e94-form-brand: #007a35;
  --e94-form-brand-hover: #00642c;
  --e94-form-brand-active: #0b4c26;
  --e94-form-focus-halo: rgba(0, 122, 53, 0.10);
  --e94-form-error-halo: rgba(180, 35, 24, 0.10);
  --e94-form-error: #b42318;
  color: var(--e94-form-ink);
}

.e94-form,
.e94-form * { box-sizing: border-box; }

.e94-form .e94-form-intro {
  margin: 0 0 20px;
  color: var(--e94-form-text-muted);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
}

.e94-form .e94-required {
  color: var(--e94-form-error);
  font-weight: 600;
}

.e94-form .e94-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.e94-form .e94-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 30px;
  row-gap: 28px;
}

.e94-form .e94-field { min-width: 0; }
.e94-form .e94-field--full { grid-column: 1 / -1; }

.e94-form .e94-field label {
  display: block;
  margin: 0 0 8px;
  color: var(--e94-form-ink);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.3;
}

.e94-form .wpcf7-form-control-wrap {
  display: block;
  width: 100%;
}

.e94-form .e94-field .wpcf7-form-control:not(.wpcf7-submit) {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 60px;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--e94-form-stone);
  border-radius: 2px;
  background-color: #fff;
  box-shadow: none;
  color: var(--e94-form-ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.45;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.e94-form .e94-field .wpcf7-form-control::placeholder {
  color: #787062;
  opacity: 1;
}

/* Chevron personnalise : supprime la fleche native en bordure. */
.e94-form .e94-field select.wpcf7-form-control:not(.wpcf7-submit) {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: 64px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231C1B18' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 24px center;
  background-size: 20px 20px;
}

/* Hauteur contrôlée : le tag CF7 peut définir rows="10".
   Une hauteur explicite évite qu'il prenne ~300 px selon les navigateurs.
   L'utilisateur conserve la possibilité de l'agrandir verticalement. */
.e94-form .e94-field--message textarea.wpcf7-form-control:not(.wpcf7-submit) {
  height: 240px;
  min-height: 220px;
  resize: vertical;
}

/* Micro-interactions limitées aux champs actifs.
   Le focus est aussi visible à la souris, pas uniquement au clavier. */
.e94-form .e94-field .wpcf7-form-control:not(.wpcf7-submit):hover:not(:disabled):not(:focus) {
  border-color: var(--e94-form-text-muted);
}

.e94-form .e94-field .wpcf7-form-control:not(.wpcf7-submit):focus {
  outline: 2px solid var(--e94-form-brand-hover);
  outline-offset: 2px;
  border-color: var(--e94-form-brand-hover);
  box-shadow: 0 0 0 3px var(--e94-form-focus-halo);
}

/* Erreur : les styles CF7 restent visibles même au focus. */
.e94-form .e94-field .wpcf7-form-control.wpcf7-not-valid:not(.wpcf7-submit),
.e94-form .e94-field .wpcf7-form-control[aria-invalid="true"]:not(.wpcf7-submit) {
  border-color: var(--e94-form-error) !important;
}

.e94-form .e94-field .wpcf7-form-control.wpcf7-not-valid:not(.wpcf7-submit):focus,
.e94-form .e94-field .wpcf7-form-control[aria-invalid="true"]:not(.wpcf7-submit):focus {
  outline-color: var(--e94-form-error);
  box-shadow: 0 0 0 3px var(--e94-form-error-halo);
}

.e94-form .wpcf7-not-valid-tip {
  display: block;
  margin-top: 8px;
  color: var(--e94-form-error);
  font-size: 0.875rem;
  line-height: 1.45;
}

/* Filet pleine largeur, lecture limitée à ~70 caractères par ligne.
   Le padding droit réserve une zone vide sans raccourcir la bordure.
   Sur mobile, ce padding retombe naturellement à zéro. */
.e94-form .e94-form-privacy {
  width: 100%;
  max-width: none;
  margin: 14px 0 0;
  padding: 22px max(0px, calc(100% - 70ch)) 0 0;
  border-top: 1px solid var(--e94-form-border-subtle);
  color: var(--e94-form-text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.e94-form .e94-form-privacy a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.e94-form .e94-form-privacy a:hover {
  color: var(--e94-form-brand-hover);
}

.e94-form .e94-form-actions { margin-top: 24px; }

.e94-form .e94-submit-wrap {
  display: inline-flex;
  position: relative;
  align-items: center;
  max-width: 100%;
}

.e94-form .e94-submit-wrap .e94-submit {
  display: block;
  width: auto;
  max-width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 15px 66px 15px 28px;
  border: 1px solid var(--e94-form-brand);
  border-radius: 2px;
  background: var(--e94-form-brand);
  box-shadow: none;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.e94-form .e94-submit-wrap:hover .e94-submit {
  background: var(--e94-form-brand-hover);
  border-color: var(--e94-form-brand-hover);
}

.e94-form .e94-submit-wrap .e94-submit:active {
  background: var(--e94-form-brand-active);
  border-color: var(--e94-form-brand-active);
}

.e94-form .e94-submit-wrap .e94-submit:focus-visible {
  outline: 2px solid var(--e94-form-brand-hover);
  outline-offset: 3px;
}

/* État d'envoi géré par les classes natives de CF7.
   On n'annonce pas de succès avant le retour réel du plugin. */
.wpcf7 form.submitting .e94-form .e94-submit-wrap .e94-submit,
.e94-form .e94-submit-wrap .e94-submit:disabled {
  cursor: progress;
  opacity: 0.84;
}

/* SVG local et recolorable. Son chemin est relatif a assets/css/,
   donc il reste valide apres la migration vers le domaine de production. */
.e94-form .e94-submit-arrow {
  position: absolute;
  right: 24px;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  color: #fff;
  background-color: currentColor;
  -webkit-mask: url("../icons/arrow-right.svg") center / contain no-repeat;
  mask: url("../icons/arrow-right.svg") center / contain no-repeat;
  font-size: 0; /* Masque le caractere fleche sans modifier le formulaire CF7. */
  line-height: 0;
  pointer-events: none;
  transition: transform 160ms ease;
}

.e94-form .e94-submit-wrap:hover .e94-submit-arrow {
  transform: translate(3px, -50%);
}

/* CF7 insère son indicateur d'envoi après le bouton. */
.e94-form .e94-submit-wrap .wpcf7-spinner {
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%);
  margin: 0;
}

/* Les messages CF7 restent dans le flux, après le formulaire. */
.wpcf7 .e94-form + .wpcf7-response-output,
.wpcf7 form .wpcf7-response-output {
  border-radius: 2px;
  padding: 12px 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
}

@media (max-width: 767px) {
  .e94-form .e94-form-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 22px;
  }

  .e94-form .e94-field .wpcf7-form-control:not(.wpcf7-submit) {
    min-height: 54px;
    padding: 13px 15px;
  }

  .e94-form .e94-field--message textarea.wpcf7-form-control:not(.wpcf7-submit) {
    height: 200px;
    min-height: 180px;
  }

  .e94-form .e94-field select.wpcf7-form-control:not(.wpcf7-submit) {
    padding-right: 54px;
    background-position: right 18px center;
  }

  .e94-form .e94-form-privacy {
    padding-top: 18px;
    padding-right: 0;
  }

  .e94-form .e94-submit-wrap .e94-submit {
    padding: 15px 58px 15px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .e94-form .wpcf7-form-control,
  .e94-form .e94-submit,
  .e94-form .e94-submit-arrow {
    transition: none !important;
  }

  .e94-form .e94-submit-wrap:hover .e94-submit-arrow {
    transform: translateY(-50%);
  }
}
