/*
 * The site's forms: the contact form (/contact/), the newsletter form in the bar on every page and on
 * /newsletter/. Written for yourbrainhealth.io in the contractor-free rewrite (slice 2, 2026-11-02), to
 * look as the WordPress forms did. Markup: content/pages/contact.html, content/pages/newsletter.html,
 * content/chrome/newsletter-bar.html; the answers (errors, summary, confirmation) are written by
 * src/scripts/forms.js.
 *
 *   .site-form                    a form's box; .site-form--bar in the newsletter bar
 *   .site-form__fields            the fields: a 12-column grid (a flex row in the bar)
 *   .site-form__field             one field (--half: half the row from 640px; --choice: the checkbox fieldset)
 *   .site-form__label             a field's label (--hidden: for screen readers only; --inline: a checkbox's)
 *   .site-form__choices           a checkbox group, .site-form__choice one checkbox and its label
 *   .site-form__footer            the submit row
 *   .site-form__summary           "There was a problem..." above the fields, with its icon
 *   .site-form__field--error      a field the answer names, with its .site-form__message
 *   .site-form__confirmation      the thanks that replaces the form
 */

/* ---- every form ------------------------------------------------------------------------- */

.site-form__fields {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 0;
  row-gap: 40px;
  width: 100%;
}

.site-form__field {
  grid-column: span 12;
  min-width: 0;
  line-height: 18px;
}

fieldset.site-form__field {
  margin: 0;
  padding: 0;
  border: 0;
}

@media (min-width: 640px) {
  .site-form__fields {
    column-gap: 16px;
  }

  .site-form__field--half {
    grid-column: span 6;
  }
}

.site-form__label {
  display: block;
  color: #112337;
  font-size: 14px;
  font-weight: 500;
  line-height: 20.02px;
}

/* Kept for screen readers, drawn for nobody: the field's placeholder says what it is. */
.site-form__label--hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  border: 0;
  overflow-wrap: normal;
}

.site-form__required {
  display: inline;
  padding-inline-start: 6px;
  color: #c02b0a;
  font-size: 12px;
  font-weight: 500;
  line-height: 17.16px;
}

legend.site-form__label {
  margin-bottom: 12px;
  padding: 0;
}

.site-form__choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-form__choice {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0;
  row-gap: 16px;
}

.site-form__choice input[type="checkbox"] {
  appearance: none;
  display: grid;
  align-self: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1px solid #686e77;
  border-radius: 2px;
  background-color: #fff;
  color: #112337;
  font-size: 14px;
  line-height: 20px;
  outline: 0 solid transparent;
  outline-offset: 1px;
}

/* The tick: a white check drawn here, on the checked box's colour. */
.site-form__choice input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.2l3 3 6.6-6.6' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
}

.site-form__label--inline {
  margin: 0 0 0 12px;
  font-weight: 400;
}

.site-form input:not([type="checkbox"], [type="hidden"]),
.site-form textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  text-align: inherit;
  box-shadow: 0 1px 4px rgba(18, 25, 97, 0.078);
  outline: 0 solid transparent;
  outline-offset: 1px;
}

/* The focus ring: every control and every Submit button, as the WordPress forms drew it. */
.site-form input:not([type="hidden"]):focus,
.site-form textarea:focus,
.site-form .site-form__submit:focus {
  outline: 3px solid rgba(32, 76, 229, 0.65);
}

.site-form textarea {
  min-height: 18rem;
  overflow-wrap: normal;
  resize: vertical;
}

.site-form ::placeholder {
  color: rgba(17, 35, 55, 0.7);
  font-size: 14px;
}

.site-form__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.site-form__submit {
  appearance: none;
  vertical-align: top;
  min-height: 38px;
  box-shadow: 0 1px 4px rgba(18, 25, 97, 0.078);
  outline: 0 solid transparent;
  outline-offset: 1px;
}

/* ---- the answers -------------------------------------------------------------------------- */

.site-form__summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 40px;
  padding: 20px 16px;
  border: 1px solid rgba(192, 43, 10, 0.25);
  border-radius: 3px;
  background-color: rgba(192, 43, 10, 0.03);
  box-shadow: 0 1px 4px rgba(18, 25, 97, 0.078);
}

.site-form__summary:focus {
  outline: 0;
}

/* The icon above the words on a phone, beside them from 640px. */
.site-form__summary-title {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  color: #c02b0a;
  font-family: "Roboto Slab", serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20.02px;
}

@media (min-width: 640px) {
  .site-form__summary-title {
    flex-direction: row;
    align-items: center;
  }
}

/* A ring with an exclamation mark: the ring is this box's border, the mark is the SVG forms.js draws. */
.site-form__summary-icon {
  flex: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(192, 43, 10, 0.25);
  border-radius: 50%;
  background-color: rgba(192, 43, 10, 0.05);
  color: #c02b0a;
}

