.home-products {
    display: grid;
    grid-template-columns: 296px minmax(0, 1fr);
    align-items: start;
    gap: 24px;

    margin-top: 64px;
}

.home-products__title {
    margin: 0;

    color: #000000;

    font-family: "Inter", Arial, sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 36px;
}

.home-products__list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 24px;

    min-width: 0;
    margin: 0;
    padding: 0;

    list-style: none;
}

.home-products__list > li {
    min-width: 0;
}

/* Спільна картка товару. */

.sv-product-card {
    position: relative;
    isolation: isolate;

    display: flex;
    flex-direction: column;

    height: 100%;
    min-height: 450px;
    padding: 24px;

    overflow: hidden;
    border-radius: 16px;

    color: #000000;
    background-color: #ffffff;
}

.sv-product-card::after {
    content: "";

    position: absolute;
    z-index: 3;
    inset: 0;

    border: 3px solid #f5f5f5;
    border-radius: inherit;

    pointer-events: none;
}

.sv-product-card__image {
    position: absolute;
    z-index: 0;
    top: 24px;
    left: 24px;

    display: block;

    width: calc(100% - 48px);
    aspect-ratio: 1;

    color: inherit;
    text-decoration: none;
}

.sv-product-card__image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}

.sv-product-card__top {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    min-height: 36px;
}

.sv-product-card__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 6px 12px;

    border-radius: 4px;

    color: #ffffff;
    background-color: #ee6a00;

    font-family: "Inter", Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;

    white-space: nowrap;
}

.sv-product-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-left: auto;
}

.sv-product-card__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;
    padding: 0;

    border: 0;

    color: #0093ee;
    background: transparent;
}

.sv-product-card__action:disabled {
    opacity: 1;
    cursor: default;
}

.sv-product-card__action svg,
.sv-product-card__buy svg {
    display: block;
    flex-shrink: 0;
}

.sv-product-card__body {
    position: relative;
    z-index: 1;

    display: flex;
    flex-direction: column;
    gap: 16px;

    margin-top: auto;
}

.sv-product-card__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;

    min-height: 72px;
    margin: 0;

    overflow: hidden;

    font-family: "Inter", Arial, sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;

    overflow-wrap: anywhere;
}

.sv-product-card__name a {
    color: #000000;
    text-decoration: none;
}

.sv-product-card__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;

    min-height: 36px;
}

/*
 * Блок цін.
 * Резервуємо місце для двох рядків,
 * щоб ціни та кнопки залишалися на одній висоті.
 */

.sv-product-card__prices {
    position: relative;

    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0;

    min-height: 56px;
    margin: 0;
    padding: 0;
}

.sv-product-card__old-price {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;

    margin: 0;

    color: #9e9e9e;

    font-family: "Inter", Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;

    white-space: nowrap;

    text-decoration-line: line-through;
    text-decoration-thickness: 1px;
}

.sv-product-card__price {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;

    margin: 0;

    color: #000000;

    font-family: "Inter", Arial, sans-serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 32px;

    white-space: nowrap;
}

/* Підписи цін для програм читання з екрана. */

.sv-product-card__sr-only {
    position: absolute;

    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;

    overflow: hidden;
    clip-path: inset(50%);

    border: 0;

    white-space: nowrap;
}

.sv-product-card__form {
    margin: 0;
}

.sv-product-card__buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;

    min-height: 36px;
    padding: 8px 16px;

    border: 0;
    border-radius: 18px;

    color: #ffffff;
    background-color: #0093ee;

    font-family: "Inter", Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;

    text-decoration: none;
    cursor: pointer;
}

.sv-product-card__image:focus-visible,
.sv-product-card__name a:focus-visible,
.sv-product-card__buy:focus-visible {
    outline: 2px solid #0093ee;
    outline-offset: 4px;
}

@media (max-width: 1279px) {
    .home-products {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .home-products__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .home-products {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;

        margin-top: 42px;
    }

    .home-products__list {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 296px;

        overflow-x: auto;
        padding-bottom: 8px;

        scroll-snap-type: x proximity;

        /*
         * Такі самі кольори смуги прокрутки,
         * як у блоці «Схожі товари».
         */
        scrollbar-width: thin;
        scrollbar-color: #0093ee #e8f6ff;
    }

    .home-products__list::-webkit-scrollbar {
        height: 4px;
    }

    .home-products__list::-webkit-scrollbar-track {
        border-radius: 4px;
        background: #e8f6ff;
    }

    .home-products__list::-webkit-scrollbar-thumb {
        border-radius: 4px;
        background: #0093ee;
    }

    .home-products__list > li {
        scroll-snap-align: start;
    }

    /*
     * Компактні картки кінцевої категорії.
     * Не резервуємо порожній рядок старої ціни.
     */

    .catalog-browser .sv-product-card__prices {
        min-height: 0;
        max-width: 100%;
    }

    .catalog-browser .sv-product-card__bottom {
        align-items: flex-end;
    }
}