/* ==========================================================================
   Block: Contact Form
   File:   css/blocks/contact-form.css
   Markup: includes/blocks/contact-form.php
   ========================================================================== */

.contact-form {
  --cf-heading-size: 40px;
  --cf-max-width: 620px;

  width: 100%;
  margin: var(--vir-section-gap) 0 0;
  padding: 0 var(--vir-gutter);
  box-sizing: border-box;
}

.contact-form__inner {
  width: 100%;
  max-width: var(--cf-max-width);
  margin: 0 auto;
  box-sizing: border-box;
}

.contact-form__panel {
  padding: 50px clamp(24px, 4vw, 52px);
  border-top: 6px solid var(--vir-gold);
  background-color: var(--vir-surface);
  box-sizing: border-box;
}

/* Stacked keeps the heading and intro inside the panel, as before. */
.contact-form--stacked .contact-form__aside {
  padding: 50px clamp(24px, 4vw, 52px) 0;
  border-top: 6px solid var(--vir-gold);
  background-color: var(--vir-surface);
}

.contact-form--stacked .contact-form__aside + .contact-form__panel {
  padding-top: 0;
  border-top: 0;
}

.contact-form .contact-form__heading {
  margin: 0 0 20px;
  color: var(--vir-heading);
  font-family: var(--vir-font-display);
  font-size: var(--cf-heading-size);
  line-height: 1em;
  font-weight: 400;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.contact-form .contact-form__intro p {
  margin: 0 0 1.4em;
  color: var(--vir-body);
  font-family: var(--vir-font-body);
  font-size: 15px;
  line-height: 1.6em;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-align: center;
}

/* --- Embed ---------------------------------------------------------------
   The form comes from another service, so the panel only has to give it
   room and keep it inside the column. What is inside an iframe cannot be
   styled from here - the form's own colours are set at the provider. */

.contact-form__embed {
  width: 100%;
}

.contact-form__embed iframe {
  display: block;
  width: 100%;
  min-height: 420px;
  border: 0;
}

.contact-form__embed img,
.contact-form__embed video {
  max-width: 100%;
}

/* Shown to logged-in editors only, until the code is pasted in. */
.contact-form .contact-form__placeholder {
  margin: 0;
  padding: 26px 22px;
  border: 1px dashed rgba(201, 162, 39, 0.6);
  color: var(--vir-body);
  font-family: var(--vir-font-body);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.03em;
  text-align: center;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 991px) {
  .contact-form {
    --cf-heading-size: 34px;
  }
}

@media (max-width: 767px) {
  .contact-form {
    --cf-heading-size: 28px;
  }

  .contact-form__embed iframe {
    min-height: 520px;
  }
}

@media (max-width: 575px) {
  .contact-form {
    --cf-heading-size: 24px;
  }
}

/* --- Split layout ---------------------------------------------------------
   Text down the left of the measure, the form panel held to the right. Used
   on For Referrers and Enquire, where the copy is as much of the page as the
   form is and stacking the two buried one under the other. */

.contact-form--split .contact-form__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 72px;
  max-width: var(--vir-measure);
}

.contact-form--split .contact-form__aside {
  padding: 0;
  border: 0;
  background-color: transparent;
}

/* The panel is the only thing that needs to stay in view while a long
   column of copy scrolls past it. */
.contact-form--split .contact-form__panel {
  position: sticky;
  top: calc(var(--vir-header-height) + 24px);
}

.contact-form--split .contact-form__heading {
  margin: 0;
  font-size: var(--cf-heading-size);
  line-height: 1.12em;
  text-align: left;
  text-transform: uppercase;
}

.contact-form--split .contact-form__heading::before {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin: 0 0 26px;
  background-color: var(--vir-gold);
}

/* A block with no heading still wants the rule, so the column starts on the
   same line as every other section on the site. */
.contact-form--split .contact-form__aside--untitled::before {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin: 0 0 26px;
  background-color: var(--vir-gold);
}

.contact-form--split .contact-form__intro {
  margin: 26px 0 0;
}

.contact-form--split .contact-form__aside--untitled .contact-form__intro {
  margin: 0;
}

.contact-form--split .contact-form__intro p {
  margin: 0 0 1.4em;
  color: var(--vir-body);
  font-size: 16px;
  line-height: 1.85em;
  letter-spacing: 0.04em;
  text-align: left;
}

.contact-form--split .contact-form__intro p:last-child {
  margin-bottom: 0;
}

/* Email addresses in the copy are linked by make_clickable(). */
.contact-form--split .contact-form__intro a {
  color: var(--vir-gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 162, 39, 0.5);
  transition: border-color 0.3s ease;
}

.contact-form--split .contact-form__intro a:hover {
  border-bottom-color: var(--vir-gold);
  text-decoration: none;
}

@media (max-width: 1249px) {
  .contact-form--split .contact-form__inner {
    gap: 48px;
  }
}

@media (max-width: 991px) {
  .contact-form--split .contact-form__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    max-width: 760px;
  }

  .contact-form--split .contact-form__panel {
    position: static;
  }
}

/* With no form embedded yet, the copy column takes the full measure rather
   than sitting in half of a two-column grid beside nothing. */
.contact-form--split.contact-form--no-form .contact-form__inner {
  grid-template-columns: minmax(0, 1fr);
}

/* --- Forminator ----------------------------------------------------------
   The form is rendered into the page by the [forminator_form] shortcode, so
   it can be styled properly rather than left with the plugin's defaults.
   These rules restate the treatment the block's own fields used to have:
   navy-deep fields with a gold focus ring, and a gold pill to submit.
   Forminator's stylesheet sets some of this itself, so the declarations it
   would otherwise win are marked important. */

