/*
 * ND Parts catalog sidebar: category tree + faceted filters (2026-11-02).
 * Loaded after theme.css on listing pages and overrides its sidebar rules with
 * the same selectors. Layout grid: every label starts 12px from the column's
 * content edge (title bar 3px + 9px gap), every chevron is centred 16px from
 * its right edge. Red is reserved for the current category; hover is neutral.
 */

/* Column: room from the card's 24px rounded edge, and wide enough that most
   top-level names fit on two lines. */
body.ndp-theme .catalog-surface #left-column {
  padding: 6px 16px 16px 16px;
}

@media (min-width: 768px) {
  body.ndp-theme .catalog-surface #left-column {
    flex: 0 0 clamp(232px, 18.5vw, 276px);
    max-width: clamp(232px, 18.5vw, 276px);
  }
}

/* ---------- Category tree ---------- */

body.ndp-theme .catalog-surface #left-column .category-tree__item-header {
  min-height: 40px;
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-link {
  min-height: 40px;
  padding: 9px 8px 9px 12px;
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-header:focus-within,
body.ndp-theme .catalog-surface #left-column .category-tree__item-header:hover {
  background: var(--ndp-surface-2);
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-link:focus-visible,
body.ndp-theme .catalog-surface #left-column .category-tree__item-link:hover {
  background: transparent;
  color: var(--ndp-ink);
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-link:focus-visible {
  border-radius: 8px;
  outline: 2px solid var(--ndp-red);
  outline-offset: -2px;
}

/* Chevron button: its own hover target inside the row. */
body.ndp-theme .catalog-surface #left-column .category-tree__item-header > .accordion-button:focus-visible,
body.ndp-theme .catalog-surface #left-column .category-tree__item-header > .accordion-button:hover {
  background: rgba(20, 34, 53, 0.07);
}

/* Ancestors of the current category: emphasised, not coloured. */
body.ndp-theme .catalog-surface #left-column .category-tree__item.is-in-path > .category-tree__item-header .category-tree__item-link {
  color: var(--ndp-ink);
  font-weight: 750;
}

/* Current category. Square left corners keep the inset bar a straight line;
   on a fully rounded row it bends into a bracket. */
body.ndp-theme .catalog-surface #left-column .category-tree__item-header.is-current,
body.ndp-theme .catalog-surface #left-column .category-tree__item-header.is-current:hover,
body.ndp-theme .catalog-surface #left-column .category-tree__item-header.is-current:focus-within {
  background: var(--ndp-red-soft);
  border-radius: 0 8px 8px 0;
  box-shadow: inset 3px 0 0 var(--ndp-red);
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-header.is-current > .accordion-button:hover,
body.ndp-theme .catalog-surface #left-column .category-tree__item-header.is-current > .accordion-button:focus-visible {
  background: rgba(217, 29, 45, 0.1);
}

body.ndp-theme .catalog-surface #left-column .category-tree__item.is-in-path > .category-tree__item-header.is-current .category-tree__item-link {
  color: var(--ndp-red);
  font-weight: 750;
}

/* Subcategories: guide line aligned under the parent's label. */
body.ndp-theme .catalog-surface #left-column .category-tree__item .accordion-body {
  margin: 2px 0 4px 12px;
  padding: 2px 0 2px 8px;
}

body.ndp-theme .catalog-surface #left-column .category-tree__item .accordion-body .category-tree__item-header {
  min-height: 34px;
}

body.ndp-theme .catalog-surface #left-column .category-tree__item .accordion-body .category-tree__item-link {
  min-height: 34px;
  padding: 7px 8px 7px 10px;
}

body.ndp-theme .catalog-surface #left-column .category-tree__item .accordion-body .category-tree__item-link:hover,
body.ndp-theme .catalog-surface #left-column .category-tree__item .accordion-body .category-tree__item-link:focus-visible {
  color: var(--ndp-ink);
}

/* ---------- Filters ---------- */

body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button {
  padding: 11px 12px;
}

body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button:focus-visible,
body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button:hover,
body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button:not(.collapsed):hover {
  background: var(--ndp-surface-2);
  color: var(--ndp-ink);
}

/* An open group is not a selection: bold label, no red fill. */
body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button:not(.collapsed) {
  background: transparent;
  color: var(--ndp-ink);
  font-weight: 750;
}

body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(217, 29, 45, 0.2);
}

body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-body {
  margin: 2px 0 10px;
}

body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .search-filters__magnitude {
  color: var(--ndp-muted);
  font-size: 12px;
  white-space: nowrap;
}

body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .form-check-input:focus-visible {
  box-shadow: 0 0 0 3px rgba(217, 29, 45, 0.2);
}

body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .search-filters__slider-values {
  color: var(--ndp-ink-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- Chevrons ----------
   theme.css draws a border chevron on every .accordion-button::after, but
   Bootstrap's SVG chevron is still set as the same element's background, so
   two arrows overlapped and Bootstrap's margin-left:auto pushed them to the
   button edge. Keep only the border chevron, centred on the shared column. */
body.ndp-theme .catalog-surface #left-column .category-tree__item-header > .accordion-button {
  color: var(--ndp-ink-2);
  justify-content: center;
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-header.is-current > .accordion-button {
  color: var(--ndp-red);
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-header > .accordion-button::after,
body.ndp-theme .catalog-surface #left-column .category-tree__item-header > .accordion-button:not(.collapsed)::after,
body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button::after,
body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button:not(.collapsed)::after {
  background-image: none;
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  height: 7px;
  margin-top: -3px;
  transform: rotate(45deg);
  width: 7px;
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-header > .accordion-button::after,
body.ndp-theme .catalog-surface #left-column .category-tree__item-header > .accordion-button:not(.collapsed)::after {
  margin-left: 0;
}

body.ndp-theme .catalog-surface #left-column .category-tree__item-header > .accordion-button:not(.collapsed)::after,
body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button:not(.collapsed)::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}

body.ndp-theme :is(.catalog-surface #left-column, .ps-facetedsearch--mobile) #search-filters .accordion-button::after {
  margin-right: 1px;
}
