/* ===== PRODUCTS GRID ===== */
/* Сетка товаров в каталоге */

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 340px);
    gap: 40px;
    justify-content: center;
    padding: 20px;
}

/* ===== Карточка ===== */
.products-grid__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    z-index: 1;
    padding: 18px 17.5px;
    margin: -18px -17.5px;
    box-sizing: content-box;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}


.products-grid__item:hover {
    background: #FFFAF5;
}

.products-grid__item:active {
    border: 1px solid rgba(246, 136, 27, 0.31);
}

/* ===== Обёртка картинки ===== */
.products-grid__image-wrapper {
    position: relative;
    width: 100%;
    height: 340px;
}


.product-gallery__discount--slider {
    position: absolute;
    bottom: 10px;
    right: 20px;
    z-index: 5;
    width: 115px;
    height: 70px;
    background: url("/local/templates/my/images/background/oldpricesprite.png") no-repeat center;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px 24px 32px;
    box-sizing: border-box;
    color: #005C67;
    font-family: "Alegreya SC", serif;
    font-size: 32px;
    font-style: normal;
    font-weight: 800;
    line-height: 22.4px;
    letter-spacing: 1.12px;
    text-transform: uppercase;
    font-variant-numeric: lining-nums proportional-nums;
    white-space: nowrap;
}

.products-grid__image-link {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.products-grid__image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    -webkit-mask-image: url("/local/templates/my/images/masks/news-mask.svg");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: cover;
    mask-image: url("/local/templates/my/images/masks/news-mask.svg");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: cover;
    transition: transform 0.3s ease;
}

/* Избранное */
.products-grid__favorite {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 22px;
    height: 20px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    z-index: 5;
    color: #fff;
    display: block;
    transition: color .25s ease, transform .25s ease;
}

.products-grid__favorite-icon svg {
    width: 22px;
    height: 20px;
    display: block;
    fill: currentColor;
}

.products-grid__favorite:not(.is-active):hover {
    color: #E61734;
    transform: scale(1.15);
    transform-origin: center;
}

.products-grid__favorite.is-active {
    color: #E61734;
}

/* ===== ТЕГ ===== */
.products-grid__label {
    display: flex;
    width: 193px;
    height: 34px;
    padding: 16px 0px;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    border: 2px solid #F6881B;
    background: transparent;
    color: #664E1F;
    text-align: center;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 120%;
    box-sizing: border-box;
}

.products-grid__label.is-empty {
    visibility: hidden;
}

/* ===== Контент ===== */
.products-grid__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 0 8px;
}

.products-grid__name {
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    min-height: calc(2 * 1.2em);
}

.products-grid__name a {
    color: #000;
    font-family: "PT Astra Serif", serif;
    font-size: 24px;
    font-style: italic;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    text-underline-offset: 2px;
    transition: text-decoration-color 0.3s ease;
}

.products-grid__name a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.products-grid__type {
    color: #111;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    font-style: normal;
    min-height: 14px;
}

.products-grid__type.is-empty {
    visibility: hidden;
    opacity: 1;
}

/* Цена */
.products-grid__price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.products-grid__price {
    color: #222322;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 32px;
    font-style: normal;
    font-weight: 500;
    line-height: 22.4px;
    letter-spacing: 1.12px;
}

.products-grid__price.is-empty {
    visibility: hidden;
    opacity: 1;
}

.products-grid__old-price {
    color: #C3C7C3;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 32px;
    font-style: normal;
    font-weight: 500;
    line-height: 22.4px;
    letter-spacing: 1.12px;
    text-decoration: line-through;
    font-variant-numeric: lining-nums proportional-nums;
}

/* Кнопки */
.products-grid__buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    width: 100%;
    align-items: center;
}

.products-grid__btn {
    padding: 10px 16px;
    border-radius: 4px;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.12px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    line-height: 12.6px;
}

.products-grid__btn--buy {
    border: 1px solid #005C67;
    background: #005C67;
    color: #FFFFFF;
}

.products-grid__btn--buy:hover {
    border: 1px solid #F6881B;
    background: transparent;
    color: #222322;
}

.products-grid__btn--buy:active {
    border: 1px solid #F6881B;
    background: #F6881B;
    color: #FFF;
}

.products-grid__btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.products-grid__btn.is-in-cart {
    border: 1px solid #005C67;
    background: transparent;
    color: #005C67;
}

.products-grid__btn.is-in-cart:hover {
    border: 1px solid #F6881B;
    background: transparent;
    color: #F6881B;
}

