/**
 * Будинок Затишку — catalog directory page (katalog-mebliv, frame 4e
 * desktop / 4f mobile). Desktop-first (matches this codebase's convention
 * of max-width overrides, e.g. category.css/home.css); the card layout
 * switches from a vertical image-top tile to a compact horizontal row at
 * the mobile breakpoint (767px) — see the two ".bz-catdir__row"/
 * ".bz-catdir__subs" rule blocks below.
 *
 * Full-bleed like every other listing page (2026-08-21, frame 4h): the
 * template wraps this in .bz-container--wide (2400px cap) instead of the
 * plain 1280px .bz-container. The grid tracks that with auto-fill/minmax
 * instead of a fixed repeat(4) — same convention as category.css's product
 * grid — so it gains columns as the viewport grows instead of stretching
 * 4 cards edge to edge on an ultra-wide monitor. minmax(280px,…) reproduces
 * the old fixed 4/3/2-column steps at 1280/1199/899px almost exactly, so
 * this is a widening, not a relayout, at any width this shipped with.
 */

/* No top padding — same convention as .bz-catlist (category.css) and
   .bz-product (productdetails.css): the wrapper carries none, and the
   only spacing above the H1 is .bz-catdir__crumbs' own margin-bottom
   below. Those two pages get their top space from the site-wide
   breadcrumbs MODULE's own padding (chrome.css); this page renders its
   crumb trail inline instead (it isn't on VirtueMart's category/product
   pathway), so there's no equivalent module padding to inherit — zero
   top padding here is the deliberate match, not an oversight. Bottom
   keeps var(--space-6), same as those two — that gap is against the
   page end, not the nav. */
.bz-catdir { padding: 0 0 var(--space-6); }

.bz-catdir__crumbs {
  font-size: 12px;
  color: var(--c-muted);
  margin-bottom: var(--space-3);
}
.bz-catdir__crumbs a { color: var(--c-muted); text-decoration: none; }
.bz-catdir__crumbs a:hover { color: var(--c-coffee); }
.bz-catdir__crumbs-sep { margin: 0 6px; color: var(--c-line); }
.bz-catdir__crumbs b { color: var(--c-text); font-weight: 700; }

.bz-catdir__head { margin-bottom: var(--space-5); }
.bz-catdir__head h1 { margin-bottom: 6px; }
.bz-catdir__stats { margin: 0; font-size: 14px; color: var(--c-muted); }

.bz-catdir__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: var(--space-6);
}

.bz-catdir__card {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --- header row: media + name/meta + (mobile-only) chevron --- */
.bz-catdir__row { display: flex; flex-direction: column; }

.bz-catdir__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--c-bg);
  overflow: hidden;
}
.bz-catdir__media img { width: 100%; height: 100%; object-fit: cover; }
.bz-catdir__media-fallback {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 34px;
  color: var(--c-line);
}
.bz-catdir__count {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(255, 253, 249, .92);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--c-text);
}

.bz-catdir__body { padding: 14px 16px 16px; flex: 1; }
.bz-catdir__name {
  display: block;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 17px;
  color: var(--c-coffee);
  text-decoration: none;
}
a.bz-catdir__name:hover { color: var(--c-ginger); }
.bz-catdir__meta { display: none; } /* desktop: count already shown as an overlay pill on the image */
.bz-catdir__chevron { display: none; }

/* A root category WITH subcategories has no page of its own worth linking
   to — real products live in the subcategories below, never directly in
   it (see BUSINESS-RULES.md "Category listing"). Its title/media render
   as a plain span there, not <a>; only a leaf root category (no
   subcategories, holds its own products) keeps them as real links. */
span.bz-catdir__name,
span.bz-catdir__media { cursor: default; }

/* --- subcategories: desktop = plain underlined list --- */
.bz-catdir__subs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 16px;
}
.bz-catdir__subs-more[hidden] { display: none; }
.bz-catdir__subs-more:not([hidden]) { display: contents; }
.bz-catdir__sub {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--c-text);
  text-decoration: underline;
  text-decoration-color: var(--c-line);
  text-underline-offset: 3px;
}
.bz-catdir__sub:hover { color: var(--c-ginger); text-decoration-color: currentColor; }

.bz-catdir__toggle {
  align-self: flex-start;
  margin-top: 3px;
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-muted);
  cursor: pointer;
}
.bz-catdir__toggle:hover { color: var(--c-coffee); }
.bz-catdir__toggle-icon { font-size: 9px; transition: transform .15s ease; }
.bz-catdir__toggle[aria-expanded="true"] .bz-catdir__toggle-icon { transform: rotate(180deg); }

/* --- leaf root category (no subcategories): one CTA instead of a list --- */
.bz-catdir__subs--single { padding-top: 2px; }
.bz-catdir__gobtn { align-self: flex-start; }

/* --- info / SEO block --- */
.bz-catdir__info {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.bz-catdir__info h2 { font-size: 17px; margin-bottom: 6px; }
.bz-catdir__info p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--c-text); }
.bz-catdir__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--c-line);
}
.bz-catdir__cta span { font-size: 14px; font-weight: 600; color: var(--c-text); }

/* --- mobile: compact horizontal row card (frame 4f) --- */
@media (max-width: 767px) {
  .bz-catdir__grid { display: flex; flex-direction: column; gap: 9px; }

  .bz-catdir__row { flex-direction: row; align-items: center; gap: 12px; padding: 11px 13px; }

  .bz-catdir__media { flex: none; width: 72px; height: 60px; aspect-ratio: auto; border-radius: 10px; }
  .bz-catdir__media-fallback { font-size: 22px; }
  .bz-catdir__count { display: none; } /* replaced by the meta line, too little room on a 72px thumb */

  .bz-catdir__body { flex: 1; min-width: 0; padding: 0; }
  .bz-catdir__name { font-size: 15px; }
  .bz-catdir__meta { display: block; font-size: 10.5px; color: var(--c-muted); margin-top: 2px; }

  .bz-catdir__chevron { display: block; flex: none; font-size: 15px; color: var(--c-line); }

  .bz-catdir__subs { flex-direction: row; flex-wrap: wrap; padding: 0 13px 12px; }
  .bz-catdir__sub {
    background: var(--c-bg);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-pill);
    padding: 6px 11px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
  }
  .bz-catdir__sub:hover { background: var(--c-pillow); color: var(--c-coffee); }

  .bz-catdir__toggle {
    align-self: auto;
    margin-top: 0;
    background: var(--c-card);
    border: 1px dashed var(--c-line);
    border-radius: var(--radius-pill);
    padding: 6px 11px;
  }
}

@media (max-width: 479px) {
  .bz-catdir__info { padding: var(--space-4); }
  .bz-catdir__cta { flex-direction: column; align-items: stretch; }
}
