/* Каталог и карточка товара */

.catalog, .pdp { padding-top: 12px; }

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.head-row .section-title { margin-bottom: 0; }
.all-doors .head-row { margin-bottom: 28px; }
.catalog-head h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.1; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chip { padding: 9px 18px; border-radius: 999px; background: var(--bg-secondary); border: 1px solid var(--card-border); font-size: 14px; font-weight: 600; transition: background-color var(--speed), color var(--speed); }
.chip:hover { background: var(--accent); color: var(--on-accent); }

.catalog-layout { display: grid; grid-template-columns: 270px 1fr; gap: 36px; margin-top: 28px; align-items: start; }

/* Фильтры */
.filters { position: sticky; top: 150px; padding: 22px; border-radius: var(--radius-m); background: var(--bg-secondary); border: 1px solid var(--card-border); }
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.filters-close, .filters-open, .filters-overlay { display: none; }
.f-group { margin: 0 0 20px; padding: 0; border: 0; }
.f-title { display: block; margin-bottom: 10px; padding: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.f-input { width: 100%; height: 42px; padding: 0 16px; border-radius: 21px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-primary); font: inherit; font-size: 14px; outline: none; transition: border-color var(--speed); }
.f-input:focus { border-color: var(--accent); }
.f-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.f-check { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.f-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.f-actions { display: flex; flex-direction: column; gap: 8px; }
.f-actions .btn { width: 100%; min-height: 44px; }

/* Результаты */
.results { min-width: 0; transition: opacity 0.2s; }
.results.is-loading { opacity: 0.45; pointer-events: none; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; font-size: 14px; color: var(--text-secondary); }
.results-count { margin-right: auto; }
.shuffle-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-primary); font: inherit; font-size: 14px; font-weight: 600; transition: background-color var(--speed), color var(--speed), border-color var(--speed); }
.shuffle-btn:hover { border-color: var(--accent); }
.shuffle-btn.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.shuffle-btn .icon-slot { width: 20px; height: 20px; }
.sort { display: flex; align-items: center; gap: 10px; }
.sort select { height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-primary); font: inherit; font-size: 14px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 36px; }
.pg { padding: 10px 20px; border-radius: 999px; background: var(--bg-secondary); font-weight: 600; font-size: 14px; transition: background-color var(--speed); }
.pg:hover { background: var(--accent); color: var(--on-accent); }
.pg-now { font-size: 14px; color: var(--text-muted); }
.empty { padding: 56px 24px; text-align: center; border: 2px dashed var(--border-color); border-radius: var(--radius-l); }
.empty h2 { margin-bottom: 10px; }
.empty p { max-width: 46ch; margin: 0 auto 24px; color: var(--text-secondary); }

/* Карточка товара */
.pdp-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(24px, 4vw, 64px); align-items: start; }
/* flex, а не grid: когда у товара одно фото, колонка миниатюр скрыта и главное фото занимает всю ширину */
.gallery { display: flex; gap: 16px; position: sticky; top: 150px; min-width: 0; }
.g-thumbs { flex: 0 0 84px; display: flex; flex-direction: column; gap: 10px; max-height: 620px; overflow-y: auto; scrollbar-width: none; }
.g-thumb { flex: none; width: 84px; height: 108px; padding: 6px; border: 2px solid transparent; border-radius: 14px; background: var(--bg-secondary); transition: border-color var(--speed); }
.g-thumb img { width: 100%; height: 100%; object-fit: contain; }
.g-thumb.is-active { border-color: var(--accent); }
.g-main { position: relative; flex: 1 1 0; min-width: 0; min-height: 480px; border-radius: var(--radius-l); background: var(--bg-secondary); overflow: hidden; }
/* Лента фото: родной горизонтальный скролл с привязкой к слайдам (свайп), на компьютере тянется мышью */
.g-track { display: flex; height: 100%; min-height: 480px; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; outline: none; transition: opacity 0.18s; }
.g-strip { display: flex; flex: 0 0 100%; min-width: 0; height: 100%; min-height: inherit; will-change: transform; transition: transform 0.42s cubic-bezier(0.22, 0.8, 0.24, 1); }
.g-strip.is-dragging { transition: none; }
.g-track.is-dragging { cursor: grabbing; }
.g-track.is-swapping { opacity: 0; }
.g-slide { flex: 0 0 100%; min-height: 480px; display: grid; place-items: center; padding: 24px; }
.g-slide img { max-height: 640px; width: auto; max-width: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.g-dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 4px; pointer-events: none; }
.g-dots button { position: relative; width: 20px; height: 20px; padding: 0; border: 0; background: none; pointer-events: auto; }
.g-dots button::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 4px; background: rgba(127, 127, 127, 0.55); transform: translate(-50%, -50%); transition: width var(--speed) var(--ease), background-color var(--speed); }
.g-dots button.is-active::after { width: 22px; background: var(--accent); }
.g-empty { display: grid; place-items: center; min-height: 480px; color: var(--text-muted); }

