/* CONTACT FORM 7: first pass in the theme's design language (CF7's own CSS is disabled in inc/cf7.php).
   Field classes come from the form templates (docs/cf7-forms.md): .field, .field__label, .field__input,
   .check, .btn. Here: CF7's own wrappers, validation, response output and the sending state. */

/* CF7 internals that its stylesheet used to hide */
.wpcf7 .hidden-fields-container { display: none; }
.wpcf7 .screen-reader-response {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wpcf7-form-control-wrap { position: relative; display: block; }

/* Acceptance (privacy): same look as .check */
.wpcf7-acceptance .wpcf7-list-item { display: block; margin: 0; }
.wpcf7-acceptance label {
  display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: start;
  font-size: var(--t-s); line-height: 1.45; color: var(--c-muted); cursor: pointer;
}
.wpcf7-acceptance input[type='checkbox'] { width: 1.5rem; height: 1.5rem; margin: -0.05rem 0 0; accent-color: var(--c-accent); }
.wpcf7-acceptance a { display: inline-block; padding-block: 0.35rem 0.25rem; }
.newsletter .wpcf7-acceptance label { color: var(--c-fg); }

/* Checkbox group (e.g. "A che brand sei interessato?"): fieldset + legend as the field label,
   options on one line, wrapping when there is no room */
fieldset.field { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 0.35rem; }
.wpcf7-checkbox { display: flex; flex-wrap: wrap; gap: 0.6rem 1.75rem; }
.wpcf7-checkbox .wpcf7-list-item { margin: 0; }
.wpcf7-checkbox label {
  display: inline-flex; gap: 0.6rem; align-items: center;
  font-size: var(--t-s); line-height: 1.45; cursor: pointer;
}
.wpcf7-checkbox input[type='checkbox'] { width: 1.5rem; height: 1.5rem; margin: 0; accent-color: var(--c-accent); }

/* Validation */
.wpcf7-not-valid-tip {
  display: block; margin-top: 0.35rem;
  font-size: var(--t-xs); font-weight: 500; color: #a3261c;
}
.field__input.wpcf7-not-valid, .newsletter__input.wpcf7-not-valid { border-color: #a3261c; }
.field__input.wpcf7-not-valid:focus { box-shadow: 0 0 0 3px rgb(163 38 28 / 0.2); }

/* Response after sending */
.wpcf7-response-output {
  margin: 0; padding: 0.8rem 1rem;
  border: 1px solid var(--c-line-strong); border-radius: var(--radius-s);
  font-size: var(--t-s); font-weight: 500; line-height: 1.45;
}
.wpcf7-response-output:empty { display: none; }
.wpcf7-form.sent .wpcf7-response-output { border-color: var(--c-accent); background: rgb(46 156 64 / 0.1); color: var(--c-accent-ink); }
.wpcf7-form.invalid .wpcf7-response-output,
.wpcf7-form.unaccepted .wpcf7-response-output,
.wpcf7-form.payment-required .wpcf7-response-output { border-color: #b7791f; background: rgb(183 121 31 / 0.08); }
.wpcf7-form.failed .wpcf7-response-output,
.wpcf7-form.aborted .wpcf7-response-output,
.wpcf7-form.spam .wpcf7-response-output { border-color: #a3261c; background: rgb(163 38 28 / 0.08); color: #7d1d15; }
.newsletter .wpcf7-form .wpcf7-response-output { border-color: var(--c-fg); background: rgb(242 243 238 / 0.25); color: var(--c-fg); }

/* Sending: the button shows a spinner in place of the arrow, and does not take a second click */
.wpcf7-spinner { display: none; }
.wpcf7-form.submitting [type='submit'] { pointer-events: none; }
.wpcf7-form.submitting [type='submit'] .btn__arrow { visibility: hidden; }
.wpcf7-form.submitting [type='submit']::after {
  content: ''; position: absolute; right: 1.35em; top: 50%;
  width: 1em; height: 1em; margin-top: -0.5em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: st-spin 0.7s linear infinite;
}
@keyframes st-spin { to { rotate: 360deg; } }

/* Submit disabled by CF7 until the privacy box is ticked */
.wpcf7-form .btn:disabled { opacity: 0.45; cursor: not-allowed; }
