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

.ma__relationship-indicators {

  @include clearfix;
  display: flex;
  flex-direction: column;
  padding: 0;
  font-weight: 600;
  border-bottom: 0;
  margin: 5px 20px;
  font-size: $fonts-small;

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

  @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;
  }

  &__heading {
    list-style: none;
    margin: 0 5px 0 5px;
    padding-right: 0;
    display: flex;

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

  &--icon {
    padding-right: 7px;
    margin-top: 2px;

    svg {
      color: var(--mf-c-font-detail);
    }
  }

  &--label {
    color: var(--mf-c-font-detail);
    text-transform: uppercase;
    letter-spacing: $letter-spacing-large;
    margin-right: 10px;
    margin-top: 1px;
    white-space: nowrap;

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

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

  &--borderless {
    border-bottom: 0;
  }

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

    &--fold {
      display: none;
    }
  }

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

  &--section {
    width: 100%;
    min-width: 50%;
    display: flex;
    padding-top: 20px;
    flex-direction: column;

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

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

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

    .ma__relationship-indicators__expand-indicators {

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

    a {
      text-decoration: none;
    }

    &.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: var(--mf-c-primary);
        box-shadow: inset 0 0 var(--mf-c-white), inset 0px -1px var(--mf-c-bay-blue-lighter);
        // border-bottom: 1px solid $c-bay-blue-lighter;

        &:hover {

          box-shadow: inset 0 0 var(--mf-c-white), inset 0px -2px var(--mf-c-bay-blue-30-tint);
          // border-bottom: 2px solid $c-bay-blue-30-tint;
        }
      }

      button {
        color: var(--mf-c-primary);

        &.is-open {

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

    &.secondary {
      width: 100%;
      min-width: 40%;
      padding: 0 0 8px 0;
      margin-left: 0;

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

      a {
        color: var(--mf-c-primary-alt);
        box-shadow: inset 0 0 $c-white, inset 0px -1px rgba($c-primary-alt, 0.4);// This can be replaced with border-bottom. See L.163.

        &:hover {
          box-shadow: inset 0 0 $c-white, inset 0px -2px rgba($c-primary-alt, 0.7);// This can be replaced with border-bottom. See L.163.
        }
      }

      button {
        color: var(--mf-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: var(--mf-c-primary-alt);
        box-shadow: inset 0 0 $c-white, inset 0px -1px rgba($c-primary-alt, 0.4);

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

    &-group {
      margin: 0 20px 0 2px;

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

      button {
        color: var(--mf-c-primary-alt);
      }

      .ma__relationship-indicators {

        &__heading {
          margin: 0;
        }

        &--terms {

          &.folded > .item-fold {
            display: none;
          }
        }

        &--term {
          margin: 0 5px 0 0;
          padding-right: 0;

          @media ($bp-medium-min) {
            margin: 0 5px;
          }

          a {
            margin-right: 10px;
            position: relative;

            &:before {
              content: "";
              width: 10px;
              position: absolute;
              height: $fonts-small;
              right: -10px;
              bottom: 1px;
              border-right: 1px solid var(--mf-c-gray-light);
            }
          }

          &--last.no-fold a:before {
            content: none;
          }
        }

        &__expand-indicators {
          margin: 0 5px 0 0;

          @media ($bp-medium-min) {
            margin: 0 5px;
          }
        }

      }
    }
  }

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

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

  & + .ma__page-banner-legacy--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;
    }
  }
}