.pdp-sku { min-height: 20px; font-size: 13px; color: var(--text-muted); }
.pdp-info h1 { margin: 4px 0 10px; font-size: clamp(26px, 3.2vw, 38px); line-height: 1.12; }
.pdp-short { color: var(--text-secondary); }
.pdp-price { margin: 18px 0 22px; font-size: clamp(28px, 3vw, 36px); font-weight: 700; color: var(--price-color); }
.swatches-label { margin-bottom: 10px; font-size: 14px; color: var(--text-secondary); }
.swatches-label b { color: var(--text-primary); }
.swatch-row { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border: 2px solid var(--border-color); border-radius: 999px; background: transparent; font-size: 13px; font-weight: 600; transition: border-color var(--speed), transform 0.2s; }
.swatch:hover { transform: translateY(-2px); }
.swatch.is-active { border-color: var(--accent); }
.swatch-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--bg-tertiary); border: 1px solid var(--border-color); }
.buy { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.qty { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-secondary); }
.qty button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg-primary); font-size: 20px; line-height: 1; }
.qty span { min-width: 32px; text-align: center; font-weight: 700; }
.buy-btn { flex: 1; min-height: 52px; }
.buy-btn.is-added { background: #43a047; color: #fff; }
.fav-lg { position: static; width: 52px; height: 52px; box-shadow: inset 0 0 0 2px var(--border-color); }
.fav-lg.is-fav { box-shadow: none; }
.hw-btn { width: 100%; margin-top: 12px; min-height: 52px; }
.buy-note { margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.buy-note a { color: var(--text-primary); font-weight: 600; text-decoration: underline; }

.pdp-details { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(24px, 4vw, 64px); margin-top: clamp(48px, 7vw, 88px); }
.pdp-details h2 { margin-bottom: 18px; font-size: 24px; }
.pdp-desc div { color: var(--text-secondary); }
.pdp-desc p + p { margin-top: 12px; }
.pdp-specs dl { margin: 0; }
.pdp-specs dl > div { display: flex; justify-content: space-between; gap: 24px; padding: 12px 0; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.pdp-specs dt { color: var(--text-muted); }
.pdp-specs dd { margin: 0; font-weight: 600; text-align: right; }

@media (max-width: 1024px) {
    .pdp-details { grid-template-columns: 1fr; }
}

/* Планшет и телефон: фильтры в выезжающей снизу панели */
@media (max-width: 900px) {
    .catalog-layout { grid-template-columns: 1fr; }
    .filters { position: fixed; z-index: 1201; left: 0; right: 0; bottom: 0; top: auto; max-height: 86vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateY(105%); visibility: hidden; transition: transform 0.4s var(--ease), visibility 0.4s; background: var(--bg-primary); }
    .filters.open { transform: none; visibility: visible; }
    .filters-close { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: none; font-size: 22px; color: var(--text-primary); }
    .filters-overlay { display: block; position: fixed; inset: 0; z-index: 1200; background: var(--overlay-bg); opacity: 0; visibility: hidden; transition: opacity var(--speed), visibility var(--speed); }
    .filters-overlay.open { opacity: 1; visibility: visible; }
    /* Круглая кнопка справа от заголовка (только телефон и планшет; на компьютере фильтры всегда слева) */
    .filters-open { display: grid; place-items: center; flex: none; width: 46px; height: 46px; padding: 0; border: 1px solid var(--border-color); border-radius: 50%; background: var(--bg-secondary); color: var(--text-primary); transition: background-color var(--speed), color var(--speed), transform var(--speed); }
    .filters-open:active { transform: scale(0.92); background: var(--accent); color: var(--on-accent); }
}

@media (max-width: 768px) {
    .results-bar { flex-wrap: wrap; }

    .pdp-grid { grid-template-columns: 1fr; }
    .gallery { position: static; flex-direction: column; }
    .g-main { flex: none; } /* в колонке высота по содержимому, иначе фото обрезается */
    .g-thumbs { flex: none; flex-direction: row; order: 2; max-height: none; overflow-x: auto; }
    .g-thumb { width: 64px; height: 82px; }
    .g-main, .g-track, .g-slide, .g-empty { min-height: 360px; }
    .g-slide { padding: 12px 12px 28px; }
    .g-slide img { max-height: 420px; }
    .buy { flex-wrap: wrap; }
    .buy-btn { flex: 1 0 100%; order: 3; }
}

