@use "00-base/configure" as *;

.ma__relationship-indicators {

  @include clearfix;
  display: flex;
  flex-direction: column;
  padding: 20px 0 15px 0;
  font-weight: 600;
  border-bottom: 1px solid $c-bd-divider;
  margin: 0 20px 10px;
  font-size: $fonts-smaller;

  @media ($bp-small-min) {
    font-size: $fonts-xsmall;
  }

  @media ($bp-x-small-min) {
    padding-top: 23px;
  }

  @media ($bp-medium-min) {
    margin-left: 30px;
    margin-right: 30px;
  }

  @media ($bp-large-min) {
    flex-direction: row;
    align-items: flex-start;
    margin-left: 40px;
    margin-right: 40px;
  }

  @media ($bp-centered-content-width) {
    max-width: $l-max-content-wrapper;
    padding-left: 0;
    padding-right: 0;
    margin-left: auto;
    margin-right: auto;
  }

  &--label {
    color: $c-font-detail;
    text-transform: uppercase;
    letter-spacing: $letter-spacing-large;
    margin-right: 10px;
    margin-bottom: .25em;
    white-space: nowrap;

    @media ($bp-x-small-min) {
      min-width: 6.5em;
    }

    @media ($bp-large-min) {
      min-width: unset;
    }
  }

  &--term {
    margin-right: 10px;
    line-height: 22px;
    padding-right: 5px;
    list-style: none;
  }

  &__expand-indicators {
    list-style: none;
    order: 1;
  }

  &--section {
    width: 100%;
    min-width: 50%;
    display: flex;
    flex-direction: column;

    @media ($bp-x-small-min) {
        flex-flow: row nowrap;
    }

    .ma__relationship-indicators--term,
    .ma__relationship-indicators__expand-indicators {
      // margin-bottom: 2px;

      // @media ($bp-x-small-min) {
        margin-bottom: 5px;
      // }

      @media ($bp-large-max) {
        // margin-bottom: 5px;
      }

      @media ($bp-large-min) {
        margin-bottom: 10px;//12px;
      }
    }

    .ma__relationship-indicators__expand-indicators {

      @media ($bp-large-min) {

        margin-bottom: 5px;
      }
    }

    &.primary {
      width: 100%;
      min-width: 60%;

      @media ($bp-medium-min) {
        padding-right: 1.5rem;
      }

      .ma__relationship-indicators--term {

        @media ($bp-medium-max) {

          &:nth-child(n+2) {
            display: none;
          }
        }
      }

      // Only hide tags if secondary tags present.

      &:not(.single) .ma__relationship-indicators--term {

        &:nth-child(n+2) {
          display: none;
        }
      }

      a {
        color: $c-primary;
        box-shadow: inset 0 0 white, inset 0px -1px rgba($c-primary, 0.4);

        &:hover {
          box-shadow: inset 0 0 white, inset 0px -2px rgba($c-primary, 0.7);
        }
      }

      button {
        color:$c-primary;

        &.is-open {

          .tag-state {
            display: inline-block;
          }
        }

        .tags-open & {
          align-self: basline;
        }
      }
    }

    &.secondary {
      width: 100%;
      min-width: 40%;
      padding-top: 8px;

      @media ($bp-large-min) {
        padding-top: 0;
      }

      .ma__relationship-indicators--term {

        &:nth-child(n+2) {
          display: none;
        }
      }

      a {
        color: $c-primary-alt;
        box-shadow: inset 0 0 white, inset 0px -1px rgba($c-primary-alt, 0.4);

        &:hover {
          box-shadow: inset 0 0 white, inset 0px -2px rgba($c-primary-alt, 0.7);
        }
      }

      button {
        color: $c-primary-alt;
      }
    }

    a {
      width: 100%;

      @media ($bp-x-small-min) {
        width: auto;
      }
    }

    button {

      @include ma-button-reset;

      @include ma-link-underline;

      @include ma-chevron;
      text-transform: capitalize;
      align-self: flex-start;
      padding: 0;
      line-height: 22px;
      font-weight: 600;
      white-space: nowrap;
      display: none;

      .tag-state {
        text-transform: none;
      }

      &:after {
        opacity: 0.5;
        border-width: 3px;
        height: 8px;
        width: 8px;
        transform: translateY(-45%) rotate(45deg);
        margin-right: 5px;
        margin-left: 5px;
      }

      &.is-open::after {
        transform: translateY(-55%) rotate(-135deg);
      }
    }

    &.single [aria-labelledby="secondary"] {

      a {
        color: $c-primary-alt;
        box-shadow: inset 0 0 white, inset 0px -1px rgba($c-primary-alt, 0.4);

        &:hover {
          box-shadow: inset 0 0 white, inset 0px -2px rgba($c-primary-alt, 0.7);
        }
      }
    }
  }

  &--terms {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 0;
    padding-bottom: 0;
    padding-inline-start: 0;

    @media ($bp-x-small-min) {
      flex-flow: row wrap;
    }
  }

  & + .ma__illustrated-header,
  & + .ma__page-header,
  & + .ma__page-banner {
    margin-top: -11px;
  }

  & + .ma__page-banner--columns {

    @media ($bp-medium-min) {
      padding-top: 25px;
    }

    @media ($bp-large-min) {
      padding-top: 45px;
    }
  }

  // IE11 adjustment - remove when we drop IE 11 support.

  @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {

    .ma__relationship-indicators--terms {
      padding-left: 10px;
    }
  }
}
