/**
 * Simmelink Forms – styling for the Contact Form 7 forms.
 *
 * Everything is scoped to the .cf7-form wrapper that the [simmelink_form]
 * shortcode adds around each form.
 *
 * Colours, sizes and spacing come from the theme tokens (style.css and the
 * theme.json presets), with the design values as fallback.
 * Adjust the look in one place through the custom properties below.
 *
 * The calculator has an older stylesheet of its own (alimony.css). The field and
 * submit selectors here are heavier on purpose, so forms look the same everywhere.
 */

.cf7-form {
  --form-surface: var(--white, #F4F5F6);
  --form-text: var(--wp--preset--color--contrast, #0F1E2E);
  --form-muted: var(--text-muted, rgba(15, 30, 46, 0.7));
  --form-border: var(--border-field, rgba(15, 30, 46, 0.6));
  --form-accent: var(--wp--preset--color--blue-normal, #005E8C);
  --form-error: var(--wp--preset--color--error, #9B2D20);
  --form-radius: var(--radius, 2px);
  --form-height: var(--control-height, 48px);
  --form-gap: var(--wp--preset--spacing--30, 20px);
  --form-gap-small: var(--wp--preset--spacing--20, 10px);

  width: 100%;
  max-width: var(--wp--style--global--content-size, 680px);
  margin: 0;
  color: var(--form-text);
  text-align: left;
}

/* Heading inside the form (feasibility check) */
.cf7-form h2 {
  margin-top: 0;
  margin-bottom: var(--form-gap);
}

/* CF7 wraps content in paragraphs; keep their spacing out of the layout */
.cf7-form p {
  margin: 0;
}

/* CF7 inserts a <br> between label and field */
.cf7-form label + br {
  display: none;
}

/* Fields */
.cf7-form .form-field,
.cf7-form .form-row {
  margin-bottom: var(--form-gap);
}

.cf7-form label {
  display: block;
  margin-bottom: 4px;
}

.cf7-form :is(.form-field, .form-row) label {
  color: var(--form-text);
  font-size: var(--wp--preset--font-size--medium, 1em);
  font-weight: 500;
}

/* The calculator puts a select in the paragraph of its label: the label stays above it. */
.cf7-form .form-row > p:first-child:has(select) {
  display: block;
}

.cf7-form .optional,
.cf7-form .field-hint {
  font-weight: 400;
  color: var(--form-muted);
}

.cf7-form .field-hint {
  display: block;
  margin-top: 2px;
  font-size: var(--wp--preset--font-size--small, 0.875em);
}

/* Required is the rule: only the optional fields say something. */
.cf7-form .required {
  display: none;
}

.cf7-form .wpcf7-form-control:is(input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], select, textarea) {
  width: 100%;
  height: var(--form-height);
  padding: 0 1rem;
  background-color: var(--form-surface);
  border: 1px solid var(--form-border);
  border-radius: var(--form-radius);
  color: var(--form-text);
  font-family: inherit;
  font-size: max(16px, var(--wp--preset--font-size--medium, 1em));
  line-height: 1.4;
  transition: var(--transition, none);
}

.cf7-form .wpcf7-form-control.wpcf7-textarea:is(textarea) {
  /* Grows with the placeholder, so it is not cut off on a small screen. */
  field-sizing: content;
  height: auto;
  min-height: calc(3 * 1.4em + 1.5rem);
  padding-bottom: 0.75rem;
  padding-top: 0.75rem;
  resize: vertical;
}

.cf7-form .wpcf7-form-control::placeholder {
  color: var(--form-muted);
  opacity: 1;
}

.cf7-form .wpcf7-form-control:is(input, select, textarea):focus-visible {
  background-color: var(--form-surface);
  border-color: var(--form-border);
  box-shadow: none;
  outline: var(--focus-on-light, 2px solid #005E8C);
  outline-offset: 2px;
}

/* Validation: the colour on the border and one sentence under the field, no frame */
.cf7-form .wpcf7-form-control.wpcf7-not-valid:is(input, select, textarea) {
  background-color: var(--form-surface);
  border-color: var(--form-error);
}

.cf7-form .wpcf7-not-valid-tip {
  display: block;
  margin-top: 4px;
  font-size: var(--wp--preset--font-size--small, 0.875em);
  color: var(--form-error);
}

.cf7-form .wpcf7 form .wpcf7-response-output {
  margin: var(--form-gap) 0 0;
  padding: 0;
  border: 0;
  font-size: var(--wp--preset--font-size--medium, 1em);
}

.cf7-form .wpcf7 form:is(.invalid, .unaccepted, .payment-required, .failed, .aborted, .spam) .wpcf7-response-output {
  color: var(--form-error);
}

/* Turnstile: in the column of the button. The widget is 65px high and arrives late,
   so the space is reserved; otherwise the button jumps when it loads. */
.cf7-form .cf-turnstile {
  min-height: 65px;
  margin-bottom: var(--form-gap);
  line-height: 0;
}

/* Submit and privacy line */
.cf7-form .submit-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--form-gap-small);
  margin-top: var(--form-gap);
}

.cf7-form input.wpcf7-submit[type="submit"] {
  height: var(--form-height);
  min-height: var(--form-height);
  padding: 0 1.5rem;
  background: var(--wp--preset--color--gold-light, #B8963E);
  border: 1px solid transparent;
  border-radius: var(--form-radius);
  box-shadow: none;
  color: var(--form-text);
  font-family: inherit;
  font-size: var(--wp--preset--font-size--medium, 1em);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: var(--transition, none);
}

.cf7-form input.wpcf7-submit[type="submit"]:is(:hover, :focus-visible, :active) {
  background: var(--wp--preset--color--gold-light, #B8963E);
  box-shadow: none;
  color: var(--form-text);
  text-decoration: underline;
  transform: none;
}

.cf7-form input.wpcf7-submit[type="submit"]:focus-visible {
  outline: var(--focus-on-light, 2px solid #005E8C);
  outline-offset: 2px;
}

.cf7-form .wpcf7-form.submitting .wpcf7-spinner {
  display: inline-block;
}

.cf7-form .wpcf7-spinner,
.cf7-form .wpcf7-spinner::before {
  border-radius: var(--form-radius);
}

.cf7-form .privacy-text {
  font-size: var(--wp--preset--font-size--small, 0.875em);
  color: var(--form-muted);
}

.cf7-form .privacy-text a {
  color: var(--form-accent);
}

/* Reassurance list below the form: the dash of the article lists, no check marks */
.cf7-form ul.response-message {
  margin: var(--form-gap) 0 0;
  padding-left: 0;
  list-style: none;
}

.cf7-form .response-message li {
  display: flex;
  align-items: flex-start;
  margin: 0 0 6px;
}

.cf7-form .response-message li::before {
  content: "\2013";
  content: "\2013" / "";
  flex: 0 0 var(--form-gap);
  color: var(--form-muted);
}
