/* ============================================================
   «Бизнес ПК» — ОБЩИЕ СТИЛИ КАРТОЧКИ КАТАЛОГА (card.css)
   Новый визуальный язык (TZ-VISUAL-DIRECTION): белая панель
   radius 14 на полотне, фото сверху, тёмный CTA #101114.
   Порядок: theme-mono -> ui/* -> site.css -> card.css
            -> <page>.css
   Подключают: computers.html, minicomputers.html, periphery.html
   ============================================================ */

/* ---------- Заголовок страницы (старый класс — для periphery) ---------- */
.page-title {
    max-width: min(100% - 48px, var(--container));
    margin: 64px auto 40px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    color: var(--nv-tx);
}

/* ---------- Сетка товаров ---------- */
.products-grid {
    width: min(100% - 48px, 1160px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));   /* desktop: 3 */
    gap: 22px;
    align-items: stretch;
}

/* ---------- Карточка товара ---------- */
.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: 100%;
    min-width: 0;
    padding: 0;
    background: var(--nv-panel);
    border: 1px solid var(--nv-line);
    border-radius: var(--radius-card);
    box-shadow: 0 2px 10px rgba(16, 17, 20, 0.04);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(16, 17, 20, 0.1);
    border-color: #d9d9df;
}

/* Порядок блоков: фото -> название -> конфигурация (DOM порядок
   задаёт product-card.js; здесь только визуальная раскладка). */
.product-card .card-media   { order: 1; }
.product-card .card-name    { order: 2; }
.product-card .card-content { order: 3; }

/* Название товара */
.card-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 2.6em;
    margin: 0;
    padding: 14px 20px 0;
    font-size: 16.5px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: var(--nv-tx);
}

/* ---------- Изображение ---------- */
.card-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 170px;
    margin: 0;
    background: var(--color-surface-soft);
    border-radius: 13px 13px 0 0;
    overflow: hidden;
    cursor: zoom-in;
}
.card-media:focus-visible { outline: 2px solid var(--nv-tx); outline-offset: -2px; }

.card-img {
    max-width: 100%;
    max-height: 142px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.product-card:hover .card-img { transform: scale(1.03); }

/* ---------- Листалка фото (стрелки + счётчик) ----------
   Только если фото больше одного (иначе не рендерится).
   На десктопе — по наведению, на таче — всегда видны. */
.card-gal-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nv-tx);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--nv-line);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(16, 17, 20, 0.12);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.card-gal-nav.is-prev { left: 8px; transform: translateY(-50%); }
.card-gal-nav.is-next { right: 8px; transform: translateY(-50%); }
.card-gal-nav.is-prev:hover { transform: translateY(-50%) translateX(-1px); }
.card-gal-nav.is-next:hover { transform: translateY(-50%) translateX(1px); }
.card-gal-nav svg { width: 16px; height: 16px; }
.card-gal-nav:focus-visible { opacity: 1; outline: 2px solid var(--nv-tx); outline-offset: 1px; }
.product-card:hover .card-gal-nav { opacity: 1; }
@media (hover: none) {
    .card-gal-nav { opacity: 1; }
}
.card-gal-count {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--nv-tx-2);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--nv-line);
    border-radius: 999px;
    pointer-events: none;
}

.card-ph {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.card-ph svg {
    width: 72px;
    height: auto;
    opacity: 0.5;
    color: var(--nv-tx-3);
}

/* ---------- Содержимое карточки ----------
   flex-column, занимает всё свободное место; футер
   (.card-foot) прижат к низу через margin-top:auto. */
.card-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0;
    padding: 14px 20px 20px;
}

/* ---------- Адаптивность ---------- */
@media (max-width: 1100px) {
    .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* tablet: 2 */
}

@media (max-width: 640px) {
    .page-title { margin-top: 44px; font-size: 24px; }
    .products-grid { width: min(100% - 32px, 1160px); grid-template-columns: 1fr; gap: 16px; }
    .card-media { height: 158px; }
}

/* ---------- Ссылки на страницу товара (страницы товаров) ----------
   Фото и название карточки ведут на /product/<id> настоящими
   ссылками (работают без JS). Кнопка «В корзину», селекты CPU/RAM/SSD
   и «Все характеристики» (модалка) — без перехода, как были. */
.card-name-link { color: inherit; text-decoration: none; }
.card-name-link:hover { text-decoration: underline; }
.card-media.is-linked { cursor: default; }
.card-media-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    cursor: pointer;
}
.card-media-link:focus-visible { outline: 2px solid var(--nv-tx); outline-offset: -2px; }