.site-form__message {
  margin-top: 8px;
  color: #c02b0a;
  font-size: 13px;
  line-height: 18.59px;
}

.site-form__field--choice .site-form__message {
  margin-top: 12px;
}

.site-form__counter {
  margin-top: 8px;
  color: #585e6a;
  font-size: 13px;
  line-height: 18.59px;
}

.site-form__counter--error {
  color: #c02b0a;
}

/* ---- the contact form, in a page's form block --------------------------------------------- */

.form-holder .site-form input:not([type="checkbox"]):not([type="hidden"]),
.form-holder .site-form textarea {
  padding: 10px;
  border: 1px solid #db239a;
  border-radius: 0;
  box-shadow: none;
  background-color: #fff;
  color: #666;
  font-size: 26px;
  line-height: 30px;
}

.form-holder .site-form input:not([type="checkbox"]):not([type="hidden"]):focus,
.form-holder .site-form textarea:focus {
  border: 0;
  background-color: #db239a;
  color: #fff;
}

.form-holder .site-form__label,
.form-holder .site-form__field--choice {
  color: #666;
  font-size: 26px;
  line-height: 30px;
}

.form-holder .site-form__choice input[type="checkbox"] {
  border: 1px solid #db239a;
  border-radius: 0;
  box-shadow: none;
}

.form-holder .site-form__choice input[type="checkbox"]:checked {
  background-color: #db239a;
}

.form-holder .site-form__submit {
  font-size: 26px;
  line-height: 26px;
}

@media only screen and (max-width: 1019px) {
  .form-holder .site-form input:not([type="checkbox"]):not([type="hidden"]),
  .form-holder .site-form textarea,
  .form-holder .site-form__label,
  .form-holder .site-form__field--choice {
    font-size: 24px;
    line-height: 32px;
  }
}

@media only screen and (max-width: 767px) {
  .form-holder .site-form__fields {
    row-gap: 15px;
  }

  .form-holder .site-form input:not([type="checkbox"]):not([type="hidden"]),
  .form-holder .site-form textarea,
  .form-holder .site-form__label,
  .form-holder .site-form__field--choice {
    font-size: 18px;
    line-height: 26px;
  }

  .form-holder .site-form__submit {
    font-size: 20px;
    line-height: 20px;
  }
}

/* ---- the newsletter bar ------------------------------------------------------------------- */

.site-form--bar form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.site-form--bar .site-form__fields {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  width: auto;
}

.site-form--bar .site-form__label {
  display: none;
}

.site-form--bar input[type="email"] {
  width: 220px;
  height: 40px;
  padding: 0 15px;
  border: none;
  border-radius: 4px;
  color: #112337;
  font-family: "Roboto Slab", serif;
  font-size: 14px;
  line-height: 38px;
}

.site-form--bar input[type="email"]:focus {
  outline: 2px solid #db239a;
  outline-offset: 0;
}

.site-form--bar .site-form__footer {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

/* The bar's and the signup page's button: a plain filled button, without the site button's sliding layer. */
.site-form--bar .site-form__submit,
.site-form--signup .site-form__submit {
  position: static;
  z-index: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.site-form--bar .site-form__submit::before,
.site-form--signup .site-form__submit::before {
  content: none;
}

.site-form--bar .site-form__submit {
  height: 40px;
  margin: 0;
  padding: 0 24px;
  border: none;
  border-radius: 4px;
  background-color: #0aaa8f;
  color: #fff;
  font-family: "Jost", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 40px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.site-form--bar .site-form__submit:hover {
  background-color: #088a75;
}

.site-form--bar .site-form__message {
  color: #ffeb3b;
  font-size: 12px;
  line-height: 17.16px;
}

.signup-bar__form .site-form__confirmation-message {
  color: #fff;
  font-family: "Roboto Slab", serif;
  font-size: 15px;
}

@media (max-width: 768px) {
  .site-form--bar form {
    flex-wrap: wrap;
    justify-content: center;
  }

  .site-form--bar input[type="email"] {
    width: 180px;
  }
}

/* ---- the signup form on /newsletter/, in the page's magenta block --------------------------- */

.site-form--signup .site-form__label {
  display: none;
}

.site-form--signup input[type="email"] {
  box-sizing: border-box;
  color: #112337;
  line-height: 38px;
  text-align: center;
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow: none;
  background-color: #fff;
  font-family: "Roboto Slab", serif;
  font-size: 16px;
}

.site-form--signup input[type="email"]::placeholder {
  text-align: center;
}

.site-form--signup input[type="email"]:focus {
  outline: none;
  border: 2px solid #0aaa8f;
}

.site-form--signup .site-form__submit {
  width: auto;
  height: 50px;
  line-height: 16px;
  margin-top: 15px;
  padding: 0 40px;
  border: none;
  border-radius: 4px;
  background-color: #0aaa8f;
  color: #fff;
  font-family: "Jost", sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.site-form--signup .site-form__submit:hover {
  background-color: #088a75;
}
