/* Turnstile controls its own visibility through appearance: interaction-only.
   Keep the original submit position while verification runs in the background. */
.gform_wrapper.gform_wrapper .gform_footer:has(> .mag-turnstile) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
    gap: 0;
}

.gform_wrapper .mag-turnstile {
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 300px;
}

.gform_wrapper .mag-turnstile-widget {
    /* A zero-height provider iframe must not leave a text baseline gap. */
    line-height: 0;
}

/* Only a visible challenge/error needs extra room. Never clip its iframe. */
.gform_wrapper.gform_wrapper .gform_footer:has(> .mag-turnstile:is(.is-interactive, .has-error, .has-visible-widget)) {
    position: static !important;
    inline-size: 100% !important;
    block-size: auto !important;
    height: auto !important;
    margin-block-start: 1rem !important;
    margin-inline: 0 !important;
    gap: 1rem;
}

@media (width < 1200px) {
    /* The translated heading/consent can grow. Keep the button in normal flow. */
    .mag-contact-form .gform_wrapper .gform_footer:has(> .mag-turnstile) {
        position: static !important;
        inline-size: 100% !important;
        block-size: auto !important;
        margin-block-start: 1rem !important;
        margin-inline: 0 !important;
    }
}

@media (width >= 1200px) {
    .mag-contact-form .gform_wrapper .gform_footer:has(> .mag-turnstile:is(.is-interactive, .has-error, .has-visible-widget)) {
        inline-size: calc(50% - 4px) !important;
        margin-inline-start: auto !important;
    }
}

.gform_wrapper .mag-turnstile > [hidden] {
    display: none !important;
}

.gform_wrapper .mag-turnstile-error {
    margin-block: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.gform_wrapper .mag-turnstile-retry {
    min-block-size: 44px;
    padding: 0.5rem 0.75rem;
    text-decoration: underline;
    cursor: pointer;
}

.gform_wrapper .mag-turnstile-retry:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}
