/* Shared catalogue facets inside Shoptimizer's native sidebar and mobile drawer. */
#secondary .tkw-catalog-facets {
  color: var(--tk-text);
  font-size: 14px;
  line-height: 1.5;
}

#secondary .tkw-catalog-facets form {
  margin: 0;
}

#secondary .tkw-catalog-facets .tkw-facet-group {
  margin: 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--tk-border);
  background: transparent;
}

#secondary .tkw-catalog-facets .tkw-facet-group > summary {
  box-sizing: border-box;
  display: list-item;
  min-height: 44px;
  padding: 12px 0;
  color: var(--tk-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
}

#secondary .tkw-catalog-facets .tkw-facet-group > summary::marker {
  color: var(--tk-muted);
}

#secondary .tkw-catalog-facets .tkw-facet-options {
  max-height: 18rem;
  margin: 0 0 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

#secondary .tkw-catalog-facets label {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: 7px 4px;
  color: var(--tk-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  overflow-wrap: anywhere;
  cursor: pointer;
}

#secondary .tkw-catalog-facets input[type="checkbox"] {
  appearance: auto;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--tk-brand-gold);
  cursor: pointer;
}

#secondary .tkw-catalog-facets label:has(input:checked) {
  font-weight: 600;
}

#secondary .tkw-catalog-facets label:has(input:disabled) {
  color: var(--tk-muted);
  cursor: not-allowed;
}

#secondary .tkw-catalog-facets input:disabled {
  cursor: not-allowed;
}

#secondary .tkw-catalog-facets .tkw-facet-count {
  justify-self: end;
  color: var(--tk-muted);
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* Keep the theme's button palette and interaction states. */
#secondary .tkw-catalog-facets button[type="submit"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  padding: 10px 12px;
  line-height: 24px;
  white-space: normal;
}

#secondary .tkw-catalog-facets .tkw-filter-clear {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--tk-text);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#secondary .tkw-catalog-facets .tkw-filter-status {
  margin: 8px 0 0;
  color: var(--tk-muted);
  font-size: 13px;
  line-height: 1.5;
}

#secondary .tkw-catalog-facets .tkw-filter-status:empty {
  display: none;
}

#secondary .tkw-catalog-facets :is(summary, input, a, button):focus-visible {
  outline: 2px solid var(--tk-brand-gold);
  outline-offset: 2px;
}

/* Keep relevant model links reachable without pushing filters below a long tree. */
.woocommerce #secondary .widget_product_categories > .product-categories {
  max-height: 16rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}


/* Keep the native sorting select visibly actionable in both appearances. */
#page .woocommerce-ordering {
  position: relative;
  width: 200px;
  max-width: 100%;
}
/* Keep the real select; this arrow avoids background-image resets in Dark mode. */
#page .woocommerce-ordering::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--tk-text);
  border-bottom: 2px solid var(--tk-text);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
#page .woocommerce-ordering select.orderby {
  box-sizing: border-box;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 40px;
  height: 40px;
  max-width: 100%;
  margin: 0;
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--tk-strong-border);
  border-radius: 4px;
  background-color: var(--tk-surface);
  background-image: none;
  color: var(--tk-text);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  color-scheme: light;
  cursor: pointer;
}
#page .woocommerce-ordering select.orderby:hover { border-color: var(--tk-text); }
#page .woocommerce-ordering select.orderby:focus-visible {
  outline: 2px solid var(--tk-brand-gold);
  outline-offset: 2px;
}
html[data-tk-theme="dark"] #page .woocommerce-ordering select.orderby { color-scheme: dark; }

/* Breadcrumbs identify these archives; retain their H1 for assistive technology. */
body:is(.tax-product_cat, .tax-product_brand, .tax-pa_factory) #page h1.woocommerce-products-header__title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

@media (max-width: 992px) {
  #page .woocommerce-ordering select.orderby { min-height: 44px; height: 44px; font-size: 16px; }
}

/* The native drawer close control has no purpose beside the desktop sidebar. */
@media (min-width: 1200px) {
  .woocommerce #page .secondary-wrapper > button.filters.close-drawer { display: none; }
}
