/*
 * Match bartonsite.org Form.astro / btn-primary.
 * Theme: ?theme=dark|light from host page, else prefers-color-scheme.
 */
:root {
  --bhgs-primary: rgb(1, 97, 239);
  --bhgs-secondary: rgb(1, 84, 207);
  --bhgs-text: rgb(16, 16, 16);
  --bhgs-muted: rgb(16, 16, 16, 0.66);
  --bhgs-border: #e5e7eb;
  --bhgs-input-bg: #ffffff;
  --bhgs-page-bg: #ffffff;
  --bhgs-font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not(.bhgs-light) {
    --bhgs-primary: rgb(110, 160, 230);
    --bhgs-secondary: rgb(90, 140, 210);
    --bhgs-text: rgb(210, 214, 220);
    --bhgs-muted: rgb(180, 186, 196, 0.75);
    --bhgs-border: #334155;
    --bhgs-input-bg: #0f172a;
    --bhgs-page-bg: #000000;
  }
}

html.bhgs-dark {
  --bhgs-primary: rgb(110, 160, 230);
  --bhgs-secondary: rgb(90, 140, 210);
  --bhgs-text: rgb(210, 214, 220);
  --bhgs-muted: rgb(180, 186, 196, 0.75);
  --bhgs-border: #334155;
  --bhgs-input-bg: #0f172a;
  --bhgs-page-bg: #000000;
}

html.bhgs-light {
  --bhgs-primary: rgb(1, 97, 239);
  --bhgs-secondary: rgb(1, 84, 207);
  --bhgs-text: rgb(16, 16, 16);
  --bhgs-muted: rgb(16, 16, 16, 0.66);
  --bhgs-border: #e5e7eb;
  --bhgs-input-bg: #ffffff;
  --bhgs-page-bg: #ffffff;
}

html.webform-share-page-html,
body.webform-share-page-body,
.region-content,
.webform-share-submission-form,
.webform-ajax-form-wrapper,
form.webform-submission-form {
  margin: 0 !important;
  padding: 0 !important;
  background: var(--bhgs-page-bg) !important;
  box-shadow: none !important;
  border: 0 !important;
  color: var(--bhgs-text) !important;
  font-family: var(--bhgs-font) !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
  overflow: visible !important;
}

/* Room so fields aren't flush with the iframe edges. */
form.webform-submission-form {
  padding: 0.5rem !important;
  box-sizing: border-box !important;
}

/* Disable Gin sticky/compact action bar so the button stays large + in-flow. */
form.webform-submission-form.gin--has-sticky-form-actions,
.gin--has-sticky-form-actions {
  padding-bottom: 0 !important;
}

