@use "00-base/configure" as *;

.ma__jump-links {
  margin-bottom: 30px;
  //position: relative // can't have position relative here or the links won't stick for the height of page-content

  &__skip-link__container {
    margin: 0 auto;

    @include ma-container;
    position: relative;
    top: -50px;

    @media ($bp-small-max) {
      display: none;
    }
  }

  &__skip-link {
    width: 100%;
    display: block;
    padding: 3px 14px;

    @media ($bp-small-min) {
      width: 100%;
    }

    @media ($bp-large-min) {
      width: calc(100% - 380px);
    }

    &:not(:focus) {

      @include ma-visually-hidden;
      width: calc(100% - 380px);
    }
  }

  @media ($bp-small-min) {
    margin-bottom: 60px;
    padding-top: 30px;
  }

  @media print {
    display: none;
  }

  &__inner {

    @media ($bp-small-min) {
      padding-bottom: 35px;
    }
  }

  &__container {

    @include ma-container;
  }

  &__title {

    @include ma-heading-colored;
    margin-bottom: 0;
    position: relative;
      top: -30px;

    &:after {
      display: none;
    }

    @media ($bp-small-max) {
      display: none;
    }

    @media ($bp-small-min) {
      margin-bottom: 15px;
    }
  }

  &__links {

    @include clearfix;
    position: relative;
    transition: top .3s;
    width: 100%;
    z-index: $z-sticky-content;

    &:before {
      content: "false"; // hook for JS to do the mobile sticky
      display: none;
    }

    @media ($bp-small-max) {
      left: 0;

      &:before {
        content: "true"; // hook for JS to do the mobile sticky
      }

      &[data-sticky='middle'] {
        position: fixed;
          top: 40px;

        .translated-rtl &,
        .translated-ltr & {
          top: 80px;
        }
      }

      &[data-sticky='bottom'] {
        position: absolute;
          top: auto; // height of one line of text
          bottom: -30px; // compensate for bottom margin
      }
    }
  }

  &__toggle-link {

    @include ma-button-reset;
    font-size: $fonts-4xlarge;
    line-height: .65em;
    overflow: hidden;
    position: absolute;
      right: 10px;
      top: 9px;
    transition: transform .2s ease;
    transform-origin: center center;
    z-index: 1;

    .is-open & {
      transform: rotate(135deg);
    }

    @media ($bp-small-min) {
      display: none;
    }
  }

  &__column {

    @media ($bp-small-max) {

      .is-open &:last-child {
        border-top-width: 1px;
        border-top-style: solid;
      }
    }

    @media ($bp-small-min) {
      float: left;
      width: 50%;

      &:nth-child(odd) {
        padding-left: 45px;
      }

      &:nth-child(even) {
        border-right-width: 1px;
        border-right-style: solid;
        padding-right: 45px;
      }
    }

    @media ($bp-medium-min) {

      &:nth-child(odd) {
        padding-left: 90px;
      }

      &:nth-child(even) {
        padding-right: 90px;
      }
    }
  }

  &__link {
    line-height: 1.2;
    padding-bottom: .35em;
    padding-left: 35px;
    position: relative;

    & > svg {
      height: 22px;
      position: absolute;
        left: 0;
        top: 4px;
      transform: rotate(90deg);
      width: 22px;
    }

    a {

      @include ma-link-underline;

      @media ($bp-small-min) {
        line-height: 1.5;
      }
    }

    @media ($bp-small-max) {
      display: none;
      font-size: $fonts-small;
      line-height: 1.2;
      padding: 10px 35px 10px 15px;

      &.is-active {
        display: block;

        a {
          border: none;
        }
      }

      .is-open & {
        display: block;
      }

      .is-open & + & {
        border-top-width: 1px;
        border-top-style: solid;
      }
    }
  }
}

//theme

.ma__jump-links {

  &__inner {

    @media ($bp-small-min) {
      background-color: $c-bg-section;
    }
  }

  &__title {
    background-image: linear-gradient(-60deg, transparent, transparent 35px, $c-primary-alt 35px);
    color: $c-white;
    font-weight: $fonts-bold;
  }

  &__links {

    @media ($bp-small-max) {
      background-color: $c-bg-section;
    }
  }

  &__column {
    border-color: $c-bd-divider;
  }

  &__link {

    & > svg {
      fill: $c-primary-alt;

      @media ($bp-small-max) {
        display: none;
      }
    }

    &:hover a {
      border-bottom-color: rgba($c-font-link,.5);
    }

    @media ($bp-small-max) {

      a {
        font-weight: $fonts-normal;
      }

      &.is-active a {
        color: $c-font-base;
        font-weight: $fonts-bold;
      }

      &.is-active:hover a {
        color: $c-font-base;
        border-bottom-color: transparent;
      }

      & + & {
        border-top-color: $c-bd-divider;
      }

    }
  }

  &__toggle-link {
    color: $c-primary-alt;
  }
}
