/* Contact Form block: intro beside the form (4/8 columns) or stacked above it. */
@layer page {
  .contact-form {
    display: flex;
    margin: 0 -17px;
    font-size: 17px;
    line-height: 1.5em;
  }

  .contact-form-intro {
    width: 33.333%;
    padding: 0 17px;
  }

  .contact-form-intro :is(h2, h3) {
    font-weight: 700;
    text-transform: uppercase;
  }

  .contact-form-intro p {
    margin-top: 1em;
  }

  .contact-form-form {
    width: 66.667%;
    padding: 0 17px;
  }

  /* Stacked: intro spans the column, form below it. */
  .contact-form--stacked {
    display: block;
  }

  .contact-form--stacked .contact-form-intro,
  .contact-form--stacked .contact-form-form {
    width: auto;
  }

  .contact-form--stacked .contact-form-intro :is(h2, h3) {
    margin-bottom: 47px;
    font-weight: 500;
    line-height: 1.4em;
    letter-spacing: 2px;
  }

  /* Narrow screens: intro and form stack vertically. */
  @media (max-width: 859px) {
    .contact-form {
      display: block;
    }

    .contact-form-intro,
    .contact-form-form {
      width: auto;
    }

    .contact-form-form {
      margin-top: 34px;
    }
  }
}

/* Gravity Forms markup, styled from scratch (theme disables GF's own CSS). */
@layer page {
  .contact-form .gform_heading {
    display: none;
  }

  /* Fields are full width; First/Last Name are half width and sit side by side. */
  .contact-form .gform_fields {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 17px 11px;
  }

  .contact-form .gfield {
    grid-column: span 12;
  }

  .contact-form .gfield--width-half {
    grid-column: span 6;
  }

  @media (max-width: 539px) {
    .contact-form .gfield--width-half {
      grid-column: span 12;
    }
  }

  .contact-form .gfield_label {
    display: block;
    margin-bottom: 3px;
    font-size: 17px;
    font-weight: 500;
    line-height: 21px;
  }

  .contact-form .gfield_required {
    margin-left: 3px;
    font-size: 13px;
    font-weight: 400;
    color: #888;
  }

  .contact-form input[type="text"],
  .contact-form input[type="email"],
  .contact-form input[type="tel"],
  .contact-form input[type="number"],
  .contact-form select,
  .contact-form textarea {
    display: block;
    width: 100%;
    height: 41px;
    padding: 0 12px;
    font: inherit;
    color: inherit;
    background: #fafafa;
    border: 1px solid #a9a9a9;
    border-radius: 0;
  }

  .contact-form select {
    padding-right: 40px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='12' viewBox='0 0 20 12'%3E%3Cpath d='M1 1l9 9 9-9' fill='none' stroke='%23575757' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
  }

  .contact-form .gfield_description {
    margin: 5px 0 10px;
    font-size: 13px;
    line-height: 16px;
    color: #888;
  }

  .contact-form textarea {
    height: 100px;
    padding: 8px 12px;
    resize: vertical;
  }

  /* Validation: message above each invalid field. */
  .contact-form .gfield_validation_message {
    margin: -1px 0 6px;
    font-size: 13px;
    line-height: 1.4em;
    color: #a33a2f;
  }

  .contact-form .gfield_error input,
  .contact-form .gfield_error textarea {
    border-color: #a33a2f;
    background: #fbf1ef;
  }

  /* Cloudflare Turnstile widget on the left, submit button to its right. */
  .contact-form .gform_footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 18px;
  }

  .contact-form .cf-turnstile-br {
    display: none;
  }

  /* Turnstile failure notice (the plugin prints its own heading above the form). */
  .contact-form .gform_submission_error {
    margin-bottom: 17px;
    font-size: 15px;
    font-weight: 500;
    color: #a33a2f;
  }

  .contact-form .gform-icon {
    display: none;
  }

  .contact-form .gform_button {
    padding: 0 36px;
    height: 52px;
    font-size: 17px;
    line-height: 52px;
    letter-spacing: 3px;
    color: #fff;
    background: #878787;
    border: 0;
    cursor: pointer;
  }
}

/* Unlayered on purpose: the Turnstile plugin prints an inline <style> forcing the widget
   container to 100% width, and unlayered styles always beat rules inside @layer. */
.contact-form .gf-turnstile-container {
  width: auto;
}
