.products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    width: 100%;
    max-width: 100%;
    justify-content: center;
    padding: 0 32px 72px 32px !important;
    box-sizing: border-box;
}
/* Ограничиваем максимальную ширину карточек */
.products li {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0;
    list-style: none;
    position: relative;
    float: none;
    clear: none;
    justify-self: stretch; /* Растягиваем на всю доступную ширину */
}


/* Изменяем высоту изображения для соответствия 1920px */
.products li img {
    width: 100%;
    height: 475px;
    background-color: #F8F8F8;
    object-fit: cover;
    display: block;
}

.has-gallery-images img {
    height: 475px; /* согласуем с основным стилем */
}

.products li a span span {
    font-size: 18px;
    line-height: 1.2;
}


.woocommerce-loop-product__link span.price span.woocommerce-Price-amount.amount bdi, .woocommerce-loop-product__link span.price span.woocommerce-Price-amount.amount bdi span {
    font-family: Manrope, sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: #7A7A7A;
}
.products li a {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-decoration: none;
}

/* Остальные стили остаются без изменений */
.products:before,
.products:after {
    display: none !important;
    content: none !important;
}

.products li:before,
.products li:after {
    display: none !important;
    content: none !important;
}

.products li.first,
.products li.last {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.products li {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

.woocommerce-loop-product__title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.woocommerce-loop-product__title {
    font-size: 18px !important;
    font-weight: 400 !important;
    font-family: 'Manrope', sans-serif !important;
    /* text-transform: capitalize !important; */
    color: #1F1F1F;
    margin: 0 !important;
}

.woocommerce-loop-product__title-icon {
    height: 20px !important;
    width: 20px !important;
    margin: 0 !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
}

.product__title-variation-info {
    font-size: 18px !important;
    font-weight: 400;
    font-family: 'Manrope', sans-serif !important;
    line-height: normal;
    display: block;
    margin-top: 2px;
}

.products li a .price {
    display: block;
    margin-top: 5px;
}

.products li a > span {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

.products li a span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #1F1F1F;
    font-size: 16px;
    font-weight: 700;
}

.has-gallery-images {
    position: relative;
    display: block;
    width: 100%;
}


.has-gallery-images img:last-child {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}


@media (min-width: 1800px) {
    .products {
        grid-template-columns: repeat(5, 1fr);
        gap: 42px; /* как в 1920px макете */
    }

    .products li img {
        height: 400px;
    }
}

@media (min-width: 1400px) and (max-width: 1799px) {
    .products {
        grid-template-columns: repeat(4, 1fr);
        gap: 42px; /* как в 1920px макете */
    }

    .products li img {
        height: 400px;
    }
}

/* 1000px - меняем высоту изображения и отступы */
@media (max-width: 1399px) {
    .products {
        grid-template-columns: repeat(4, 1fr);
    }

    .products li img {
        height: 400px;
    }
}

@media (max-width: 1000px) {
    .products {
        gap: 24px;
    }

    .products li img {
        height: 300px;
    }
}


@media (max-width: 768px) {
    .products {
        grid-template-columns: repeat(3, 1fr);

    }

    .products li img {
        height: 275px;
    }
}

@media (max-width: 480px) {
    .products {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 20px 72px 20px !important;
    }

    .products li img {
        height: 250px;
    }
}

/* 320px - 2 колонки с уменьшенными элементами */
@media (max-width: 320px) {
    .products {
        grid-template-columns: repeat(2, 1fr);
    }

    .products li {
        max-width: 136px !important; /* как в 320px макете */
    }
    
    .products li img {
        height: 200px !important; /* как в 320px макете */
        padding: 0 !important; /* убираем padding */
    }
    
    .has-gallery-images img {
        height: 170px !important;
    }
    
    /* Изменяем размеры текста как в 320px макете */
    .woocommerce-loop-product__title {
        font-size: 14px !important;
    }
    
    .products li a span span,
    .woocommerce-loop-product__link span.price span.woocommerce-Price-amount.amount bdi,
    .woocommerce-loop-product__link span.price span.woocommerce-Price-amount.amount bdi span {
        font-size: 14px !important;
    }
    
    .woocommerce-loop-product__title-icon {
        height: 16px !important;
        width: 16px !important;
    }
}


@media (hover: hover) and (pointer: fine) {
    .products li:hover .has-gallery-images img:first-child {
        opacity: 0;
    }

    .products li:hover .has-gallery-images img:last-child {
        opacity: 1;
    }
}