/* ============================================================
   iStore — product-card.css
   Стили карточки товара (.card*) + карточки related-категории.
   Используется везде, где есть карточка: главная, каталог,
   related, поиск, seeAll и т.д. Зависит от переменных theme.css.
   ============================================================ */

.card {
    flex: 0 0 300px;
    scroll-snap-align: start;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
    border-radius: 20px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow .2s;
}

@media (min-width: 900px) {
    .card {
        flex: 0 0 calc((100% - 40px) / 3);
    }
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
}

.card__media {
    position: relative;
}

.card__badges {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    gap: 4px;
    z-index: 1;
}

.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 980px;
}

.badge--new {
    background: var(--surface-alt);
    color: var(--muted);
}

.badge--sale {
    background: #d70015;
    color: #fff;
}

.card__gift-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 88px;
    height: 88px;
    background: transparent;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 9px ui-monospace, monospace;
    color: var(--muted);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.card__gift-badge img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.card__photo {
    aspect-ratio: 1/1;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 10px ui-monospace, monospace;
    color: var(--muted);
    overflow: hidden;
}

.card__photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card__name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.005em;
    overflow-wrap: anywhere; /* названия с &nbsp; из админки не должны распирать страницу */
}

.card__code {
    font-size: 12px;
    color: var(--muted);
}

.card__foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card__prices {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.card__old {
    font-size: 13px;
    color: var(--muted);
    text-decoration: line-through;
}

.card__price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.card__price {
    font-size: 19px;
    font-weight: 700;
}

.card__save {
    font-size: 12px;
    font-weight: 600;
    color: var(--danger);
}

.card__installment {
    align-self: flex-start;
    font-size: 12px;
    color: var(--muted);
    background: var(--surface-alt);
    border-radius: 980px;
    padding: 5px 10px;
}

.card__gift {
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
}

.card__buy {
    padding: 12px;
    border-radius: 980px;
    background: var(--accent);
    color: var(--accent-text);
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.card__buy:hover {
    opacity: .85;
}

.card__buy--preorder {
    background: transparent;
    color: var(--accent);
    box-shadow: inset 0 0 0 1.5px var(--accent);
}

.card__buy--preorder:hover {
    background: var(--accent);
    color: var(--accent-text);
    opacity: 1;
}

.card__buy.is-in-cart {
    background: var(--accent);
    color: var(--accent-text);
}

/* ---------- избранное (♡ в углу фото) ---------- */
.card__fav {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    padding: 0;
    line-height: 0;
    border: 0;
    cursor: pointer;
    display: flex;
    color: var(--muted);
    transition: color .15s, transform .1s;
    justify-content: center;
    align-items: center;
}
.card__fav:hover { color: var(--text); }
.card__fav svg { display: block; }
.card__fav:active { transform: scale(.9); }
.card__fav.is-in-favorite {
    color: #e0245e;
}
.card__fav.is-in-favorite svg { fill: #e0245e; stroke: #e0245e; }