/**
 * Theme 5 product cards — shop, category, and homepage grids.
 * Restores native theme5 styling and keeps title / SKU / price rows aligned.
 */

body[class*="theme5-v"] .products-container .row > .product_item {
    display: flex;
    margin-bottom: 0;
}

body[class*="theme5-v"] .products-container .product_item .product-card {
    width: 100%;
}

/* Restore native image ratio (enhancements.css forces 100% + cover) */
body[class*="theme5-v"] .products-container .product_item .product-card-image .img-wrapper {
    padding-top: 85% !important;
    border-radius: 10px;
    background-color: var(--second-color);
    overflow: hidden;
}

body[class*="theme5-v"] .products-container .product_item .product-card-image .img-wrapper img,
body[class*="theme5-v"] .products-container .product_item .product-card-image .default-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    padding: 0;
}

body[class*="theme5-v"] .products-container .product-card-inner .product-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: auto;
}

body[class*="theme5-v"] .products-container .product-card-inner .product-content .product-content-top {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: auto;
    text-align: center;
}

body[class*="theme5-v"] .products-container .product-card-inner .product-content .product-content-bottom {
    margin-top: auto;
}

/* Equal title rhythm — always two lines */
body[class*="theme5-v"] .products-container .product-content-top h3 {
    font: var(--h6);
    margin: 0 0 10px;
    min-height: 2.7em;
    line-height: 1.35;
}

body[class*="theme5-v"] .products-container .product-content-top h3 a {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100% !important;
    width: 100%;
    line-height: 1.35;
    min-height: 2.7em;
    text-transform: none;
}

/* SKU row — reserved height */
body[class*="theme5-v"] .products-container .product-content-top .product-sku {
    margin: 0 0 5px;
    min-height: 1.25em;
    line-height: 1.25;
}

body[class*="theme5-v"] .products-container .product-content-top .product-sku--empty {
    visibility: hidden;
}

body[class*="theme5-v"] .products-container .product-content-top .price {
    margin-top: auto;
    justify-content: center;
}

/* Homepage sections */
body[class*="theme5-v"] .theme5-home-categories {
    max-width: 1320px;
    margin: 0 auto;
    width: 100%;
}

body[class*="theme5-v"] .theme5-home-categories .store-home-category {
    max-width: none;
}

body[class*="theme5-v"] .theme5-home-categories .theme5-home-products {
    padding: 0;
    margin: 0;
}

body[class*="theme5-v"] #product_view .store-home-categories .store-catalog-card {
    display: none !important;
}

@media (max-width: 575px) {
    body[class*="theme5-v"] .products-container .product-content-top h3,
    body[class*="theme5-v"] .products-container .product-content-top h3 a {
        min-height: 2.7em;
    }
}
