/**
 * Filters — optional styling for the multi-source list filter.
 *
 * Applies only to w-filter "for_list" elements that carry the extra
 * `multi-filter` class (add it to the List Filter element's extra class
 * names). Everything keys off the classes toggled by assets/js/csf-filters.js:
 *
 *   .w-filter-item.mf-open   – the item whose dropdown is open
 *
 * Relies on the theme's colour variables (--color-brown, --color-silver,
 * --color-warm-grey, --color-white, --color-black) and FontAwesome.
 */

/* Wrapper: the script sets margin-bottom while a panel hangs below it. */
.multi-filter {
  transition: margin-bottom 0.3s ease;
}

/* Items sit side by side and wrap. */
.multi-filter .w-filter-list {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.multi-filter .w-filter-item {
  position: relative;
  flex: 1 1 0;
  min-width: 150px;
}

/* Title: pill-shaped button with an arrow / clear icon on the right. */
.multi-filter .w-filter-item-title {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 !important;
  padding: 18px 60px 18px 24px;
  font-size: 16px;
  font-weight: 400;
  color: var(--color-silver);
  text-align: left;
  text-transform: none;
  cursor: pointer;
  z-index: 2;
  border: 1px solid var(--color-brown);
  border-radius: 50px;
  background: #fff;
}
.multi-filter .w-filter-item-title::after {
  content: "\f0ab";
  font-family: "FontAwesome";
  font-weight: 200;
  font-size: 1.6rem;
  color: var(--color-black);
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
  transition: all 0.3s;
}
.multi-filter .w-filter-item.mf-open .w-filter-item-title::after {
  content: "\f0aa";
  transform: rotate(180deg) translateY(50%);
}

/* The theme's own reset button is replaced by the clear icon in the title. */
.multi-filter .w-filter-item-reset {
  display: none !important;
}

/* Dropdown panel: absolutely positioned, tucked under the title. */
.multi-filter .w-filter-item-content {
  display: none !important;
  position: absolute;
  padding: 75px 0 0;
  z-index: 1;
  background: var(--color-white);
  color: var(--color-black) !important;
  border: 1px solid var(--color-brown);
  border-radius: 50px;
  width: 100%;
  top: 0;
  overflow: hidden;
}
.multi-filter .w-filter-item.mf-open .w-filter-item-content {
  display: block !important;
}

/* Values */
.multi-filter .w-filter-item-value {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 400;
  color: var(--color-white);
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.multi-filter .w-filter-item-value:hover {
  background: var(--color-warm-grey);
  color: var(--color-white);
}
.multi-filter .w-filter-item-value label {
  display: block;
  margin: 0;
  padding: 0;
  color: var(--color-black) !important;
}
.multi-filter .w-filter-item-value:hover label {
  color: var(--color-white) !important;
}
.multi-filter .w-filter-item-value.checked,
.multi-filter .w-filter-item-value:has(input:checked) {
  background: var(--color-brown);
  color: var(--color-white);
}
/* Bridge the active first value up to the title. */
.multi-filter .w-filter-item-value:first-child.checked::before,
.multi-filter .w-filter-item-value:first-child:has(input:checked)::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 120px;
  background: var(--color-brown);
}
.multi-filter .w-filter-item-value.checked label,
.multi-filter .w-filter-item-value:has(input:checked) label {
  color: var(--color-white) !important;
}

/* Visually hide the native inputs (labels stay clickable). */
.multi-filter .w-filter-item-value input[type="radio"],
.multi-filter .w-filter-item-value input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Active item: filled title with a clear (times-circle) icon. */
.multi-filter .w-filter-item:has(input:checked) .w-filter-item-title {
  color: var(--color-white);
  background: var(--color-brown);
}
.multi-filter .w-filter-item:has(input:checked) .w-filter-item-title::after {
  content: "\f057";
  color: #fff;
  transform: translateY(-50%);
}