.gin-sticky-form-actions,
.gin--sticky-form-actions,
[data-drupal-selector="edit-actions"].gin-sticky-form-actions {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  transform: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Gin a11y helper; visually-hidden often missing in share.js embeds. */
a[gin-move-focus-to-sticky-bar] {
  display: none !important;
}

.page-title,
h1.page-title,
.block-page-title-block {
  display: none !important;
}

.antibot-message {
  margin: 0 0 1rem !important;
  border-radius: 0.5rem !important;
}

form.webform-submission-form .js-form-item,
form.webform-submission-form .form-item {
  margin: 0 0 1.5rem !important;
  max-width: none !important;
  width: 100% !important;
}

form.webform-submission-form label,
form.webform-submission-form .form-item__label,
form.webform-submission-form .form-item label,
form.webform-submission-form .js-form-item label,
form.webform-submission-form .option,
form.webform-submission-form .form-required {
  display: block !important;
  float: none !important;
  width: auto !important;
  margin: 0 0 0.35rem !important;
  padding: 0 !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
  color: var(--bhgs-text) !important;
  opacity: 1 !important;
  visibility: visible !important;
}

form.webform-submission-form .form-item__label.form-required::after,
form.webform-submission-form .form-required::after {
  content: none !important;
}

/* Large inputs — Form.astro: py-3 px-4 text-md rounded-lg w-full */
form.webform-submission-form .bhgs-input,
form.webform-submission-form input.form-element,
form.webform-submission-form select.form-element,
form.webform-submission-form textarea.form-element,
form.webform-submission-form input.form-text,
form.webform-submission-form input.form-email,
form.webform-submission-form select.form-select,
form.webform-submission-form textarea.form-textarea {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  min-height: 3.25rem !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0.875rem 1.125rem !important;
  font-family: var(--bhgs-font) !important;
  font-size: 1.125rem !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  color: var(--bhgs-text) !important;
  background-color: var(--bhgs-input-bg) !important;
  background-image: none !important;
  border: 1px solid var(--bhgs-border) !important;
  border-radius: 0.25rem !important;
  box-shadow: none !important;
  outline: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

form.webform-submission-form textarea.bhgs-input,
form.webform-submission-form textarea.form-element,
form.webform-submission-form textarea.form-textarea {
  min-height: 8rem !important;
  resize: vertical !important;
}

form.webform-submission-form .form-textarea-wrapper {
  margin: 0 !important;
  width: 100% !important;
}

form.webform-submission-form .bhgs-input::placeholder,
form.webform-submission-form .form-element::placeholder,
form.webform-submission-form input::placeholder,
form.webform-submission-form textarea::placeholder {
  color: var(--bhgs-muted) !important;
  opacity: 1 !important;
}

/* Muted empty select option (acts as placeholder). */
form.webform-submission-form select.bhgs-input:invalid,
form.webform-submission-form select.form-select:invalid,
form.webform-submission-form select.bhgs-input option[value=""],
form.webform-submission-form select.form-select option[value=""] {
  color: var(--bhgs-muted) !important;
}

form.webform-submission-form select.bhgs-input:valid,
form.webform-submission-form select.form-select:valid {
  color: var(--bhgs-text) !important;
}

form.webform-submission-form .bhgs-input:focus,
form.webform-submission-form .form-element:focus,
form.webform-submission-form input:focus,
form.webform-submission-form select:focus,
form.webform-submission-form textarea:focus {
  border-color: var(--bhgs-primary) !important;
  box-shadow: none !important;
  outline: 2px solid rgb(1 97 239 / 55%) !important;
  outline-offset: -2px !important;
}

form.webform-submission-form select.bhgs-input,
form.webform-submission-form select.form-select,
form.webform-submission-form select.form-element {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E") !important;
  background-position: right 1rem center !important;
  background-repeat: no-repeat !important;
  background-size: 1.35rem 1.35rem !important;
  padding-right: 2.75rem !important;
}

/*
 * Disclaimer checkbox under Gin/Claro:
 * .form-boolean uses float + negative margin-inline-start + translateY(-50%),
 * which clips the control. Hide the native input and paint label::before instead.
 */
form.webform-submission-form .form-item--disclaimer,
form.webform-submission-form .js-form-item-disclaimer,
form.webform-submission-form .form-type--boolean.form-item--disclaimer {
  display: block !important;
  position: relative !important;
  float: none !important;
  margin: 0.75rem 0 0 !important;
  margin-bottom: 0 !important;
  margin-inline: 0 !important;
  margin-inline-start: 0 !important;
  padding: 0 !important;
  padding-inline: 0 !important;
  padding-inline-start: 0 !important;
  overflow: visible !important;
  min-height: 0 !important;
}

form.webform-submission-form .form-item--disclaimer > input[type="checkbox"],
form.webform-submission-form .js-form-item-disclaimer > input[type="checkbox"],
form.webform-submission-form .form-type--boolean.form-item--disclaimer > .form-boolean {
  position: absolute !important;
  left: 0 !important;
  top: 50% !important;
  inset: auto !important;
  inset-block-start: 50% !important;
  inset-inline-start: 0 !important;
  float: none !important;
  z-index: 2 !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
  min-width: 1.25rem !important;
  min-height: 1.25rem !important;
  max-width: 1.25rem !important;
  max-height: 1.25rem !important;
  margin: 0 !important;
  margin-inline: 0 !important;
  margin-inline-start: 0 !important;
  padding: 0 !important;
  transform: translateY(-50%) !important;
  opacity: 0 !important;
  cursor: pointer !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

form.webform-submission-form .form-item--disclaimer > label,
form.webform-submission-form .js-form-item-disclaimer > label,
form.webform-submission-form .form-item--disclaimer > .form-item__label,
form.webform-submission-form .js-form-item-disclaimer > .form-item__label {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  position: static !important;
  float: none !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  margin-inline: 0 !important;
  padding: 0 !important;
  padding-inline: 0 !important;
  padding-inline-start: 0 !important;
  background: transparent !important;
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
  color: var(--bhgs-muted) !important;
  cursor: pointer !important;
  user-select: none !important;
}

form.webform-submission-form .form-item--disclaimer > label::before,
form.webform-submission-form .js-form-item-disclaimer > label::before {
  content: "" !important;
  display: block !important;
  position: static !important;
  flex: 0 0 1.25rem !important;
  align-self: center !important;
  box-sizing: border-box !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
  margin: 0 !important;
  border: 1px solid var(--bhgs-border) !important;
  border-radius: 0.25rem !important;
  background-color: var(--bhgs-input-bg) !important;
  background-image: none !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 0.85rem 0.85rem !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

form.webform-submission-form .form-item--disclaimer > label::after,
form.webform-submission-form .js-form-item-disclaimer > label::after {
  content: none !important;
  display: none !important;
}

form.webform-submission-form .form-item--disclaimer > input[type="checkbox"]:checked + label::before,
form.webform-submission-form .js-form-item-disclaimer > input[type="checkbox"]:checked + label::before {
  border-color: var(--bhgs-primary) !important;
  background-color: var(--bhgs-primary) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E") !important;
}

form.webform-submission-form .form-item--disclaimer > input[type="checkbox"]:focus + label::before,
form.webform-submission-form .js-form-item-disclaimer > input[type="checkbox"]:focus + label::before {
  outline: 2px solid rgb(1 97 239 / 55%) !important;
  outline-offset: 2px !important;
}

/* Full-width centered pill button — Form.astro mt-10 grid + btn-primary */
form.webform-submission-form .form-actions,
form.webform-submission-form .webform-actions,
form.webform-submission-form [data-drupal-selector="edit-actions"] {
  display: grid !important;
  width: 100% !important;
  margin: 2.5rem 0 0 !important;
  padding: 0 !important;
  text-align: center !important;
}

form.webform-submission-form .bhgs-submit,
form.webform-submission-form .webform-button--submit,
form.webform-submission-form .form-actions .button--primary,
form.webform-submission-form .form-actions input[type="submit"],
form.webform-submission-form input.webform-button--submit {
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 3.5rem !important;
  height: auto !important;
  margin: 0 auto !important;
  padding: 1rem 2rem !important;
  font-family: var(--bhgs-font) !important;
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  text-transform: none !important;
  color: #fff !important;
  background: var(--bhgs-primary) !important;
  background-color: var(--bhgs-primary) !important;
  background-image: none !important;
  border: 1px solid var(--bhgs-primary) !important;
  border-radius: 9999px !important;
  box-shadow: none !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease, border-color 0.2s ease !important;
}

form.webform-submission-form .bhgs-submit:hover,
form.webform-submission-form .webform-button--submit:hover,
form.webform-submission-form .form-actions .button--primary:hover,
form.webform-submission-form .form-actions input[type="submit"]:hover {
  color: #fff !important;
  background: var(--bhgs-secondary) !important;
  background-color: var(--bhgs-secondary) !important;
  border-color: var(--bhgs-secondary) !important;
}

form.webform-submission-form .form-item__description,
form.webform-submission-form .description {
  margin-top: 0.25rem !important;
  font-size: 0.875rem !important;
  color: var(--bhgs-muted) !important;
}

.bhgs-response-note,
form.webform-submission-form .bhgs-response-note {
  margin: 0.75rem 0 0 !important;
  text-align: center !important;
  font-size: 0.875rem !important;
  color: var(--bhgs-muted) !important;
}

.messages,
.messages-list {
  margin: 0 0 1rem !important;
  border-radius: 0.5rem !important;
}
