$page-header-widget-width: 350px;

@use "00-base/configure" as *;

.ma__page-header {

  @include ma-container;

  @include clearfix;

  &__tags {
    clear: both;
    display: flex;
      align-items: flex-start;
      flex-wrap: wrap;
      justify-content: space-between;
    overflow: hidden;
    margin-bottom: 20px;
    padding-top: 18px;
    border-bottom-width: 1px;
    border-bottom-style: solid;


    .ma__header-tags,
    .ma__social-links {
      border-bottom-width: 1px;
      border-bottom-style: solid;
      min-height: 48px;
      position: relative;
        top: 1px;

      @media ($bp-medium-min) {
        border: 0;
      }
    }

    .ma__header-tags {
      flex-grow: 1;
      margin-bottom: 30px;

      @media ($bp-medium-min) {
        margin-bottom: 10px;
      }
    }

    .ma__social-links {
      flex-grow: 0;

      @media ($bp-small-max) {
        width: 100%;
      }

      &__link[data-social-share="facebook"] {

        svg,
        svg path {
          fill: #395999;
        }
      }

      &__link[data-social-share="twitter"] {

        svg,
        svg path {
          fill: #16a2f3;
        }
      }

      &__link[data-social-share="linkedin"] {

        svg,
        svg path {
          fill: #0078b6;
        }
      }

      &__link[data-social-share="youtube"] {

        svg,
        svg path {
          fill: #CC181E;
        }
      }
    }

    @media ($bp-medium-max) {
      border: 0;
    }
  }

  &__content {
    padding: 30px 0;
  }

  &__tags ~ &__content {
    padding-top: 30px;

    @media ($bp-medium-min) {
      padding-top: 40px;
    }

    @media ($bp-large-min) {
      padding-top: 50px;
    }

    @media ($bp-x-large-min) {
      padding-top: 60px;
    }
  }

  .ma__page-banner ~ & &__content {
    padding-top: 20px;
  }

  &--has-widgets &__content {

    @media ($bp-medium-min) {
      padding-bottom: 45px;
    }

    @media ($bp-large-min) {
      float: left;
      padding-right: $column;
      max-width: 820px;
      width: calc(100% - #{$page-header-widget-width});
    }
  }

  &__widgets {
    padding-bottom: 40px;

    @media ($bp-large-min) {
      float: right;
      padding-top: 75px;
      padding-bottom: 60px;
      width: $page-header-widget-width;
    }

    @media ($bp-x-large-min) {
      padding-top: 85px;
    }

    & > * {
      margin-top: 30px;

      &:first-child {
        margin-top: 0;
      }
    }

    .ma__image {

      @media ($bp-large-min) {
        clear: both;
        float: right;
      }
    }
  }

  &__tags ~ &__widgets {

    @media ($bp-large-min) {
      padding-top: 50px;
    }

    @media ($bp-x-large-min) {
      padding-top: 60px;
    }
  }

  .ma__page-banner ~ & &__widgets {

    @media ($bp-large-min) {
      padding-top: 20px;
    }
  }

  &__publish-state {
    margin-top: -20px;
    margin-bottom: 35px;
  }

  &__category {
    font-size: $fonts-medium;
    padding-bottom: 1rem;
    line-height: 1.1;
    font-weight: $fonts-bold;
    letter-spacing: $letter-spacing-large;
    text-transform: uppercase;
  }

  &__title {
    margin-bottom: .4em;

    &:last-child {
      margin-bottom: 0;
    }

    .ma__page-header__sub-title {
      margin-top: .8em;
    }
  }

  .ma__page-banner ~ & &__title {
    display: none;
  }

  &__sub-title {

    &:last-child {
      margin-bottom: 0;
    }

    @media ($bp-large-min) {
      padding-right: $column;
      width: calc(100% - #{$layout-sidebar-width});
    }

    @media ($bp-x-large-min) {
      padding-right: $column + ($gutter * 2);
    }
  }

  // Control font size and line height
  // regardless of it's added to page

  &__sub-title,
  &__sub-title * {
    font-size: $fonts-larger !important;
    line-height: 1.3 !important;
    margin-bottom: 1em;
  }

  &__sub-title .ma__rich-text__container {
    margin-bottom: 0;
  }


  &--has-widgets &__sub-title {

    @media ($bp-large-min) {
      padding-right: 0;
      width: 100%;
    }
  }

  &__optional-content {

    .main-content {
      margin: 0;
      padding: 0;
      width: 100%;

      .page-content {
        padding-bottom: 0;
      }
    }

    .ma__contact-us {

      &.js-accordion {

        @include clearfix;

        // controls for when to activate accordion

        &:before {
          content: "true";
        }

        @media ($bp-small-min) {

          &:before {
            content: "false";
          }
        }
      }

      & > .ma__contact-group:first-child {

        @media ($bp-small-min) {
          clear: both;
          padding-bottom: 20px;
        }
      }

      // more than two contacts

      .ma__contact-group:nth-child(2):nth-last-child(3) {

        @media ($bp-small-min) {
          border-right-width: 1px;
          border-right-style: solid;
          float: left;
          height: 100%;
          padding-right: 45px;
          padding-top: 0;
          width: 50%;
        }
      }

      &__extra {

        @media ($bp-small-min) {
          border-left-width: 1px;
          border-left-style: solid;
          display: block;
          float: left;
          height: 100%;
          margin-left: -1px;
          padding-left: 45px;
          padding-top: 0;
          width: 50%;
        }
      }

      &__expand {
        clear: both;

        @media ($bp-small-min) {
          display: none;
        }
      }
    }
  }

  &--has-widgets &__optional-content {

    .page-content {
      padding: 0;
      width: 100%;
    }
  }

  &__divider {
    clear: both;
    padding-bottom: 30px;

    @media ($bp-medium-min) {
      padding-bottom: 50px;
    }

    @media ($bp-large-min) {
      padding-bottom:60px;
    }

    .ma__divider {
      padding-left: 0;
      padding-right: 0;
    }

  }
}

//theme

.ma__page-header {

  &__tags {

    @media ($bp-medium-min) {
      border-color: $c-bd-divider;
    }

    .ma__header-tags,
    .ma__social-links {
      border-color: $c-bd-divider;
    }
  }

  &__category {
    color: $c-font-detail;
  }

  &__sub-title {
    color: $c-font-heading;
    font-weight: $fonts-bold;
  }

  &__optional-content {

    @media ($bp-small-min) {

      .ma__contact-us > .ma__contact-group:nth-child(2):nth-last-child(3),
      .ma__contact-us > .ma__contact-us__extra {
        border-color: $c-bd-divider;
      }
    }

    .ma__contact-us__expand {
      border-top-color: $c-bd-divider;
    }
  }

}
