/**
 * reCAPTCHA badge placement for the legacy sw-contactform (v1, invisible).
 *
 * WHY THIS FILE EXISTS
 * Google's terms require the "reCAPTCHA" branding on invisible widgets, but the
 * plugin used to print `.grecaptcha-badge { display: none; }` to remove it. That
 * rule is gone, so the badge now renders — and Google's own default placement
 * (fixed to the viewport edge) looks broken on this layout, so it needs a home.
 *
 * WHY BOTTOM-RIGHT, AND WHY `padding-bottom`
 * The badge is absolutely positioned in the bottom-right corner of the form, and
 * the form reserves 76px of bottom padding so nothing else can sit there. Both
 * halves are load-bearing:
 *
 *  - Without the padding the badge lands on the submit button. The theme gives
 *    `.customer-form__form` no bottom padding and `.customer-form__form-action`
 *    is its last in-flow child, so the form's content box ends AT the button —
 *    measured `overlapsButton: true` until the padding was added.
 *
 *  - The padding also keeps it clear of the block that follows the form, and of
 *    the full-width mobile button. Measured with clearance: no overlap with the
 *    button, no overlap with any field, 14px clear of the following paragraph,
 *    at 1200px and at 390px.
 *
 * WHY `z-index` ABOVE THE SUBMIT OVERLAY
 * The theme's status message (fritton2020/library/scss/superwire/_in_page_status)
 * is a translucent white wash across the WHOLE form, above everything in it,
 * shown the moment the visitor submits:
 *     .in-page-status .nv-message { position:absolute; inset:0;
 *       z-index:1001; background:rgba(255,255,255,0.9) }
 * A badge inside the form is therefore washed out exactly when the visitor is
 * looking at it — an earlier bottom-anchored version measured as covered at all
 * three probe points. Sitting above the wash is also what the widget iframe
 * itself does, so the badge never appears through the form's own UI.
 *
 * WHY NOT SHRINK IT
 * In Google's v1 markup the badge is `.grecaptcha-logo` (256x60, with the
 * "reCAPTCHA" wordmark painted inside it) plus `.grecaptcha-error`. Clipping or
 * scaling below ~256px cuts the wordmark off — the very thing the badge exists
 * to show (a `max-width` attempt measured `clipped: true`). It keeps its natural
 * size and is only placed.
 *
 * `.captcha-target` is zero-height: it is emitted at the TOP of the form by
 * sw_start_contact_form() (templates echo the fields after that call), and it
 * only needs to exist for grecaptcha.render() to have somewhere to write.
 *
 * Scoped to `.sw-contact-form`, so the newer <superwire-contact-form> (reCAPTCHA
 * Enterprise, badge in a shadow root) is untouched by this file.
 */

/* The render target must not occupy space at the top of the form. */
.sw-contact-form .captcha-target {
  position: static;
  height: 0;
  overflow: visible;
}

/* Containing block for the badge, plus the clearance it needs so it cannot land
   on the submit button or the content after the form. */
.sw-contact-form.captcha-enabled {
  position: relative;
  padding-bottom: 76px;
  overflow: visible;
}

.sw-contact-form .captcha-target .grecaptcha-badge {
  position: absolute !important;
  top: auto !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  transform: none !important;

  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;

  /* Above the .in-page-status wash (z-index: 1001) so the success/failure
     message cannot fade the badge out. See the note at the top of this file. */
  z-index: 1002;

  /* Reads as an overlay pinned to the corner rather than a stray box: flush to
     the form's right and bottom edges, so only the inner corner is rounded. */
  border-top-left-radius: 5px;
  box-shadow: -1px -1px 6px rgba(0, 0, 0, 0.12) !important;
}

/* The badge's Privacy / Terms links live in the widget iframe and are
   keyboard-focusable. Keep the badge fully opaque and above the submit overlay
   when any of them take focus, so the "docked in the corner" state never hides
   the links a keyboard user is tabbing to. */
.sw-contact-form .captcha-target .grecaptcha-badge:focus-within {
  opacity: 1 !important;
  z-index: 1002;
}
