/* =========================================================
   ColorHub — каталог и карточка товара
   ========================================================= */

/* ---------- Page hero / breadcrumb ---------- */
.page-top {
  padding-top: 130px;
  padding-bottom: 30px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
}
.crumbs a { color: var(--muted); transition: color .2s; }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { color: var(--ink); font-weight: 600; }
.page-title { font-size: clamp(30px, 4.4vw, 50px); margin-top: 18px; }
.page-sub { color: var(--muted); margin-top: 12px; max-width: 620px; }

/* ---------- Catalog layout ---------- */
.shop {
  display: grid;
  grid-template-columns: 264px 1fr;
  gap: 40px;
  align-items: start;
}
.shop__aside {
  position: sticky;
  top: 98px;
  max-height: calc(100vh - 118px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
}
.shop__aside::-webkit-scrollbar { width: 8px; }
.shop__aside::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.shop__aside::-webkit-scrollbar-thumb:hover { background: var(--faint); }
.filter-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: #fff;
  margin-bottom: 18px;
}
.filter-card h4,
.filter-card summary {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .02em;
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.filter-card summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
}
.filter-card summary::-webkit-details-marker { display: none; }
.filter-card summary::after {
  content: "";
  width: 9px; height: 9px;
  border-right: 1.6px solid var(--faint);
  border-bottom: 1.6px solid var(--faint);
  transform: rotate(45deg);
  transition: transform .2s;
  flex-shrink: 0;
}
.filter-card[open] summary::after { transform: rotate(-135deg); }
.filter-card[open] summary { margin-bottom: 16px; }
.filter-card .filter-list { margin-top: 0; }
.filter-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.filter-list a {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--ink-soft);
  transition: background .2s, color .2s;
}
.filter-list a:hover { background: var(--bg-soft); }
.filter-list a.is-active { background: var(--primary-tint); color: var(--primary); font-weight: 600; }
.filter-list a .count { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.filter-list a.is-active .count { color: var(--primary); }
.filter-list a .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.filter-check { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.filter-check input { width: 17px; height: 17px; accent-color: var(--primary); }

/* ---------- Toolbar ---------- */
.shop__toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.shop__count { font-size: 14px; color: var(--muted); }
.shop__count b { color: var(--ink); font-family: var(--font-mono); }
.sort-select {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font: inherit; font-size: 14px;
  background: #fff;
  color: var(--ink);
}

/* ---------- Product grid + card ---------- */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 20px;
}
.prod-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s;
}
.prod-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: transparent; }
.prod-card__media {
  position: relative;
  aspect-ratio: 1;
  background:
    radial-gradient(120% 100% at 50% 0%, #f3f5fb, #fff);
  display: grid; place-items: center;
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}
.prod-card__media .ph {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .04em;
  text-align: center;
  padding: 12px;
}
.prod-card__media img { width: 100%; height: 100%; object-fit: cover; }
.prod-card__badge {
  position: absolute; top: 12px; left: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: var(--radius-pill);
  background: #fff; border: 1px solid var(--line);
  color: var(--c, var(--primary));
}
.prod-card__fav {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--muted);
  opacity: 0; transform: translateY(-4px);
  transition: opacity .3s, transform .3s, color .2s, border-color .2s;
}
.prod-card:hover .prod-card__fav { opacity: 1; transform: none; }
.prod-card__fav:hover { color: var(--c-red); border-color: var(--c-red); }
.prod-card__fav svg { width: 17px; height: 17px; }
.prod-card__body { padding: 18px; display: flex; flex-direction: column; flex: 1; }
.prod-card__brand { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; color: var(--primary); margin-bottom: 7px; }
.prod-card__title { font-weight: 600; font-size: 15.5px; line-height: 1.35; color: var(--ink); margin-bottom: 8px; }
.prod-card__meta { font-size: 13px; color: var(--muted); margin-bottom: 16px; flex: 1; }
.prod-card { position: relative; }
.prod-card__foot { margin-top: auto; }
.prod-card__btn {
  width: 100%; height: 44px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 14px; color: var(--primary);
  transition: background .25s, color .25s, border-color .25s;
}
.prod-card__btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.prod-card__btn svg { width: 18px; height: 18px; transition: transform .25s; }
.prod-card__btn:hover svg { transform: translateX(3px); }
/* Вся карточка кликабельна (stretched link). */
.prod-card__btn::after { content: ""; position: absolute; inset: 0; z-index: 1; }