.products-grid__btn.is-in-cart:active {
    border: 1px solid #005C67;
    background: #005C67;
    color: #FFFFFF;
}

/* Прослушать фрагмент */
.products-grid__listen-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: #005C67;
    text-decoration: underline;
    text-underline-offset: 2px;
    letter-spacing: .5px;
    white-space: nowrap;
    transition: color .25s ease;
}

.products-grid__listen-icon {
    display: inline-flex;
    transition: transform .25s ease;
}

.products-grid__listen-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
    transition: fill .25s ease;
}

.products-grid__listen-link:hover {
    color: #F6881B;
    text-decoration: underline;
}

.products-grid__listen-link:hover .products-grid__listen-icon {
    transform: rotate(30deg);
}

.products-grid__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 14px;
}

.products-grid__lang {
    display: flex;
    align-items: center;
    gap: 6px;
}

.products-grid__lang-icon {
    display: inline-flex;
    align-items: center;
    color: #005C67;
    flex-shrink: 0;
}

.products-grid__lang-values {
    color: #111;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
}

/* ============================================================
   MEDIA QUERIES
   ============================================================ */

/* ===== 1728px — 3 карточки ===== */
@media (max-width: 1728px) {
    .products-grid {
        grid-template-columns: repeat(3, 340px);
    }
}

/* ===== 1200px — 2 карточки ===== */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(2, 340px);
    }

    /* Прослушать фрагмент в 2 строки */
    .products-grid__listen-link {
        flex-direction: row;
        align-items: center;
        white-space: normal;
        max-width: 90px;
        text-align: left;
        line-height: 1.3;
    }

    .products-grid__listen-icon {
        flex-shrink: 0;
        align-self: center;
    }
}

/* ===== 850px — 2 карточки 320px ===== */
@media (max-width: 850px) {
    .products-grid {
        grid-template-columns: repeat(2, 320px);
        gap: 30px;
    }

    .products-grid__item {
        padding: 16px 16px;
        margin: -16px -16px;
    }

    .products-grid__image-wrapper {
        height: 320px;
    }

    .products-grid__listen-link {
        flex-direction: row;
        align-items: center;
        white-space: normal;
        max-width: 90px;
        text-align: left;
        line-height: 1.3;
    }

    .products-grid__listen-icon {
        flex-shrink: 0;
        align-self: center;
    }
}

/* ===== 768px — 2 карточки 300px ===== */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 300px);
        gap: 30px;
    }

    .products-grid__item {
        padding: 14px 14px;
        margin: -14px -14px;
    }

    .products-grid__image-wrapper {
        height: 300px;
    }

    .products-grid__name a {
        font-size: 20px;
    }

    .products-grid__listen-link {
        max-width: 80px;
        font-size: 12px;
    }
}

/* ===== 720px — 2 карточки 280px ===== */
@media (max-width: 720px) {
    .products-grid {
        grid-template-columns: repeat(2, 280px);
        gap: 24px;
    }

    .products-grid__item {
        padding: 12px 12px;
        margin: -12px -12px;
    }

    .products-grid__image-wrapper {
        height: 280px;
    }
}

/* ===== 680px — 1 карточка 340px ===== */
@media (max-width: 680px) {
    .products-grid {
        grid-template-columns: 340px;
        gap: 40px;
    }

    .products-grid__item {
        padding: 18px 17.5px;
        margin: -18px -17.5px;
    }

    .products-grid__image-wrapper {
        height: 340px;
    }
}

/* ===== 420px — 1 карточка 300px ===== */
@media (max-width: 420px) {
    .products-grid {
        grid-template-columns: 300px;
    }

    .products-grid__item {
        padding: 14px 14px;
        margin: -14px -14px;
    }

    .products-grid__image-wrapper {
        height: 300px;
    }

    .products-grid__listen-link {
        max-width: 80px;
        font-size: 12px;
    }
}

/* ===== 360px — 1 карточка 260px ===== */
@media (max-width: 360px) {
    .products-grid {
        grid-template-columns: 260px;
    }

    .products-grid__item {
        padding: 10px 10px;
        margin: -10px -10px;
    }

    .products-grid__image-wrapper {
        height: 260px;
    }

    .products-grid__name a {
        font-size: 18px;
    }

    .products-grid__listen-link {
        max-width: 70px;
        font-size: 11px;
    }
}

/* ===== Пагинация ===== */
.pagination-wrapper {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}