/* =============================================================================
   [pid_categories] shortcode (inc/pid-category-tree.php)
   -----------------------------------------------------------------------------
   Nested category list from wp_list_categories(): li.cat-item > a, with
   children in ul.children. Parents are small headings with their children as
   pills underneath; "All" and parents without children are pills too.
   The pills mirror the site-wide .pid-filter style in Theme Options CSS.
   ========================================================================== */

.pid-cat-tree {
  font-family: var(--pid-font);
}

.pid-cat-tree__title {
  margin: 0 0 16px;
}
/* The single post sidebar (wp-single.php) zeroes .pid-label margins. */
.pid-article-side .pid-cat-tree__list {
  margin-top: 14px;
}

.pid-cat-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pid-cat-tree li {
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(12, 23, 51, 0.55); /* post count, when show_count="1" */
}

.pid-cat-tree a {
  text-decoration: none;
}

/* Top-level items */
.pid-cat-tree__list > li + li {
  margin-top: 18px;
}

/* Parent headings ("Insights", "Updates") */
.pid-cat-tree__list > li > a {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--pid-navy-deep);
  transition: color 0.15s;
}
.pid-cat-tree__list > li > a:hover,
.pid-cat-tree__list > li > a:focus-visible,
.pid-cat-tree__list > li.current-cat > a {
  color: var(--pid-gold-text);
}

/* Children: a wrapping row of pills */
.pid-cat-tree .children {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

/* Pills: children, "All" (li.cat-item-all) and parents without children */
.pid-cat-tree .children a,
.pid-cat-tree__list > li:not(:has(> .children)) > a {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--pid-border, #c9cdd9);
  border-radius: var(--pid-radius-pill, 999px);
  background: var(--pid-white, #fff);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.65;
  color: var(--pid-navy-deep);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.pid-cat-tree .children a:hover,
.pid-cat-tree .children a:focus-visible,
.pid-cat-tree__list > li:not(:has(> .children)) > a:hover,
.pid-cat-tree__list > li:not(:has(> .children)) > a:focus-visible {
  border-color: var(--pid-navy-deep);
  color: var(--pid-navy-deep);
}

/* The selected category (same as .pid-filter.is-active) */
.pid-cat-tree .children .current-cat > a,
.pid-cat-tree__list > li.current-cat:not(:has(> .children)) > a {
  border-color: var(--pid-navy-deep);
  background: var(--pid-navy-deep);
  color: var(--pid-white, #fff);
}

@media (max-width: 600px) {
  .pid-cat-tree__list > li + li {
    margin-top: 16px;
  }
}

@media (max-width: 400px) {
  .pid-cat-tree .children {
    gap: 6px;
  }
}
