/* List of filters for search results */

.filters {
  margin-bottom: $spacing-04;
  border: 0;
  @include typescale-06;

  input[type="checkbox"],
  input[type="radio"] {
    display: unset;
    opacity: 0;
    width: 0.8em;
    height: 0.8em;

    &:focus  + label {
      outline: dashed 2px lightgrey;
      outline-offset: 1px;
    }

    &:focus:not(:focus-visible){
      outline: none;
    }
  }

}

.filters__heading {
  svg {
    height: 0.75em;
  }
}

.filters__list {
  @include unstyled-list;
}

.filter {
  margin: $spacing-04 0;

  &:first-child {
    margin-top: auto;
  }
}

.filter__heading {
  margin: auto 0 $spacing-03 0;

  svg {
    float: right;
    height: 1em;
    width: auto;
  }
}

.filter__search {
  margin-bottom: $spacing-03;
  width: 100%;
  font-size: smaller;
  border-color: rgba($dark-grey, 0.75);
  color: $warm-black;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-search'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-size: 1em;
  background-position: calc(100% - 0.5em) center;
  background-repeat: no-repeat;
}

.filter__choices {
  max-height: $spacing-07;
  height: auto;
  overflow-y: auto;
  padding-top: $spacing-01;
  @include unstyled-list;

  li {
    padding: 0 $spacing-01;
    margin-bottom: $spacing-02;
    line-height: 1.35;
  }

  svg {
    vertical-align: middle;
  }

  strong {
    background: $light-grey;
  }

  // subheadings / filters within filters
  .filter__choices {
    margin-top: $spacing-02;
    margin-left: $spacing-02;
    padding-left: $spacing-02;
    border-left: 1px solid $sanguine;
    overflow-y: visible;
    max-height: -moz-max-content; // Firefox fix
    max-height: fit-content;
  }
}

.filter__label {
  font-size: 1em !important;
}

// Display header like a button when on smaller viewports
@media (max-width: 991px) {
  .filters__heading {
    display: inline-block;
    margin: 0 0 $spacing-03 0;
    padding: $spacing-03;
    border: 1px solid $warm-black;
    background-color: $light-grey;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    @include typescale-06;
  }
}

// Do not display as accordion on mobile
@media (min-width: 992px) {
  .filters {

    .filters__heading {
      margin-bottom: $spacing-04;
      cursor: default;
    }

    .filters__list {
      display: block;
    }
  }
}
