@import '../../../../../styles/core.scss';

.RefinementList {
  color: get(color 'graphite');
  list-style-type: none;
  margin: 10px 0 0;
  padding-left: 0;

  &-Col {
    // <details> element
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0; // prevent filter col from collapsing when results overflow
    padding: 20px;
    overflow-y: auto;

    @media (max-width: 700px) {
      border-top: 1px solid get(color 'ivory');
    }

    &[open] .RefinementList-Header {
      padding-bottom: 5px;

      &:before {
        transform: rotate(90deg);
      }
    }

    @media (min-width: 701px) {
      border-left: 1px solid get(color 'ivory');
      flex: 0 0 220px;

      summary {
        pointer-events: none !important;
      }
    }
  }

  &-Header {
    align-items: center;
    display: flex;
    font-weight: 500;
    outline: none;
    position: relative;

    @media (max-width: 700px) {
      cursor: pointer;
      padding-left: 20px;

      &:before {
        content: '▶';
        display: inline-block;
        font-size: .75em;
        left: 0;
        position: absolute;
        top: 3px;
        transition: transform .2s cubic-bezier(.16,1,.3,1);
      }
    }

    &::marker { display: none }
    &::-webkit-details-marker { display: none }
  }

  &-Item + .RefinementList-Item {
    margin-top: 10px;
  }

  &-Button {
    align-self: flex-start;
    background: none;
    border: 0;
    color: get(color 'shale');
    cursor: pointer;
    flex: 0 0 auto;
    font-size: 14px;
    margin: 20px 0 20px -5px;
    padding: 0 5px;
    text-decoration: none;
    transition: .2s ease-out;

    &:hover {
      color: get(color 'slate');
    }

    &:active,
    &:focus {
      color: var(--project-color-primary, get(color 'blue'));
    }

    &:focus {
      outline: 0;
      box-shadow: 0 0 0 0.4em #ebebeb;
      background: #ebebeb;
      border-radius: 1px;
    }
  }

  &-Toggle {
    width: 100%;
  }

  :global(.Toggle-label) {
    font-weight: 400;
    margin-left: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
