/* =========================================================
   Office Store — Windows category cards
   Scope: product category term ID 887 only
   Keeps the existing Flickity carousel and PHP/JS hooks intact.
   ========================================================= */

body.tax-product_cat.term-887 #main .products.row.ofs-windows-carousel-fixed {
    direction: rtl;
    margin-bottom: 24px;
}

/*
 * Before Flickity initializes, keep the products in a horizontally
 * scrollable row instead of briefly showing the full product grid.
 * All product links remain in the HTML, and users can still scroll
 * the row if JavaScript fails.
 */
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed:not(.flickity-enabled) {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

/* The outer .col is the product item before Flickity initialization. */
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed:not(.flickity-enabled) > .product-small.col {
    box-sizing: border-box;
    width: 25%;
    max-width: 25%;
    flex: 0 0 25%;
    min-width: 0;
    scroll-snap-align: start;
}

/* The actual product card is inside the outer WooCommerce column. */
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .product-small.box {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0 8px 12px;
}

/* Keep real carousel cells consistent after initialization.
   Support both WooCommerce's outer .col wrapper and direct .box cells. */
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed > .product-small.box,
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .flickity-slider > .product-small.box,
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed.flickity-enabled
.flickity-slider > .product-small.col {
    box-sizing: border-box;
    width: 25%;
    max-width: 25%;
    flex: 0 0 25%;
    min-width: 0;
}

/* Image area */
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .box-image {
    box-sizing: border-box;
    display: flex;
    flex: 0 0 245px;
    align-items: center;
    justify-content: center;
    height: 245px;
    padding: 8px 6px;
    overflow: hidden;
}

body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .box-image a {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .box-image img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 225px !important;
    object-fit: contain;
    object-position: center;
    margin: 0 auto;
}

/* Card text: fixed image/title rhythm and prices aligned at the bottom. */
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .box-text {
    box-sizing: border-box;
    display: flex;
    flex: 1 0 132px;
    flex-direction: column;
    min-height: 132px;
    padding: 8px 5px 12px;
    text-align: center;
}

body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .title-wrapper {
    min-height: 3.3em;
}

body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .name,
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .product-title {
    line-height: 1.65;
    margin-bottom: 6px;
}

/* Reserve a consistent rating row where the theme outputs a rating. */
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .star-rating {
    min-height: 18px;
    margin-bottom: 4px;
}

/* Keep prices aligned even when some products have no rating. */
body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .price-wrapper {
    margin-top: auto;
}

body.tax-product_cat.term-887 #main
.products.row.ofs-windows-carousel-fixed .price {
    line-height: 1.7;
}

/* Tablet */
@media (min-width: 550px) and (max-width: 849px) {
    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed:not(.flickity-enabled) > .product-small.col {
        width: 33.333333%;
        max-width: 33.333333%;
        flex-basis: 33.333333%;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed > .product-small.box,
    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .flickity-slider > .product-small.box,
    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed.flickity-enabled
    .flickity-slider > .product-small.col {
        width: 33.333333%;
        max-width: 33.333333%;
        flex-basis: 33.333333%;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .product-small.box {
        padding-inline: 6px;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .box-image {
        height: 215px;
        flex-basis: 215px;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .box-image img {
        max-height: 195px !important;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .box-text {
        flex-basis: 126px;
        min-height: 126px;
    }
}

/* Mobile */
@media (max-width: 549px) {
    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed:not(.flickity-enabled) > .product-small.col {
        width: 50%;
        max-width: 50%;
        flex-basis: 50%;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed > .product-small.box,
    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .flickity-slider > .product-small.box,
    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed.flickity-enabled
    .flickity-slider > .product-small.col {
        width: 50%;
        max-width: 50%;
        flex-basis: 50%;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .product-small.box {
        padding-inline: 4px;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .box-image {
        height: 175px;
        flex-basis: 175px;
        padding: 5px 3px;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .box-image img {
        max-height: 160px !important;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .box-text {
        flex-basis: 118px;
        min-height: 118px;
        padding: 7px 3px 10px;
    }

    body.tax-product_cat.term-887 #main
    .products.row.ofs-windows-carousel-fixed .title-wrapper {
        min-height: 3em;
    }
}