/* ---------- Pagination ---------- */
.pager { margin-top: 44px; }
.pager .nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pager .page-numbers {
  min-width: 42px; height: 42px; padding: 0 12px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; color: var(--ink-soft);
  transition: all .2s;
}
.pager a.page-numbers:hover { border-color: var(--ink); }
.pager .page-numbers.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .page-numbers.dots { border-color: transparent; }

@media (max-width: 880px) {
  /* Порядок на мобильном: разделы -> подразделы -> товары -> бренды.
     display:contents «растворяет» aside, чтобы карточки фильтров
     стали прямыми детьми .shop и могли встать по разные стороны сетки. */
  .shop { display: flex; flex-direction: column; gap: 0; align-items: stretch; }
  .shop__aside { display: contents; }
  .filter-card--sections { order: 1; }
  .filter-card--subcats  { order: 2; }
  .shop__main            { order: 3; }
  .filter-card--brands   { order: 4; margin-top: 28px; margin-bottom: 0; }
  .shop__toolbar { margin-bottom: 16px; }
  .filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Явный намёк: по шапке можно тапнуть и она развернётся */
  .filter-card { padding: 0; overflow: hidden; }
  .filter-card summary {
    padding: 16px 18px;
    margin-bottom: 0;
    font-size: 14px;
    background: var(--bg-soft);
    -webkit-tap-highlight-color: transparent;
  }
  .filter-card[open] summary { margin-bottom: 0; border-bottom: 1px solid var(--line); }
  .filter-card summary::before {
    content: "развернуть";
    order: 2;
    margin-left: auto;
    margin-right: 10px;
    font-family: var(--font-body, inherit);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--faint);
  }
  .filter-card[open] summary::before { content: "свернуть"; }
  .filter-card summary::after {
    order: 3;
    width: 8px; height: 8px;
    border-color: var(--primary);
    margin-right: 4px;
  }
  .filter-card .filter-list { padding: 10px 12px 14px; }
  .filter-list a { padding: 12px; font-size: 15px; }
}

/* =========================================================
   Single product
   ========================================================= */
.product {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}
.product__gallery { position: sticky; top: 98px; }
.product__main {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 100% at 50% 0%, #f3f5fb, #fff);
  display: grid; place-items: center;
  overflow: hidden;
}
.product__main .ph { font-family: var(--font-mono); font-size: 12px; color: var(--faint); text-align: center; }
.product__main img { width: 100%; height: 100%; object-fit: cover; }
.product__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.product__thumb {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft); cursor: pointer; transition: border-color .2s;
}
.product__thumb.is-active { border-color: var(--primary); border-width: 2px; }

