/* --------------------------------------------------------------------------
   Contact Form 7 shim.

   The quote form's markup (form-grid / form-field / form-consent) comes from
   the theme, so most of the styling in style.css already applies. This file
   only deals with the wrappers and states CF7 injects on its own:

     .wpcf7-form-control-wrap   inline span around every control
     .wpcf7-not-valid-tip       per-field validation message
     .wpcf7-response-output     the summary bar after submit
     .wpcf7-spinner             the AJAX spinner
     .wpcf7-acceptance          the consent checkbox, nested two spans deep
     input[type=submit]         inherits .form-field input, which outguns .btn

   Loaded only when CF7 is active — see inc/cf7.php.
   -------------------------------------------------------------------------- */

/* CF7 wraps each control in an inline span; make it transparent to the grid. */
.form-field .wpcf7-form-control-wrap {
  display: block;
  width: 100%;
}

/* CF7 renders <p> between rows unless the form is written tightly; neutralise
   any that slip in so they don't add phantom gaps to the grid. */
.form-card .wpcf7-form > p:empty,
.form-card .wpcf7-form br { display: none; }

/* ---------- Submit button ----------
   `.form-field input` (0,1,1) beats `.btn` (0,1,0), so the submit would render
   as a cream text field. Restate the button styling at matching specificity. */
.form-field input[type="submit"].wpcf7-submit {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 1.7rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  background: var(--green-800);
  color: var(--white);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.form-field input[type="submit"].wpcf7-submit:hover {
  background: var(--green-700);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.form-field input[type="submit"].wpcf7-submit:focus-visible {
  outline: 3px solid var(--green-600);
  outline-offset: 2px;
}
.form-field input[type="submit"].wpcf7-submit:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

/* ---------- Consent checkbox ----------
   [acceptance] nests the input inside two spans and a label. Flatten it back
   into the .form-consent flex row. */
.form-consent .wpcf7-form-control-wrap { display: inline; width: auto; }
.form-consent .wpcf7-acceptance,
.form-consent .wpcf7-list-item { display: inline; margin: 0; }
.form-consent .wpcf7-list-item label { display: inline; margin: 0; }
.form-consent .wpcf7-list-item-label:empty { display: none; }
.form-consent input[type="checkbox"] {
  width: auto;
  margin-top: 0.28rem;
  accent-color: var(--green-700);
  flex: none;
}

/* ---------- Validation ---------- */
.form-field .wpcf7-not-valid-tip {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #b3261e;
}
.form-field .wpcf7-not-valid {
  border-color: #b3261e;
  background: #fff;
}
.form-field .wpcf7-not-valid:focus {
  border-color: #b3261e;
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.15);
}

/* ---------- Response bar ---------- */
.wpcf7 form .wpcf7-response-output {
  margin: 1.25rem 0 0;
  padding: 0.9rem 1.1rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.wpcf7 form.sent .wpcf7-response-output {
  border-color: var(--green-600);
  background: var(--green-50);
  color: var(--green-950);
}
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.payment-required .wpcf7-response-output {
  border-color: #e0a800;
  background: #fffaf0;
  color: #6b4e00;
}
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output {
  border-color: #b3261e;
  background: #fdf1f0;
  color: #7a1c15;
}
.wpcf7 form.spam .wpcf7-response-output {
  border-color: #b3261e;
  background: #fdf1f0;
  color: #7a1c15;
}

/* ---------- Spinner ---------- */
.wpcf7-spinner {
  margin: 0.75rem auto 0;
  display: block;
  background-color: var(--green-600);
}

/* Honeypot fields (Honeypot for Contact Form 7), if installed. */
.form-card .wpcf7-honeypot-hide,
.form-card .wpcf7-honeypot { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .form-field input[type="submit"].wpcf7-submit,
  .form-field input[type="submit"].wpcf7-submit:hover { transition: none; transform: none; }
}
