/* ============================================================
   CATALOG / CATEGORY — molecmag (Фаза 1: ядро страницы)
   ============================================================ */
.catalog { padding: 24px 0 64px; }
.catalog__breadcrumb {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 16px; padding: 0;
  font-size: 13px; color: var(--text-tertiary);
}
.catalog__breadcrumb li:not(:last-child)::after { content: '/'; margin-left: 6px; color: var(--text-tertiary); }
.catalog__breadcrumb a { color: var(--text-secondary); }
.catalog__breadcrumb li:last-child a { color: var(--text-primary); }

.catalog__title { margin: 0 0 12px; font: 600 clamp(24px, 2.6vw, 36px)/1.15 'Rubik', sans-serif; color: var(--text-primary); }

/* SEO-описание под каталогом — отдельная карточка, текст свёрнут и раскрывается.
   Фейд затухает в фон карточки (не «белым по нашему фону»). */
.catalog__seo {
  margin: 48px 0 0;
  padding: clamp(22px, 2.4vw, 32px) clamp(22px, 2.6vw, 36px);
  background: var(--bg-tertiary);
  border: 1px solid rgba(27,29,34,.06);
  border-radius: 20px;
  box-shadow: var(--shadow-s);
}
.catalog__seo-body { max-width: none; }
.catalog__seo .mm-prose { max-width: none; }

/* подкатегории */
.catalog__subcats { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 28px; }
.catalog__subcat {
  display: inline-flex; align-items: center; padding: 10px 18px;
  background: var(--bg-tertiary); border: 1px solid var(--border-primary); border-radius: var(--radius-pill, 100px);
  font-size: 14px; color: var(--text-primary); text-decoration: none; white-space: nowrap;
}
.catalog__subcat:hover { border-color: var(--teal); color: var(--teal); }

/* верхняя панель */
.catalog__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 22px; flex-wrap: wrap; }
.catalog__results { font-size: 14px; color: var(--text-secondary); }
.catalog__sort-wrap { display: inline-flex; align-items: center; gap: 10px; }
.catalog__sort-label { font-size: 13.5px; color: var(--text-tertiary); white-space: nowrap; }
.catalog__sort { /* нативный select — fallback, скрывается JS-ом */ height: 42px; }

/* кастомный дропдаун (под наш UI) */
.mm-dd { position: relative; }
.mm-dd__btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 42px; min-width: 210px; padding: 0 14px;
  background: #fff; border: 1px solid var(--border-primary); border-radius: 12px;
  font: 500 14px 'Geologica', sans-serif; color: var(--text-primary); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.mm-dd__btn:hover { border-color: var(--teal); }
.mm-dd.is-open .mm-dd__btn { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(24,162,176,.12); }
.mm-dd__chev { flex: 0 0 auto; color: var(--text-tertiary); transition: transform .18s; }
.mm-dd.is-open .mm-dd__chev { transform: rotate(180deg); }
.mm-dd__menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--border-primary); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(20,40,60,.16); padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.mm-dd.is-open .mm-dd__menu { opacity: 1; visibility: visible; transform: none; }
.mm-dd__item {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  border: none; background: none; border-radius: 8px;
  font: 400 14px 'Geologica', sans-serif; color: var(--text-primary); cursor: pointer;
  transition: background .12s, color .12s;
}
.mm-dd__item:hover { background: var(--bg-primary-bg); color: var(--teal); }
.mm-dd__item.is-active { color: var(--teal); font-weight: 600; background: var(--bg-accent-subdued); }

/* вариант с поиском по списку (длинные списки разделов) */
.mm-dd--search .mm-dd__menu { padding: 0; width: max(280px, 100%); min-width: 280px; }
.mm-dd__search { position: sticky; top: 0; padding: 8px; background: #fff; border-bottom: 1px solid var(--border-tertiary); border-radius: 12px 12px 0 0; }
.mm-dd__search input {
  width: 100%; height: 38px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--border-primary); border-radius: 9px; outline: none;
  font: 400 14px 'Geologica', sans-serif; color: var(--text-primary); background: var(--bg-primary-bg);
}
.mm-dd__search input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(24,162,176,.1); background: #fff; }
.mm-dd__list { max-height: 300px; overflow-y: auto; padding: 6px; }
.mm-dd__list::-webkit-scrollbar { width: 9px; }
.mm-dd__list::-webkit-scrollbar-thumb { background: rgba(60,83,135,.22); border-radius: 96px; border: 3px solid transparent; background-clip: content-box; }
.mm-dd__noresult { padding: 16px 12px 18px; text-align: center; font: 400 13.5px 'Geologica', sans-serif; color: var(--text-tertiary); }

/* ── карточка товара (стиль маркетплейса) ── */
.catalog__products--grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

