/* HK (2026-11-08): hk_catnav - новый дизайн (ТЗ: сетка 4x2 на телефоне, 8 в ряд на компьютере, панель «Все категории»). Чистый CSS без зависимостей. */
.hkcn, .hkcn * { box-sizing: border-box; }
.hkcn { --hk-green: #2e8b1f; --hk-navy: #1f4e79; --hk-tile: #eef3ec; --hk-line: #dfe5df; --hk-fg: #1d2a22; --hk-muted: #667369; margin: 20px 0 8px; }
.hkcn ul { list-style: none; margin: 0; }
.hkcn-list, .hkcn-chips { padding: 0; }
.hkcn a { text-decoration: none; }
.hkcn button { font-family: inherit; }
.hkcn a:focus-visible, .hkcn button:focus-visible, .hkcn input:focus-visible { outline: 3px solid var(--hk-green); outline-offset: 2px; }

/* ---------- Главная ---------- */
.hkcn-home { position: relative; }
.hkcn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.hkcn-title { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--hk-navy); }
.hkcn-open { display: none; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-size: 15px; font-weight: 500; line-height: 1.2; color: var(--hk-green); background: #fff; }
.hkcn-num { background: var(--hk-green); color: #fff; border-radius: 12px; padding: 1px 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
/* пока скрипт не загрузился, кнопки скрыты: плитки и так ссылки */
.hkcn-js .hkcn-open-s { display: inline-flex; min-height: 44px; padding: 0 4px; border: 0; background: none; font-size: 14px; }
.hkcn-js .hkcn-open-b { display: flex; width: 100%; min-height: 48px; margin-top: 14px; border: 1.5px solid var(--hk-green); border-radius: 24px; }

.hkcn-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 8px; }
.hkcn-item { min-width: 0; }
.hkcn-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 2px 0 4px; border-radius: 14px; color: var(--hk-fg); text-align: center; transition: transform .16s ease-out; }
.hkcn-tile:active { transform: scale(.96); }
.hkcn-img { display: block; width: 100%; max-width: 72px; aspect-ratio: 1 / 1; border-radius: 18px; background: var(--hk-tile); overflow: hidden; }
.hkcn-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hkcn-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.2; font-weight: 500; min-height: 30px; text-wrap: balance; }

@media (min-width: 600px) {
  .hkcn-img { max-width: 88px; }
  .hkcn-name { font-size: 13.5px; min-height: 33px; }
  .hkcn-js .hkcn-open-b { max-width: 420px; margin-left: auto; margin-right: auto; }
}
@media (min-width: 1024px) {
  .hkcn-home { margin: 37px 24px 33px; }
  .hkcn-list { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 14px; }
  .hkcn-tile { padding: 8px 4px 10px; }
  .hkcn-tile:hover, .hkcn-tile:focus-visible { background: var(--hk-tile); }
  .hkcn-tile:hover .hkcn-name { color: var(--hk-green); text-decoration: underline; text-underline-offset: 3px; }
  .hkcn-img { max-width: 96px; }
  .hkcn-name { font-size: 14px; min-height: 34px; }
  .hkcn-title { font-size: 22px; }
  .hkcn-js .hkcn-open-s, .hkcn-js .hkcn-open-b { display: none; }
  .hkcn-js .hkcn-open-d { display: inline-flex; min-height: 44px; padding: 0 20px; border: 1.5px solid var(--hk-green); border-radius: 22px; }
  .hkcn-open-d:hover { background: var(--hk-tile); }
}

