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

.ma__section-links {
  position: relative;
  width: 100%;

  @media ($bp-x-small-max) {
    border-top: 2px solid;
    margin: 0 -20px;
    width: calc(100% + 40px);

    &:last-child {
      border-bottom: 2px solid;
    }
  }

  // controls for when to activate accordion

  &.js-accordion:before {
    content: "true";
    display: none;

    @media ($bp-x-small-min) {
      content: "false";
    }
  }

  &__content {
    height: 100%;
    padding: 10px 20px 0 10px;

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

    @media ($bp-small-min) {
      display: flex;
        align-items: flex-start;
        flex-direction: column;
        flex-wrap: wrap;
      padding: 12px 30px 0;
    }

    @media ($bp-small-min) {
      padding: 20px 30px 0;
    }
  }

  &__description {
    margin-bottom: 25px;

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

  &__icon {
    text-align: center;

    @media ($bp-x-small-max) {
      display: none;
    }

    @media ($bp-x-small-min) {
      margin: -20px auto 1.4em;
    }
  }

  &__mobile-title {
    font-size: $fonts-larger;
    padding: 0 16px 0 0;

    @media ($bp-x-small-min) {
      display: none;
    }

    & a > svg {
      height: .75em;
      margin-right: -16px;
      width: .75em;
    }

    a {

      @include ma-link-underline;
      padding-bottom: 0px;
    }
  }

  &__title {

    @include ma-h3;
    margin-bottom: .5em;

    .ma__decorative-link {
      width: 94%;// Slightely bigger than the parent box to prevent extra bottom space with one line content.
      box-sizing: content-box;
    }

    @media ($bp-x-small-min) {

      position: relative;
    }

    @media ($bp-small-min) {

      margin-bottom: .5em;
    }

    @media ($bp-large-extended-max) {

      width: 99%;

      .ma__decorative-link {
        box-sizing: content-box;
        width: 92%;
      }
    }

    align-self: stretch;

    a {
      border: none;
    }

    @media ($bp-x-small-max) {
      align-self: flex-start;
      cursor: pointer;
      font-size: $fonts-2xlarge;

      padding-right: 1em;
      width: 100%;
    }

    .ma__section-links--compact & {

      @media ($bp-large-extended-max) {

          width: auto;
      }

      @media ($bp-x-small-max) {

        padding-right: 0;
      }
    }

    @media ($bp-x-small-min) {

      @include ma-border-decorative;

      .ma__section-links--default & {
        padding-bottom: 16px;
      }

      svg {
        margin-right: -16px;
      }
    }

    .js-accordion & .ma__decorative-link,
    .js-accordion & .ma__card-header {

      @media ($bp-x-small-max) {
        display: none;
      }
    }
  }

  &--accordion__toggle {
    all: unset;// reeset any styles applied to button to match ones for decorative links.
    box-sizing: inherit;

    display: none;
    border: none;
    background: none;
    padding-left: 0;

    font-weight: $fonts-bold;
    text-align: left;

    .ma_section_links--header_mobile {
      color: var(--mf-c-font-heading);
    }

    @media ($bp-x-small-max) {

      padding-right: 0.8em;

      .js-accordion & {

        @include ma-link-decorative;
        display: inline-block;
        vertical-align: middle;
        width: 100%;

        padding-right: 1em;
      }

      &--status {
        display: block;
        font-size: 1.5em; //$fonts-5xlarge;
        line-height: .75em;
        border: none;
        overflow: hidden;
        position: absolute;
        right: 15px;
        top: 15px;
        transform-origin: center center;
        transition: transform .5s ease;

        padding-left: 0;
        margin-left: 0;

        .is-open & {
          transform: rotate(135deg);
        }
      }
    }
  }

  &__toggle-content {
    flex-basis: auto;
    flex-grow: 1;
    flex-shrink: 1;
    width: 100%;

    @media ($bp-x-small-max) {
      display: none;

      .is-open & {
        display: block;
        padding-bottom: 20px;
      }
    }
  }

  &__items {

    @include ma-reset-list;
  }


  // skip the first item

  &__item + &__item {
    margin-top: 1em;
  }

  // Make child content callout links full width

  &__item > .ma__callout-link {
    display: block;
    width: 100%;
  }

  &__item > .ma__decorative-link {

    &__item > .ma__decorative-link {
      font-size: $fonts-xlarge;
      line-height: 1.3;
      color: var(--mf-c-primary);
    }
  }
}

//theme

.ma__section-links {
  background-color: var(--mf-c-bg-section);

  &--accordion__toggle {
    color: var(--mf-c-primary);
  }

  @media ($bp-x-small-max) {
    border-top-color: var(--mf-c-bd-divider);

    &.is-open {
      background-color: var(--mf-c-bg);
    }

    &:last-child {
      border-bottom-color: var(--mf-c-bd-divider);
    }
  }

  &__title {

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

    svg {
      fill: var(--mf-c-font-link);
    }

  }

  &--accordion__toggle--status {
    color: var(--mf-c-primary-alt);
  }

  &__mobile-title {

    & + .ma__section-links__items {

      @media ($bp-x-small-max) {
        border-top: 1px solid var(--mf-c-bd-divider);
        padding-top: 0.75em;
        margin-top: 0.75em;
      }
    }

    svg {
      fill: var(--mf-c-font-link);
    }

    a:hover {

      @media ($bp-x-small-max) {
        border-bottom-color: var(--mf-c-link);
      }
    }
  }

  &__link {

    &:hover {
      border-bottom-color: var(--mf-c-link);
    }
  }

  &--compact {

    .ma__section-links__title {

      @include ma-h5;

      display: flex;
      justify-content: flex-start;
      align-items: center;

      @media ($bp-x-small-max) {
        font-size: $fonts-xlarge;
      }
    }

    .ma__section-links__content {
      padding: 10px 20px 0;
    }
  }
}
