/* Keep enquiry links and form controls inside the usable part of the mobile viewport. */
@media (max-width: 1024px) {
    .pmh-enquiry-clearance :is(main, #primary, #pmh-order-plan) :is(a[href*="contact-us/"], a[href*="project-enquiry/"]),
    .pmh-enquiry-clearance #wpforms-form-45 :is(input, select, textarea, button, .wpforms-uploader) {
        scroll-margin-block-start: var(--pmh-enquiry-top, 0px) !important;
        scroll-margin-block-end: var(--pmh-enquiry-bottom, 0px) !important;
    }

    .pmh-enquiry-clearance #wpforms-form-45 {
        scroll-margin-block-start: var(--pmh-enquiry-form-top, var(--pmh-enquiry-top, 0px)) !important;
    }
}

/* Keep the section navigation on one scrollable line when vertical space is limited. */
@media (max-width: 1024px) and (max-height: 640px) {
    .page-id-33.pmh-enquiry-clearance .pmhcr-nav {
        display: flex;
        overflow-x: auto;
    }
    .page-id-33.pmh-enquiry-clearance .pmhcr-nav a {
        flex: 1 0 auto;
        min-height: 44px;
        padding: 4px 10px;
    }
}

/* In a short landscape viewport keep the choices visible beside a scrollable notice. */
@media (min-width: 540px) and (max-width: 1024px) and (max-height: 520px) and (orientation: landscape) {
    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-banner) {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: none !important;
        padding: 6px 24px 6px 12px !important;
        gap: 10px !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 38%) !important;
        align-items: center;
        box-sizing: border-box;
    }

    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-banner-body) {
        grid-area: auto !important;
        max-height: 23vh;
        max-height: 23dvh;
        overflow-y: auto !important;
        overscroll-behavior-y: contain;
    }

    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-banner-footer) {
        grid-area: auto !important;
        width: 100%;
        align-self: center;
    }

    .page-id-33.pmh-enquiry-clearance #wpforms-form-45 {
        max-inline-size: var(--pmh-enquiry-form-width, 100%);
        margin-inline: 0 auto;
    }

    html .page-id-33.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-banner) {
        inset: auto 6px 6px auto !important;
        width: 40vw !important;
        min-width: 0 !important;
        max-width: 355px !important;
        max-height: calc(100dvh - 12px) !important;
        grid-template-columns: minmax(0, 1fr) !important;
        box-sizing: border-box;
        overflow-y: auto !important;
    }

    html[dir="rtl"] .page-id-33.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-banner) {
        inset: auto auto 6px 6px !important;
    }
}

@media (min-width: 540px) and (max-width: 1024px) and (max-height: 380px) and (orientation: landscape) {
    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-banner) {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) !important;
    }
    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-banner-body) {
        min-height: 0 !important;
        max-height: 48px !important;
    }
    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-banner-footer) {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 3px !important;
    }
    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-button-preferences),
    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-button-cancel),
    html .tax-product_cat.pmh-enquiry-clearance #wpconsent-container::part(wpconsent-button-accept) {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 44px !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
}
