/* Main category page: top section + 4-column card grid */

/* Level colours (change here to retheme) */
.cat-level-1 { --cat-bg-from: #1469d2; --cat-bg-to: #0a359b; --cat-text: #ffffff; }
.cat-level-2 { --cat-bg-from: #1469d2; --cat-bg-to: #1469d2; --cat-text: #ffffff; }
.cat-level-3 { --cat-bg-from: #8e5bd6; --cat-bg-to: #5a2d9c; --cat-text: #ffffff; }
.cat-level-4 { --cat-bg-from: #d9534f; --cat-bg-to: #a02622; --cat-text: #ffffff; }

/* Top section */
.cat-top-section {
  text-align: center;
  color: #fff;
  padding: 22px 16px;
  margin-bottom: 24px;
  border-radius: 6px;
  background-image: linear-gradient(to bottom, #1469d2, #0a359b);
}
.cat-top-section h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: #fff;
}
.cat-top-section p {
  font-size: .9rem;
  margin: 0;
  color: #fff;
}

/* 4-column grid (1 column on mobile) */
.cat-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.cat-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.cat-card-img {
  display: block;
  aspect-ratio: 1 / 1;
  background: #fafafa;
  overflow: hidden;
}
.cat-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* content box with icon, prefix, title, description */
.cat-content-box {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background-image: linear-gradient(to bottom, var(--cat-bg-from), var(--cat-bg-to));
  color: var(--cat-text);
}
.cat-content-box a { color: var(--cat-text); }
.cat-icon {
  width: 40px;
  min-width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}
.cat-text { min-width: 0; flex: 1; }
.cat-text h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--cat-text);
}
.cat-prefix { font-weight: 700; margin-right: 4px; }

/* description: two lines then ellipsis */
.cat-desc {
  margin: 0;
  font-size: .8rem;
  line-height: 1.4;
  color: var(--cat-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 767px) {
  .cat-card-grid { grid-template-columns: 1fr; }
}

/* Category listing page: top banner (icon, prefix + title, description) */
.cat-banner-wrap { margin-bottom: 15px; }
.cat-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 6px;
  background-image: linear-gradient(to bottom, var(--cat-bg-from), var(--cat-bg-to));
  color: var(--cat-text);
}
.cat-banner .cat-icon { width: 56px; min-width: 56px; height: 56px; }
.cat-banner .cat-text h2 { font-size: 1.15rem; margin: 0 0 4px; }
.cat-banner .cat-desc { font-size: .85rem; }

/* product-listing view: the banner replaces the plain heading (kept in DOM for SEO/a11y) */
.filter-heading-wrap { position: relative; }
.listing-heding.cat-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.filter-heading-wrap .heading-right { margin-left: auto; }

/* Flat colours: level 1 banner + level 2 cards = #1469d2, level 2 banner + level 3 cards = #2082d1 */
.cat-banner.cat-level-1,
.cat-card.cat-level-2 .cat-content-box {
  background-image: none;
  background-color: #1469d2;
}
.cat-banner.cat-level-2,
.cat-card.cat-level-3 .cat-content-box {
  background-image: none;
  background-color: #2082d1;
}
/* level 3 banner + level 4 cards = #299cd1 */
.cat-banner.cat-level-3,
.cat-banner.cat-level-4,
.cat-card.cat-level-4 .cat-content-box {
  background-image: none;
  background-color: #299cd1;
}
.cat-banner.cat-level-4 .cat-icon {
  background: #fff;
  border: 2px solid #fff;
}

/* Hover banner swapped in from the left category tree (3:1) */
.cat-hover-banner {
  margin-bottom: 15px;
  border-radius: 6px;
  overflow: hidden;
}
.cat-hover-banner img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
}
