/*
 * JETWHEELS — WOODMART 8.6.6
 * JW866-MOBILE-CATALOG
 * Only mobile catalog, max-width 767px.
 */

@media (max-width: 767px) {

    /* Equal-height grid items */
    body.tax-product_cat .wd-products .wd-product,
    body.post-type-archive-product .wd-products .wd-product {
        display: flex !important;
        flex-direction: column !important;
        min-width: 0 !important;
    }

    body.tax-product_cat .wd-products .wd-product .product-wrapper,
    body.post-type-archive-product .wd-products .wd-product .product-wrapper {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    /* Preserve the natural image size */
    body.tax-product_cat .wd-products .wd-product .product-element-top,
    body.post-type-archive-product .wd-products .wd-product .product-element-top {
        height: auto !important;
        min-height: 0 !important;
        margin-bottom: 6px !important;
    }

    /* Information layout */
    body.tax-product_cat .wd-products .wd-product .product-element-bottom,
    body.post-type-archive-product .wd-products .wd-product .product-element-bottom {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        row-gap: 5px !important;
    }

    /* Reserve exactly two text lines for product titles */
    body.tax-product_cat .wd-products .wd-product .wd-entities-title,
    body.post-type-archive-product .wd-products .wd-product .wd-entities-title {

        position: relative !important;
        display: block !important;
        box-sizing: border-box !important;
        height: 2.5em !important;
        min-height: 2.5em !important;
        max-height: 2.5em !important;
        flex: 0 0 2.5em !important;
        margin: 0 0 4px !important;
        padding: 0 !important;
        line-height: 1.25 !important;
        overflow: hidden !important;

    }

    /* One line centered vertically; two lines fill the same area */
    body.tax-product_cat .wd-products .wd-product .wd-entities-title > a,
    body.post-type-archive-product .wd-products .wd-product .wd-entities-title > a {

        position: absolute !important;
        top: 50% !important;
        left: 0 !important;
        transform: translateY(-50%) !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: 2.5em !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1.25 !important;
        text-align: left !important;
        white-space: normal !important;
        overflow: hidden !important;

    }


    /* Keep the existing price block at the bottom */
    body.tax-product_cat .wd-products .wd-product
    .product-element-bottom > :last-child,
    body.post-type-archive-product .wd-products .wd-product
    .product-element-bottom > :last-child {
        margin-top: auto !important;
    }
}

/* JW866-HIDE-DUPLICATE-MOBILE-FILTER
 * Hide redundant WoodMart sidebar opener on mobile.
 * Keep actual filter sidebar and desktop layout unchanged.
 */
@media (max-width: 1024px) {
    body.tax-product_cat .wd-sidebar-opener.wd-action-btn.wd-show-on-scroll.wd-filter-icon,
    body.post-type-archive-product .wd-sidebar-opener.wd-action-btn.wd-show-on-scroll.wd-filter-icon {
        display: none !important;
    }
}

/* JW866-WIDER-MOBILE-CARDS
 * Two wider product cards per row.
 * Mobile only.
 */
@media (max-width: 767px) {

    body.tax-product_cat .wd-products,
    body.post-type-archive-product .wd-products {
        --wd-gap: 4px !important;
        --wd-products-gap: 4px !important;
        column-gap: 4px !important;

        margin-left: -8px !important;
        margin-right: -8px !important;
        width: calc(100% + 16px) !important;
        max-width: none !important;
    }

    body.tax-product_cat .wd-products .wd-product,
    body.post-type-archive-product .wd-products .wd-product {
        min-width: 0 !important;
    }

    body.tax-product_cat .wd-products .wd-product .product-wrapper,
    body.post-type-archive-product .wd-products .wd-product .product-wrapper {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* JW866-HIDE-TOP-DISKI-CATEGORIES
 * Remove duplicate category tiles on mobile /diski/.
 * Preserve the large promotional banners below.
 */
@media (max-width: 767px) {

    body.tax-product_cat.term-diski
    .wd-content-area > .wd-products-element:has(
        > .products > .category-grid-item.product-category
    ) {
        display: none !important;
    }

}

/* JW866-DISKI-FOOTER-GAP
 * Hide the empty WoodMart prefooter (40px white strip).
 * Mobile Diski category only.
 */
@media (max-width: 767px) {
    body.tax-product_cat.term-diski .wd-prefooter {
        display: none !important;
    }
}
