/**
 * @file
 * Accordion
 *
 * Contains styles for accordion content object.
 */

@use '_helper' as *;

.accordion {

  // Expand/collapse all wrapper
  &__all {
    padding: 0 1em 0 0;
    margin: rem(17px) 0;
    text-align: left;

    @media screen and (min-width: $break-medium) {
      margin: rem(17px) 0 rem(31px);
    }

    @media screen and (min-width: $break-large) {
      margin: rem(32px) 0 rem(31px);
    }

    button {
      @include focus-dark($offset: 10px);
      position: relative;
      padding: 0 0 0 rem(30px);
      background-color: transparent;
      border: 0;
      color: $color-black;
      font-size: 1em;
      font-weight: 700;
      transition: 0.3s ease-in-out;

      @media screen and (min-width: $break-medium) {
        padding: 0 0 0 rem(34px);
      }

      @media screen and (min-width: $break-large) {
        padding: 0 0 0 rem(40px);
      }

      &:hover {
        .accordion__all-icon {
          background: $color-blue-dark;

          &:before,
          &:after {
            border-color: $color-white;
          }
        }
      }

      &.js-disabled {
        opacity: 0.4;
        pointer-events: none;
      }
    }

    &-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      position: absolute;
      top: 50%;
      left: 0;
      transform: translateY(-50%);
      width: rem(20px);
      height: rem(20px);
      border-radius: 100%;
      background: $color-gold;
      transition: all 0.1s ease;

      @media screen and (min-width: $break-medium) {
        width: rem(25px);
        height: rem(25px);
      }

      @media screen and (min-width: $break-large) {
        width: rem(30px);
        height: rem(30px);
      }

      &:before,
      &:after {
        content: '';
        display: block;
        width: 9px;
        position: absolute;
        border-top: solid 2px $color-black;
        transition: 0.1s ease-in-out;
  
        @media screen and (min-width: $break-medium) {
          width: 10px;
        }
  
        @media screen and (min-width: $break-large) {
          width: 13px;
        }
      }

      &:after {
        transform: rotate(-90deg);
      }
    }
  }

  // Expand all toggle
  &__expand-all {
    margin-right: rem(26px);
    cursor: pointer;

    &.js-disabled {
      .accordion__all-icon {
        &:before {
          height: 0;
        }
      }
    }
  }

  // Collapse all toggle
  &__collapse-all {
    cursor: pointer;

    &:not(.js-disabled) {
      .accordion__all-icon {
        &:before {
          height: 0;
        }
      }
    }

    .accordion__all-icon:after {
      content: none;
    }
  }

  // Accordion item
  &__item {
    margin: 0 0 rem(20px);
    overflow: hidden;
    border-radius: rem(15px);

    &:last-child {
      margin: 0;
    }
  }

  // Item toggle
  &__toggle {
    @include focus-light($offset: -12px);
    display: block;
    position: relative;
    padding: rem(25px) rem(20px) rem(25px) rem(58px);
    width: 100%;
    color: $color-white;
    background: $color-blue;
    font-family: $font-roboto-slab;
    font-size: rem(20px);
    font-style: normal;
    font-weight: 500;
    border: 0;
    cursor: pointer;
    line-height: 1.35;
    text-align: left;
    transition: 0.3s ease-in-out;

    &:hover {
      background: $color-blue-dark;
    }

    @media screen and (min-width: $break-medium) {
      line-height: 1.05;
      font-size: rem(22px);
      padding: rem(24px) rem(28px) rem(24px) rem(70px);
    }

    @media screen and (min-width: $break-large) {
      padding: rem(26px) rem(30px) rem(26px) rem(73px);
      font-size: rem(25px);
      line-height: 1.15;
    }

    // Expanded toggle styling
    &.js-expanded {
      .accordion__icon:before {
        width: 0;
      }
    }
  }

  &__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    height: 1em;
    width: 1em;
    left: 1em;
    top: 50%;
    transform: translateY(-50%);

    @media screen and (min-width: $break-medium) {
      left: 1.25em;
    }

    // Psuedo elements to make up +/-
    &:before,
    &:after {
      position: absolute;
      top: 50%;
      content: '';
      width: 100%;
      border-top: solid 3px $color-white;
      transition: 0.3s ease-in-out;
    }

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

  &__content {
    display: none;
    padding: rem(20px);
    background: $color-blue-light;

    @media screen and (min-width: $break-medium) {
      padding: rem(20px) rem(30px);
    }

    &> :first-child {
      margin-top: 0;
    }

    .views-element-container {
      width: 100%;
    }
  }

  &__copy {
    width: 100%;

    .table--wysiwyg {
      margin: 0;
      width: 100%;

      @media (max-width: $break-medium - 1px) {
        margin: 0 1em;
        width: calc(100% + 2em);
      }
    }
  }

  &__top {
    @include focus-dark($offset: 8px);
    position: relative;
    font-size: rem(16px);
    font-style: normal;
    font-weight: 700;
    margin: 0;
    padding: 0 0 0 rem(31px);
    background: transparent;
    border: 0;

    @media screen and (min-width: $break-medium) {
      padding: 0 0 0 rem(35px);
    }

    @media screen and (min-width: $break-large) {
      padding: 0 0 0 rem(43px);
      font-size: rem(18px);
    }

    &:before {
      content: '';
      position: absolute;
      left: 0;
      top: 50%;
      display: inline-block;
      width: rem(20px);
      height: rem(20px);
      background-image: url('../../assets/icons/after-arrow-yellow.svg');
      background-size: 100%;
      background-position: center;
      background-repeat: no-repeat;
      transform: translateY(-50%) rotate(-90deg);

      @media screen and (min-width: $break-medium) {
        width: rem(24px);
        height: rem(24px);
      }

      @media screen and (min-width: $break-large) {
        width: rem(30px);
        height: rem(30px);
      }
    }
  }
}