/*
 * Catalogue purchase controls — single final authority.
 *
 * The catalogue markup contains an invisible default-UOM source plus the
 * Graham cart controls.  WooCommerce and the older responsive sheets both
 * target those nodes, so this sheet deliberately defines the final layout in
 * one place: quantity on the left, Add on the right.
 */

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    .graham-card-uom {
    align-items: center !important;
    display: grid !important;
    gap: 6px !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    grid-template-columns: 48px minmax(90px, 1fr) !important;
    height: 30px !important;
    margin: 0 0 0 auto !important;
    max-width: 150px !important;
    min-width: 0 !important;
    width: 100% !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    .graham-card-uom > .graham-card-uom__source,
html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    .graham-card-uom .graham-card-uom__select {
    display: none !important;
    visibility: hidden !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    .graham-card-uom > .graham-card-cart {
    display: contents !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    .graham-card-uom .graham-card-cart__quantity-field {
    align-items: center !important;
    display: flex !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    height: 30px !important;
    margin: 0 !important;
    min-height: 30px !important;
    min-width: 48px !important;
    width: 48px !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    .graham-card-uom .graham-card-cart__quantity {
    box-sizing: border-box !important;
    display: block !important;
    height: 30px !important;
    margin: 0 !important;
    min-height: 30px !important;
    padding: 0 3px !important;
    text-align: center !important;
    width: 48px !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    .graham-card-uom .graham-card-cart__submit {
    align-items: center !important;
    background: #13883f !important;
    border: 1px solid #13883f !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
    color: #fff !important;
    display: flex !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    height: 30px !important;
    justify-content: center !important;
    margin: 0 !important;
    min-height: 30px !important;
    min-width: 90px !important;
    padding: 0 8px !important;
    width: 100% !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    .graham-card-uom
    :is(.graham-card-cart__remove, .graham-card-cart__message, .graham-card-uom__add) {
    display: none !important;
}

/* Do not allow Woo's original product-button to flash beside the Graham
 * control while the cart-control script is initializing. */
html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.wc-block-product, ul.products li.product):has(.graham-card-cart)
    :is(.wp-block-woocommerce-product-button, .wc-block-components-product-button):not(:has(.graham-card-cart)) {
    display: none !important;
}