/* ---------- Панель «Все категории» ---------- */
.hkcn-sheet[hidden] { display: none; }
.hkcn-sheet { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 10050; display: flex; align-items: flex-end; justify-content: center; }
.hkcn-backdrop { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(15, 25, 18, .5); }
.hkcn-panel { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 560px; height: 86vh; height: 86dvh; background: #fff; border-radius: 20px 20px 0 0; animation: hkcn-up .26s ease-out; }
@keyframes hkcn-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.hkcn-swipe { touch-action: none; }
.hkcn-grab { width: 40px; height: 4px; border-radius: 2px; background: #c5cdc6; margin: 8px auto 0; }
.hkcn-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 4px 16px; font-size: 18px; color: var(--hk-fg); }
.hkcn-close { width: 44px; height: 44px; border: 0; border-radius: 22px; background: var(--hk-tile); font-size: 24px; line-height: 1; cursor: pointer; color: var(--hk-fg); }
.hkcn-search { padding: 4px 16px 10px; }
.hkcn-q { width: 100%; height: 44px; border: 1px solid var(--hk-line); border-radius: 12px; padding: 0 14px; font-size: 16px; background: #fff; color: var(--hk-fg); }
.hkcn-tree { flex: 1; overflow-y: auto; padding: 0 8px 20px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hkcn-row[hidden] { display: none; }
.hkcn-top { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 4px 8px; border: 0; border-radius: 12px; background: none; text-align: left; font-size: 15px; font-weight: 500; color: var(--hk-fg); cursor: pointer; }
.hkcn-top:active { background: var(--hk-tile); }
.hkcn-mini { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--hk-tile); overflow: hidden; }
.hkcn-mini img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hkcn-lb { flex: 1; min-width: 0; }
.hkcn-chev { flex: none; width: 10px; height: 10px; margin-right: 6px; border-right: 2px solid var(--hk-muted); border-bottom: 2px solid var(--hk-muted); transform: rotate(45deg); transition: transform .18s ease-out; }
.hkcn-top[aria-expanded="true"] .hkcn-chev { transform: rotate(-135deg); }
.hkcn-d { display: none; }
.hkcn-sub[hidden] { display: none; }
.hkcn-sub { padding: 0 8px 6px 56px; }
.hkcn-sub a { display: flex; align-items: center; min-height: 44px; border-bottom: 1px solid var(--hk-line); font-size: 14px; color: var(--hk-fg); }
.hkcn-sub a.hkcn-allin { color: var(--hk-green); font-weight: 500; }
.hkcn-empty { margin: 0; padding: 24px 16px; color: var(--hk-muted); }
.hkcn-empty[hidden] { display: none; }
html.hkcn-lock, html.hkcn-lock body { overflow: hidden; }

/* компьютер: список под рядом, разделы сразу раскрыты, без поиска */
@media (min-width: 1024px) {
  .hkcn-sheet { position: absolute; top: 100%; right: 0; bottom: auto; left: 0; height: 0; display: block; }
  .hkcn-backdrop { position: fixed; background: transparent; }
  .hkcn-panel { position: absolute; top: 6px; left: 0; right: 0; max-width: none; height: auto; max-height: 70vh; border-radius: 14px; border: 1px solid var(--hk-line); box-shadow: 0 18px 40px rgba(20, 40, 25, .18); padding: 18px 22px; animation: none; overflow-y: auto; }
  .hkcn-swipe, .hkcn-search { display: none; }
  .hkcn-tree { column-count: 3; column-gap: 28px; padding: 0; overflow: visible; }
  .hkcn-row { break-inside: avoid; margin-bottom: 14px; }
  .hkcn-m, .hkcn-mini, .hkcn-chev { display: none; }
  .hkcn-d, .hkcn-row > a.hkcn-top { display: block; min-height: 0; padding: 0; font-weight: 700; font-size: 15px; line-height: 1.9; border-radius: 0; }
  .hkcn-d:hover, .hkcn-row > a.hkcn-top:hover { color: var(--hk-green); text-decoration: underline; }
  .hkcn-sub[hidden], .hkcn-sub { display: block; padding: 0 0 0 10px; }
  .hkcn-sub a { display: block; min-height: 0; border: 0; font-size: 14px; line-height: 1.9; }
  .hkcn-sub a:hover { color: var(--hk-green); text-decoration: underline; }
  .hkcn-sub a.hkcn-allin { display: none; }
}

/* ---------- Страница категории ---------- */
.hkcn-cat { margin: 8px 0 14px; }
.hkcn-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; font-size: 15px; color: var(--hk-fg); }
.hkcn-back:hover { color: var(--hk-green); text-decoration: underline; }
.hkcn-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.hkcn-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid #cdd5ce; border-radius: 22px; background: #fff; color: var(--hk-fg); font-size: 14px; line-height: 1.2; }
.hkcn-chip:hover { border-color: var(--hk-green); }
.hkcn-chip.is-active { background: var(--hk-green); border-color: var(--hk-green); color: #fff; font-weight: 500; }
.hkcn-cnt { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
@media (max-width: 767px) {
  .hkcn-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -15px; padding-right: 15px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .hkcn-chips::-webkit-scrollbar { display: none; }
  .hkcn-chips li { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .hkcn-panel { animation: none; }
  .hkcn-tile, .hkcn-chev { transition: none; }
}
