/* === CAPTCHA BOX CONTAINER === */
#block-webform fieldset.captcha {
  background: #ffffff !important;
  border: 1px solid #ccc !important;
  padding: 22px 12px 12px !important; /* space for lowered legend */
  margin-top: 8px !important;
  margin-bottom: 20px !important; /* NEW: space above Sign Up button */
  max-width: 260px !important;
  border-radius: 6px;
  position: relative;
}

/* === CAPTCHA TITLE (LEGEND) === */
#block-webform fieldset.captcha legend.captcha__title {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.1 !important;
  font-size: 0.9rem !important;
  color: #000 !important;
  display: block;

  /* Position title fully inside the white box */
  position: absolute;
  top: 6px !important;   /* adjust to move title up/down */
  left: 12px !important; /* aligns with content padding */
}

/* === MATH EQUATION LINE === */
#block-webform .captcha__element {
  margin-top: 0 !important;
  margin-bottom: 6px !important;
  font-size: 1rem !important;
  color: #000 !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* === MATH ANSWER INPUT FIELD === */
#block-webform .form-item-captcha-response input.form-text {
  width: 50px !important;
  height: 32px !important;
  font-size: 1rem !important;
  padding: 2px 4px !important;
  border: 2px solid #555 !important;
  border-radius: 4px !important;
}

/* Keep math input spacing tight */
#block-webform .form-item-captcha-response {
  margin-bottom: 4px !important;
}

/* === HIDE ORIGINAL LABEL (still accessible for screen readers) === */
#block-webform label[for="edit-captcha-response"] {
  position: absolute !important;
  left: -9999px !important;
}

/* === INSTRUCTIONS TEXT === */
#block-webform #edit-captcha-response--description,
#block-webform .captcha__description {
  font-size: 0.8rem !important;
  line-height: 1.2 !important;
  margin-top: 6px !important;
  max-width: 240px !important;
  color: #333 !important;
}

/* Hidden initially */
#block-webform fieldset.captcha.captcha-collapsed
  #edit-captcha-response--description,
#block-webform fieldset.captcha.captcha-collapsed
  .captcha__description {
  display: none !important;
}

/* Visible when expanded */
#block-webform fieldset.captcha.captcha-expanded
  #edit-captcha-response--description,
#block-webform fieldset.captcha.captcha-expanded
  .captcha__description {
  display: block !important;
}

/* === TOGGLE BUTTON === */
#block-webform .captcha-instructions-toggle {
  font-size: 0.8rem !important;
  color: #0055aa !important;
  text-decoration: underline !important;
  cursor: pointer !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin-left: 6px !important;
}

#block-webform .captcha-instructions-toggle:focus {
  outline: 2px solid #0055aa !important;
}

/* Ensure labels appear dark on footer background */
#block-webform label,
#block-webform legend {
  color: #000 !important;
}