/* ===========================================================
   Ritz Stevens - Jetpack contact form restyle
   Applies to the homepage form and /contact/
   =========================================================== */

.contact-form {
  --rs-navy: #1B2A4A;
  --rs-gold: #C9A96E;
  --rs-ink:  #1E1E1E;
  --rs-line: #D3D7DE;
  --rs-muted:#6B7280;
}

/* --- 1. Layout: honour Jetpack's own per-field width system
       (width-50-wrap etc.) rather than forcing a grid, so the forms on
       /join-us/ and /find-an-advisor/ keep their intended layout and
       their submit buttons stay full width. --- */
.wp-block-jetpack-contact-form {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 22px 24px !important;
  align-items: flex-start;
}
.wp-block-jetpack-contact-form > * { flex: 1 1 100%; min-width: 0; }
/* Jetpack's own .grunion-field-width-NN-wrap rules already set the desktop
   widths. On phones they must be beaten back to full width, and they use
   max-width + width, so overriding flex-basis alone is not enough. */
@media (max-width: 781px) {
  .wp-block-jetpack-contact-form > * {
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* --- 2. Labels --- */
.contact-form label,
.wp-block-jetpack-contact-form label {
  display: block;
  font-family: inherit;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.4;
  color: var(--rs-navy) !important;
  margin-bottom: 8px !important;
}
.grunion-label-required {
  font-weight: 400 !important;
  font-size: 13px !important;
  color: var(--rs-muted) !important;
}
.grunion-label-required::before { content: " "; }

/* --- 3. Fields: one uniform box, 16px type, light border --- */
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form input[type="url"],
.contact-form input[type="number"],
.contact-form select,
.contact-form textarea,
.contact-form .jetpack-field__input-phone-wrapper {
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 52px !important;
  margin: 0 !important;
  padding: 13px 16px !important;
  font-family: inherit !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  color: var(--rs-ink) !important;
  background-color: #fff !important;
  border: 1px solid var(--rs-line) !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.contact-form .contact-form__select-element-wrapper {
  width: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
}

.contact-form .jetpack-field__input-phone-wrapper {
  display: flex !important;
  align-items: center !important;
}
.contact-form .jetpack-field__input-phone-wrapper input[type="tel"] {
  flex: 1 1 auto;
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  font-family: inherit !important;
  font-size: 16px !important;
  color: var(--rs-ink) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.contact-form .jetpack-field__input-phone-wrapper button {
  font-size: 16px !important;
  color: var(--rs-ink) !important;
}

.contact-form textarea {
  min-height: 170px !important;
  resize: vertical;
}

.contact-form ::placeholder { color: var(--rs-muted) !important; opacity: 1; }
.contact-form select:invalid,
.contact-form select option[value=""] { color: var(--rs-muted) !important; }

/* --- 4. Focus --- */
.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus,
.contact-form .jetpack-field__input-phone-wrapper:focus-within {
  outline: none !important;
  border-color: var(--rs-navy) !important;
  box-shadow: 0 0 0 3px rgba(27, 42, 74, .14) !important;
}

.contact-form .contact-form-input-error input,
.contact-form .contact-form-input-error textarea,
.contact-form .contact-form-input-error select {
  border-color: #B3261E !important;
}

/* --- 5. Submit --- */
.contact-form .contact-submit { margin: 0 !important; }
.contact-form button.pushbutton-wide,
.contact-form input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px !important;
  margin-top: 4px !important;
  padding: 15px 44px !important;
  font-family: inherit !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  letter-spacing: .01em;
  color: var(--rs-navy) !important;
  background-color: var(--rs-gold) !important;
  border: 0 !important;
  border-radius: 6px !important;
  cursor: pointer;
  transition: background-color .15s ease;
}
.contact-form button.pushbutton-wide:hover,
.contact-form input[type="submit"]:hover {
  background-color: #BC9856 !important;
}
.contact-form button.pushbutton-wide:focus-visible {
  outline: 3px solid var(--rs-navy) !important;
  outline-offset: 2px;
}
@media (max-width: 781px) {
  .contact-form button.pushbutton-wide,
  .contact-form input[type="submit"] { width: 100% !important; }
}


/* --- 6. Select: Jetpack nests select 3 deep, so the visible box has to
       live on the outer wrapper or it renders 2px narrow than the
       other fields with a doubled border. --- */
.contact-form .contact-form__select-wrapper {
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 52px !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: #fff !important;
  border: 1px solid var(--rs-line) !important;
  border-radius: 6px !important;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.contact-form .contact-form__select-element-wrapper {
  width: 100% !important;
  min-height: 50px !important;
}
.contact-form .contact-form__select-wrapper select {
  width: 100% !important;
  min-height: 50px !important;
  border: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
}
.contact-form .contact-form__select-wrapper:focus-within {
  border-color: var(--rs-navy) !important;
  box-shadow: 0 0 0 3px rgba(27, 42, 74, .14) !important;
}


/* --- 7. Radio / checkbox option labels: the field label is the bold one,
       the individual options should not compete with it --- */
.contact-form .wp-block-jetpack-option,
.contact-form .grunion-radio-options label,
.contact-form .grunion-checkbox-multiple-options label,
.contact-form .grunion-checkbox-options label {
  font-weight: 400 !important;
  margin-bottom: 0 !important;
}

/* --- 8. Outlined-style forms (/find-an-advisor/) draw their box on the
       notch spans, not the input, so the border-colour focus rule cannot
       show there. Give that layout its own ring instead. --- */
.contact-form .is-style-outlined .wp-block-jetpack-input-wrap:focus-within {
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(27, 42, 74, .14);
}

/* --- 9. Forms whose submit is a core button block rather than Jetpack's
       pushbutton: match the field radius and the 16px floor --- */
.contact-form .wp-block-button__link,
.contact-form button.wp-block-button__link {
  min-height: 52px !important;
  border-radius: 6px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
}
@media (max-width: 781px) {
  .contact-form .wp-block-button,
  .contact-form .wp-block-button__link { width: 100% !important; }
}
