/* ============================================================
   Сетка разделов каталога 2 (ИБ 195).
   Шаблон bitrix:catalog.section.list/cat2_grid.
   Палитра и breakpoint (768px) — как в мега-меню categories_menu.
   Две раскладки: --root (лендинг, крупные карточки),
                  --deep (страница категории/подкатегории, плотнее).
============================================================ */
.cat2-grid {
  --c-white: #ffffff;
  --c-black: #11222b;
  --c-blue: #0080c5;
  --c-grey-text: #798991;
  --c-grey-border: #e9edf0;
  --c-grey-border-2: #b1bec4;
  --c-grey-bg: #f5f8fa;
  --radius-card: 16px;

  display: grid;
  gap: 16px;
}

/* ---------- Карточка-ссылка ---------- */
.cat2-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--c-white);
  border: 1px solid var(--c-grey-border);
  border-radius: var(--radius-card);
  color: var(--c-black);
  text-decoration: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.cat2-card:hover {
  border-color: var(--c-blue);
  box-shadow: 0 0 24px rgba(17, 34, 43, 0.08);
}

.cat2-card__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  color: var(--c-black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cat2-card__icon svg { display: block; width: 100%; height: 100%; }
.cat2-card:hover .cat2-card__icon { color: var(--c-blue); }

.cat2-card__body {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
}
.cat2-card__name {
  font-size: 18px;
  line-height: 22px;
  font-weight: 600;
  color: var(--c-black);
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat2-card:hover .cat2-card__name { color: var(--c-blue); }
.cat2-card__count {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 16px;
  font-weight: 400;
  color: var(--c-grey-text);
}

.cat2-card__chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--c-grey-border-2);
  display: none; /* на десктопе скрыт, виден только в мобильном списке */
}
.cat2-card__chevron svg { display: block; width: 100%; height: 100%; }

/* ---------- Лендинг: крупные карточки ---------- */
.cat2-grid--root {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ---------- Внутренняя страница: плотнее ---------- */
.cat2-grid--deep {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.cat2-grid--deep .cat2-card { padding: 18px 20px; gap: 12px; }
.cat2-grid--deep .cat2-card__icon { width: 32px; height: 32px; }
.cat2-grid--deep .cat2-card__name { font-size: 16px; line-height: 20px; }

/* ============================================================
   Мобильная версия (<=768px): вертикальный список строк.
   Иконка слева, название, chevron справа — как в мега-меню.
============================================================ */
@media (max-width: 768px) {
  .cat2-grid,
  .cat2-grid--root,
  .cat2-grid--deep {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
  }

  .cat2-grid--root .cat2-card,
  .cat2-grid--deep .cat2-card {
    height: 100%;
    min-height: 112px;
    padding: 14px;
    gap: 10px;
    align-items: center;
    flex-direction: column;
    text-align: center;
    border: 1px solid var(--c-grey-border);
    border-radius: 12px;

  }

  .cat2-card:hover {
    border-color: var(--c-blue);
    box-shadow: none;
    background: var(--c-grey-bg);
  }

  .cat2-grid--root .cat2-card__icon,
  .cat2-grid--deep .cat2-card__icon { width: 32px; height: 32px; }

  .cat2-grid--root .cat2-card__name,
  .cat2-grid--deep .cat2-card__name { font-size: 16px; line-height: 20px; }

  .cat2-card__body {
    align-self: stretch;
    align-items: unset;
    flex-direction: column;
    text-align: center;
  }

  .cat2-card__chevron { display: none; }
}