.contact-form__embed .forminator-ui.forminator-custom-form {
  font-family: var(--vir-font-body);
}

/* Rows sit closer together than the plugin's 30px default. */
.contact-form__embed .forminator-row {
  margin-bottom: 18px !important;
}

.contact-form__embed .forminator-row:last-of-type {
  margin-bottom: 0 !important;
}

/* --- Labels -------------------------------------------------------------- */

.contact-form__embed .forminator-ui .forminator-label {
  margin: 0 0 6px !important;
  color: rgba(255, 255, 255, 0.88) !important;
  font-family: var(--vir-font-body) !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  font-weight: 500 !important;
  letter-spacing: 0.03em !important;
  text-transform: none !important;
}

.contact-form__embed .forminator-ui .forminator-required {
  color: var(--vir-gold) !important;
}

.contact-form__embed .forminator-ui .forminator-description {
  margin: 6px 0 0 !important;
  color: rgba(255, 255, 255, 0.65) !important;
  font-family: var(--vir-font-body) !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
}

/* --- Fields -------------------------------------------------------------- */

.contact-form__embed .forminator-ui input.forminator-input,
.contact-form__embed .forminator-ui textarea.forminator-textarea,
.contact-form__embed .forminator-ui select.forminator-select2,
.contact-form__embed .forminator-ui .forminator-input-with-suffix {
  width: 100% !important;
  height: auto !important;
  padding: 11px 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 6px !important;
  background-color: var(--vir-navy-deep) !important;
  color: var(--vir-white) !important;
  font-family: var(--vir-font-body) !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form__embed .forminator-ui textarea.forminator-textarea {
  min-height: 130px !important;
  resize: vertical;
}

.contact-form__embed .forminator-ui input.forminator-input::placeholder,
.contact-form__embed .forminator-ui textarea.forminator-textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.contact-form__embed .forminator-ui input.forminator-input:hover,
.contact-form__embed .forminator-ui textarea.forminator-textarea:hover {
  border-color: rgba(201, 162, 39, 0.7) !important;
}

.contact-form__embed .forminator-ui input.forminator-input:focus,
.contact-form__embed .forminator-ui textarea.forminator-textarea:focus {
  outline: none !important;
  border-color: var(--vir-gold) !important;
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.25) !important;
}

/* The browser repaints autofilled fields white unless told otherwise. */
.contact-form__embed .forminator-ui input:-webkit-autofill {
  -webkit-text-fill-color: var(--vir-white);
  -webkit-box-shadow: 0 0 0 1000px #071e42 inset;
}

/* --- Submit -------------------------------------------------------------- */

.contact-form__embed .forminator-ui button.forminator-button-submit {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  min-height: 44px !important;
  height: auto !important;
  margin: 6px 0 0 !important;
  padding: 11px 28px !important;
  border: 1px solid var(--vir-gold) !important;
  border-radius: 50px !important;
  background-color: var(--vir-gold) !important;
  color: var(--vir-navy) !important;
  font-family: var(--vir-font-body) !important;
  font-size: 15px !important;
  line-height: 1 !important;
  font-weight: 400 !important;
  letter-spacing: 0.06em !important;
  text-align: center;
  text-transform: uppercase !important;
  box-sizing: border-box !important;
  transition: background-color 0.4s, color 0.4s, border-color 0.4s;
}

.contact-form__embed .forminator-ui button.forminator-button-submit:hover {
  border-color: var(--vir-navy) !important;
  background-color: var(--vir-navy) !important;
  color: var(--vir-white) !important;
}

.contact-form__embed .forminator-ui button.forminator-button-submit:focus-visible {
  outline: 2px solid var(--vir-white) !important;
  outline-offset: 3px;
}

/* --- Messages ------------------------------------------------------------ */

.contact-form__embed .forminator-ui .forminator-error-message {
  color: #ffb3b3 !important;
  font-family: var(--vir-font-body) !important;
  font-size: 13px !important;
}

.contact-form__embed .forminator-ui input.forminator-input[aria-invalid="true"],
.contact-form__embed .forminator-ui textarea.forminator-textarea[aria-invalid="true"] {
  border-color: rgba(255, 140, 140, 0.75) !important;
}

.contact-form__embed .forminator-response-message {
  margin: 0 0 18px !important;
  padding: 16px 18px !important;
  border: 1px solid rgba(201, 162, 39, 0.45) !important;
  border-radius: 6px !important;
  background-color: rgba(201, 162, 39, 0.12) !important;
  color: var(--vir-gold) !important;
  font-family: var(--vir-font-body) !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
}

.contact-form__embed .forminator-response-message.forminator-error {
  border-color: rgba(255, 140, 140, 0.5) !important;
  background-color: rgba(255, 90, 90, 0.14) !important;
  color: #ffb3b3 !important;
}

.contact-form__embed .forminator-response-message p {
  margin: 0 !important;
  color: inherit !important;
  font-size: inherit !important;
}

/* Forminator decides its own column behaviour from how wide it measures the
   panel, and in this column it settles on "small" and stacks every field.
   On a wide screen the half-width fields are put back beside each other, as
   the form was designed; below that they stack on their own. */

@media (min-width: 992px) {
  .contact-form__embed .forminator-row {
    display: flex;
    flex-wrap: wrap;
  }

  .contact-form__embed .forminator-row > .forminator-col {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .contact-form__embed .forminator-row > .forminator-col-md-6 {
    flex: 1 1 50%;
    max-width: 50%;
  }
}