.product__brand { font-family: var(--font-mono); font-size: 13px; letter-spacing: .06em; color: var(--primary); }
.product__title { font-size: clamp(26px, 3.4vw, 40px); margin: 12px 0 16px; }
.product__lead { color: var(--muted); font-size: 16px; line-height: 1.65; }
.product__price-row { display: flex; align-items: baseline; gap: 14px; margin: 26px 0; flex-wrap: wrap; }
.product__price { font-family: var(--font-display); font-weight: 800; font-size: 34px; }
.product__price small { font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--muted); }
.product__stock { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--c-green); font-weight: 600; }
.product__stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c-green); }
.product__actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0; }
.product__note { font-size: 13.5px; color: var(--muted); display: flex; gap: 10px; align-items: flex-start; padding: 16px; background: var(--bg-soft); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.product__note svg { width: 20px; height: 20px; color: var(--primary); flex-shrink: 0; margin-top: 1px; }

/* Блок отдела продаж вместо цены */
.product__sales { margin: 24px 0 20px; }
.product__sales-text { font-size: 15px; line-height: 1.55; color: var(--text); font-weight: 500; }
.product__sales .product__actions { margin: 14px 0 0; }

/* Оптовая плашка-ссылка на форму заявки */
.product__note--cta { text-decoration: none; transition: border-color .25s ease, background .25s ease, transform .25s ease; }
.product__note--cta:hover { border-color: var(--primary); background: var(--bg); transform: translateY(-2px); }
.product__note--cta strong { color: var(--primary); font-weight: 600; white-space: nowrap; }

/* Specs table */
.specs { width: 100%; border-collapse: collapse; margin-top: 16px; }
.specs tr { border-bottom: 1px solid var(--line-soft); }
.specs td { padding: 13px 0; font-size: 14.5px; vertical-align: top; }
.specs td:first-child { color: var(--muted); width: 45%; }
.specs td:last-child { color: var(--ink); font-weight: 500; }

/* Tabs */
.ptabs { margin-top: 12px; }
.ptabs__nav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.ptabs__nav button {
  background: none; border: none; padding: 14px 18px;
  font-weight: 600; font-size: 15px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .2s, border-color .2s;
}
.ptabs__nav button.is-active { color: var(--ink); border-bottom-color: var(--primary); }
.ptabs__panel { display: none; font-size: 15px; line-height: 1.7; color: var(--ink-soft); }
.ptabs__panel.is-active { display: block; }
.ptabs__panel ul { margin: 0; padding-left: 20px; }
.ptabs__panel li { margin-bottom: 8px; }
.section-docs__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.doc-instructions { margin-bottom: 26px; }
.doc-instructions h3, .doc-instructions h4 { font-size: 16px; font-weight: 600; color: var(--ink); margin: 18px 0 8px; }
.doc-instructions h3:first-child, .doc-instructions h4:first-child { margin-top: 0; }
.doc-instructions p { margin: 0 0 10px; }
.doc-instructions ul { margin: 0 0 10px; padding-left: 20px; }
.doc-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 10px; transition: border-color .2s, background .2s;
}
.doc-row:hover { border-color: var(--primary); background: var(--primary-tint); }
.doc-row svg.f { width: 28px; height: 28px; color: var(--c-red); flex-shrink: 0; }
.doc-row b { font-size: 14.5px; display: block; }
.doc-row span { font-size: 12.5px; color: var(--muted); }
.doc-row .dl { margin-left: auto; color: var(--primary); }

@media (max-width: 880px) {
  .product { grid-template-columns: 1fr; }
  .product__gallery { position: static; }
}

/* ---------- Тщательный мобильный проход ---------- */
@media (max-width: 768px) {
  .page-top { padding-top: 92px; padding-bottom: 22px; }
  .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  /* Табы карточки: горизонтальная прокрутка вместо некрасивого переноса */
  .ptabs__nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .ptabs__nav::-webkit-scrollbar { display: none; }
  .ptabs__nav button { white-space: nowrap; padding: 12px 14px; font-size: 14.5px; }
  .product__main { border-radius: var(--radius); }
}
@media (max-width: 480px) {
  .prod-grid { grid-template-columns: 1fr; }
  .product__title { margin-top: 8px; }
  .product__thumbs { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .specs td { padding: 11px 0; font-size: 14px; }
  .doc-row { padding: 13px; gap: 11px; }
  .pager .page-numbers { min-width: 38px; height: 38px; }
}

/* =========================================================
   Поиск по каталогу (.ch-search) + живые подсказки
   ========================================================= */
.ch-search {
  position: relative;
  margin-top: 26px;
  max-width: 720px;
}
.ch-search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.ch-search__field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}
.ch-search__ic {
  width: 20px; height: 20px;
  flex: none;
  color: var(--faint);
}
.ch-search__field:focus-within .ch-search__ic { color: var(--primary); }
.ch-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  padding: 12px 0;
}
.ch-search__input::placeholder { color: var(--faint); }
.ch-search__input::-webkit-search-cancel-button { display: none; }
.ch-search__clear {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--bg-soft);
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.ch-search__clear svg { width: 15px; height: 15px; }
.ch-search__clear:hover { background: var(--line); color: var(--ink); }
.ch-search__submit {
  flex: none;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 26px;
  cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.ch-search__submit:hover { background: var(--primary-hover); }
.ch-search__submit:active { transform: scale(.97); }

/* ---------- Панель подсказок ---------- */
.ch-search__panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 10px);
  left: 0; right: 0;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  animation: chSgIn .18s var(--ease-out) both;
}
@keyframes chSgIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ch-search__panel { animation: none; } }