.pcard {
  display: flex; flex-direction: column;
  background: #fff;
  border: 1px solid var(--border-primary);
  border-radius: 18px;
  overflow: hidden;
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
/* «дорогой» hover: лёгкий подъём + тонкая бирюзовая рамка и мягкое свечение (без тяжёлой тени) */
.pcard:hover { box-shadow: 0 12px 30px rgba(24,162,176,.13); border-color: rgba(24,162,176,.5); transform: translateY(-4px); }

.pcard__media-wrap { position: relative; overflow: hidden; }
.pcard__media { display: block; aspect-ratio: 1; background: #fff; border-bottom: 1px solid #eef1f4; }
.pcard__media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; transition: transform .35s ease; }
.pcard:hover .pcard__media img { transform: scale(1.045); }

/* сердечко-оверлей в углу фото */
.pcard__fav {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 2px 10px rgba(20,40,60,.14);
  transition: color .15s, background .15s, transform .15s;
}
.pcard__fav:hover { color: #e3354e; background: #fff; transform: scale(1.08); }
.pcard__fav svg { display: block; }

.pcard__body { display: flex; flex-direction: column; gap: 7px; padding: 14px 16px 16px; flex: 1; }

.pcard__price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font: 700 21px/1.05 'Geologica', sans-serif; color: var(--text-primary); }
.pcard__price-new { color: var(--teal); }
.pcard__price-old { color: var(--text-tertiary); font-weight: 400; font-size: 14px; text-decoration: line-through; }

.pcard__name { margin: 0 0 2px; font: 400 13.5px/1.35 'Geologica', sans-serif; min-height: 2.7em; }
.pcard__name a {
  color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color .15s;
}
.pcard__name a:hover { color: var(--teal); }

.pcard__desc { display: none; } /* описание в плитке не показываем */

.pcard__buttons { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 6px; }
.pcard__cart {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; border: none; border-radius: 12px; background: var(--teal); color: #fff;
  font: 500 14.5px 'Geologica', sans-serif; cursor: pointer; transition: filter .15s, transform .12s;
}
.pcard__cart:hover { filter: brightness(.94); }
.pcard__cart:active { transform: scale(.98); }
.pcard__cart svg { display: block; flex: 0 0 auto; }
.pcard__oneclick {
  height: 44px; border: 1px solid var(--border-primary); border-radius: 12px;
  background: #fff; color: var(--text-secondary); font: 500 14px 'Geologica', sans-serif;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.pcard__oneclick:hover { border-color: var(--teal); color: var(--teal); background: var(--bg-accent-subdued); }

/* пагинация */
.catalog__footer { margin-top: 32px; }
.catalog__pagination .pagination { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.catalog__pagination .pagination a, .catalog__pagination .pagination span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 12px;
  border: 1px solid var(--border-primary); border-radius: 10px; background: #fff; color: var(--text-primary); text-decoration: none; font-size: 14px;
}
.catalog__pagination .pagination .active span, .catalog__pagination .pagination a:hover { background: var(--teal); color: #fff; border-color: var(--teal); }

.catalog__empty { font-size: 16px; color: var(--text-secondary); margin: 24px 0; }
.catalog__empty-btn { display: inline-flex; height: 48px; align-items: center; padding: 0 28px; border-radius: var(--radius-pill, 100px); background: var(--teal); color: #fff; text-decoration: none; }

/* ── бесконечная подгрузка ── */
.catalog__footer.is-infinite .catalog__pagination { display: none; }

.mm-infinite { padding: 26px 0 6px; }
.mm-infinite__end {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 18px 0 4px; font: 500 14px 'Geologica', sans-serif; color: var(--text-tertiary);
}
.mm-infinite__end-line { height: 1px; width: 56px; background: var(--border-primary); }

/* карточка-скелетон (шиммер в нашем стиле) */
.pcard--skeleton { pointer-events: none; }
.pcard--skeleton .sk,
.pcard--skeleton .pcard__media.sk {
  display: block;
  background: linear-gradient(100deg, #eef1f4 30%, #f7f9fb 50%, #eef1f4 70%);
  background-size: 200% 100%;
  animation: mmShimmer 1.3s ease-in-out infinite;
  border-radius: 8px;
}
.pcard--skeleton .pcard__media.sk { aspect-ratio: 1; border-radius: 0; border-bottom: 1px solid #eef1f4; }
.pcard--skeleton .pcard__body { gap: 10px; }
.pcard--skeleton .sk--price { height: 22px; width: 58%; border-radius: 6px; }
.pcard--skeleton .sk--line  { height: 12px; width: 100%; }
.pcard--skeleton .sk--short { width: 70%; }
.pcard--skeleton .sk--btn   { height: 44px; width: 100%; margin-top: 10px; border-radius: 12px; }
@keyframes mmShimmer { 0% { background-position: 180% 0; } 100% { background-position: -80% 0; } }
@media (prefers-reduced-motion: reduce) { .pcard--skeleton .sk { animation: none; } }

@media (max-width: 1100px) { .catalog__products--grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .catalog__products--grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px)  {
  .catalog__products--grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .pcard__body { padding: 10px 12px 12px; }
  .pcard__price { font-size: 18px; }
}

/* ── Сайдбар-фильтр по категориям/подкатегориям ── */
.catalog__layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 28px; align-items: start; }
.catalog__filter { position: sticky; top: 110px; }
.catalog__filter-toggle { display: none; }
/* подсказка «можно листать»: затухание + покачивающийся шеврон у низа списка */
.catalog__filter-fade { position: absolute; left: 1px; right: 1px; bottom: 1px; height: 48px;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 7px; color: var(--teal);
  background: linear-gradient(to bottom, rgba(244,246,248,0), var(--bg-tertiary) 72%);
  border-radius: 0 0 var(--radius-16, 16px) var(--radius-16, 16px);
  pointer-events: none; opacity: 0; transition: opacity .22s; }
.catalog__filter.has-more-below .catalog__filter-fade { opacity: 1; }
.catalog__filter-fade svg { width: 20px; height: 20px; animation: mm-catfilter-hint 1.5s ease-in-out infinite; }
@keyframes mm-catfilter-hint { 0%,100% { transform: translateY(0); opacity: .65; } 50% { transform: translateY(3px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .catalog__filter-fade svg { animation: none; } }
.catalog__filter-nav { display: flex; flex-direction: column; gap: 1px; background: var(--bg-tertiary); border: 1px solid rgba(27,29,34,.06); border-radius: var(--radius-16, 16px); padding: 10px; box-shadow: var(--shadow-s);
  /* видимая зона ~10 разделов, остальное — внутренним скроллом (но не выше вьюпорта) */
  max-height: min(490px, calc(100vh - 130px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(27,29,34,.22) transparent; }
.catalog__filter-nav::-webkit-scrollbar { width: 8px; }
.catalog__filter-nav::-webkit-scrollbar-thumb { background: rgba(27,29,34,.18); border-radius: 8px; }
.catalog__filter-nav::-webkit-scrollbar-thumb:hover { background: rgba(27,29,34,.3); }
.catfilter__all { display: block; padding: 9px 12px; border-radius: 10px; font: 600 14px/1.3 'Geologica', sans-serif; color: var(--text-primary); text-decoration: none; transition: background .14s, color .14s; }
.catfilter__all:hover, .catfilter__link:hover { background: var(--bg-accent-subdued); color: var(--teal); }
.catfilter__all.is-active { background: var(--teal); color: #fff; }
.catfilter__group { border-top: 1px solid rgba(27,29,34,.05); }
.catfilter__group:first-of-type { border-top: 0; }
.catfilter__row { display: flex; align-items: stretch; gap: 4px; }
.catfilter__link { flex: 1 1 auto; min-width: 0; padding: 9px 12px; border-radius: 10px; font: 500 13.5px/1.3 'Geologica', sans-serif; color: var(--text-secondary); text-decoration: none; transition: background .14s, color .14s; }
.catfilter__link.is-active { color: var(--teal); font-weight: 600; background: var(--bg-accent-subdued); }
.catfilter__toggle { flex: 0 0 34px; width: 34px; border: 0; background: none; color: var(--text-tertiary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; transition: background .14s, color .14s; }
.catfilter__toggle:hover { background: var(--bg-accent-subdued); color: var(--teal); }
.catfilter__toggle svg { width: 16px; height: 16px; transition: transform .2s; }
.catfilter__group.is-open .catfilter__toggle svg { transform: rotate(180deg); }
.catfilter__sub { list-style: none; margin: 0 0 6px; padding: 0 0 0 12px; display: none; }
.catfilter__group.is-open .catfilter__sub { display: block; }
.catfilter__sub li { margin: 0; }
.catfilter__sub a { display: block; padding: 6px 12px; border-radius: 8px; font: 400 13px/1.35 'Geologica', sans-serif; color: var(--text-secondary); text-decoration: none; transition: background .14s, color .14s; }
.catfilter__sub a:hover { background: var(--bg-accent-subdued); color: var(--teal); }
.catfilter__sub a.is-active { color: var(--teal); font-weight: 600; }
/* основная сетка товаров — 3 колонки (слева сайдбар) */
.catalog__main .catalog__products--grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .catalog__main .catalog__products--grid { grid-template-columns: repeat(2, 1fr); } }
/* мобайл/планшет: сайдбар сворачивается в кнопку «Категории» */
@media (max-width: 900px) {
  .catalog__layout { grid-template-columns: 1fr; gap: 14px; }
  .catalog__filter { position: static; }
  .catalog__filter-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px;
    padding: 12px 16px; border: 1px solid rgba(27,29,34,.1); border-radius: 12px; background: var(--bg-tertiary);
    font: 600 15px 'Geologica', sans-serif; color: var(--text-primary); cursor: pointer; }
  .catalog__filter-toggle svg { width: 18px; height: 18px; transition: transform .2s; }
  .catalog__filter.is-open .catalog__filter-toggle svg { transform: rotate(180deg); }
  .catalog__filter-nav { display: none; margin-top: 8px; max-height: none; overflow: visible; }
  .catalog__filter.is-open .catalog__filter-nav { display: flex; }
  .catalog__filter-fade { display: none; }
}