.ch-sg__group { padding: 6px 4px; }
.ch-sg__group + .ch-sg__group { border-top: 1px solid var(--line-soft); }
.ch-sg__label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 6px 10px;
}
.ch-sg__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 15px;
  text-decoration: none;
}
.ch-sg__row svg { width: 17px; height: 17px; flex: none; color: var(--faint); }
.ch-sg__row em { margin-left: auto; font-style: normal; font-size: 12.5px; color: var(--faint); }
.ch-sg__row:hover, .ch-sg__row.is-active,
.ch-sg__prod:hover, .ch-sg__prod.is-active { background: var(--bg-soft); }

.ch-sg__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 10px 8px; }
.ch-sg__chip {
  display: inline-flex;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color .2s, color .2s, background .2s;
}
.ch-sg__chip:hover, .ch-sg__chip.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-tint);
}

.ch-sg__prod {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
}
.ch-sg__img {
  width: 48px; height: 48px;
  flex: none;
  border-radius: 10px;
  background: var(--bg-soft);
  overflow: hidden;
  display: grid; place-items: center;
}
.ch-sg__img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.ch-sg__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ch-sg__txt b {
  font-family: var(--font-display);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}
.ch-sg__name {
  font-size: 14.5px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ch-sg__txt i { font-style: normal; font-size: 12px; color: var(--faint); font-family: var(--font-mono); }
.ch-search__panel mark { background: rgba(28,117,188,.16); color: inherit; border-radius: 3px; padding: 0 1px; }

.ch-sg__all {
  display: block;
  text-align: center;
  margin: 6px 4px 4px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
}
.ch-sg__all:hover { background: var(--primary-tint); }

.ch-sg__empty {
  padding: 22px 16px;
  text-align: center;
  color: var(--ink);
  font-size: 15px;
}
.ch-sg__empty span { display: block; margin-top: 8px; color: var(--muted); font-size: 13.5px; }
.ch-sg__ask {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.ch-sg__ask:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Пустая выдача на странице результатов ---------- */
.ch-noresults {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px);
  background: var(--bg-soft);
}
.ch-noresults h2 { font-size: clamp(20px, 2.6vw, 26px); margin: 0 0 10px; }
.ch-noresults p { color: var(--muted); margin: 0 0 18px; }
.ch-noresults__tips { display: flex; flex-wrap: wrap; gap: 10px; }
.ch-search-note {
  margin: -6px 0 22px;
  font-size: 14.5px;
  color: var(--muted);
}
.ch-search-note a { color: var(--primary); font-weight: 600; }

@media (max-width: 640px) {
  .ch-search { margin-top: 20px; }
  .ch-search__field { padding-left: 14px; gap: 8px; }
  .ch-search__submit { padding: 11px 16px; font-size: 14px; }
  .ch-search__input { font-size: 16px; padding: 11px 0; }
  .ch-search__panel { max-height: 62vh; }
}

.ch-sg__row small { color: var(--faint); font-size: 12.5px; margin-left: 4px; }
