@use "00-base/configure" as *;

$page-banner-icon-width: $column + $gutter;
$page-banner-height: 330px;

.ma__page-banner {
  background-size: cover;
  background-position: center center;
  height: auto;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;

  @media ($bp-x-small-min) {
    height: 300px;
    margin-bottom: 40px;
  }

  // to match height and font size being provided to prod by
  // decision tree module styles

  .decision-tree & {

    h1 {
      font-size: $fonts-2xlarge;

      @media ($bp-small-min) {
        font-size: $fonts-xlarge;
      }
    }

    &.ma__page-banner--overlay {
      height: 120px;
    }
  }

  &--overlay {

    @media ($bp-large-min) {
      height: 400px;
    }

    .ma__page-banner__content-wrapper {
      transform: none;
    }
  }

  &--columns {
    height: auto;
    min-height: 350px;
    max-height: none;

    @media ($bp-medium-min) {
      padding-top: 45px;
    }

    @media ($bp-large-min) {
      margin-bottom: 70px;
    }
  }

  &--linked {
    position: relative;
    overflow: hidden;
    height: auto;
    min-height: 240px;

    @media ($bp-large-extended) {
      max-height: none;

       &:after {
        content: '';
        display: block;
        height: 50vw;
        width: 100%;
      }
    }

    .ma__page-banner__image {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 500px;
      background-size: cover;
      background-position: center;

      @media (min-width: $max-width) {
        right: calc(-100vw + #{$max-width});
      }

      @media ($bp-large-extended) {
        left: 0;
        top: 100%;
        height: 50vw;
      }
    }

  }

  &--linked &__container {

    @media ($bp-large-extended) {
      height: auto;
    }
  }

  &--linked &__content-wrapper {

    @media ($bp-large-extended) {
      width: auto;
    }
  }

  &--linked &__content {
    position: static;
    height: auto;
  }

  &__container {

    @include ma-container;
    height: 100%;
    position: relative;
    padding-right: 0;
  }

  &--columns &__container {

    @include clearfix;
    height: auto;
    min-height: 500px;
    padding-right: 0px; //fix gap on mobile

    &:after {
      clear: both;
      content: "";
      display: table;
    }
  }

  &--overlay &__container {

    &:before {
      content: '';
      height: 100%;
      left: 50%;
      position: absolute;
      transform: translateX(-50%);
      width: 100vw;
    }
  }

  &__content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: $fonts-xsmall;
    max-width: 1050px;
    padding: 30px 25px 45px 0;
    z-index: 1;
    top: -50%;

    @media ($bp-x-small-min) {
      margin-right: 70px;
      padding-top: 50px;
      padding-right: 80px;
      position: absolute;
      top: 50%;
      transform: translateY(-50%) skew(-30deg);
    }

    &:before {
      content: "";
      height: 100%;
      top: 0;
      right: 100%;
      position: absolute;
      width: 50vw;

      @media ($bp-x-small-min) {
        right: 99%; // weird gap when skewed is shown
      }
    }
  }

  &__content-wrapper {
    z-index: 1;

     @media ($bp-x-small-min) {
      transform: skew(30deg);
      width: 55vw;
      display: flex;
      flex-wrap: wrap;
    }
  }

  &--small &__content {
    font-size: $fonts-2xsmall;
    padding: 25px 25px 40px 0;

    @media ($bp-x-small-min) {
      padding-top: 45px;
      padding-right: 80px;
    }
  }

  &--large &__content {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: 640px;
    position: relative;

    @media ($bp-x-small-min) {
      margin-right: 105px;
      top: 0;
      transform: skew(-30deg);
    }
  }

  &--overlay &__content {
    padding: 25px 20px 25px 0;

    @media ($bp-x-small-min) {
      transform: translateY(-50%);
      padding-right: 0;
    }

    &:before {
      display: none;
    }
  }

  &--columns &__content {
    height: $page-banner-height;
    max-width: 700px;
    position: relative;
    top: 0;

    @media ($bp-x-small-min) {
      position: relative;
      top: calc(#{$page-banner-height} / 2);
    }

    @media ($bp-medium-min) {
      height: 100%;
        top: 50px;
      transform: skew(-30deg);
    }
  }

  &__icon {
    padding-right: 30px;
    width: 75px;
    display: none;

    @media ($bp-medium-min) {
      margin: auto 0;
      width: $page-banner-icon-width;
      display: inline-block;
    }

    & > svg {
      height: 2.75em;
      width: 100%;

      @media ($bp-medium-min) {
        height: 3.75em;
      }

      @media ($bp-large-min) {
        height: 4.25em;
      }

      @media ($bp-x-large-min) {
        height: 4.625em;
      }
    }

    a {
      display: inline-block;
    }
  }

  &--small &__icon {

    @media ($bp-medium-min) {
      width: $column;
    }
  }

  &__title {
    flex-grow: 1;
    line-height: 1.05;
    margin-bottom: 0;
    vertical-align: middle;
    z-index: 1;

    & > abbr {
      font-size: .4em;
      border: none;
      text-decoration: none;
    }
  }

  &--columns &__title,
  &--large &__title,
  &--small &__title {

    @media ($bp-small-min) {
      font-size: $fonts-7xlarge;
    }

    @media ($bp-large-min) {
      font-size: $fonts-8xlarge;
    }
  }

  &--overlay &__title {

    @media ($bp-x-small-min) {
      width: calc(100% - 75px);
    }
  }

  &__icon + &__title {

    @media ($bp-x-small-min) {
      width: calc(100% - 75px);
    }

    @media ($bp-medium-min) {
      width: calc(100% - #{$page-banner-icon-width});
    }
  }

  &--small &__icon + &__title {

    @media ($bp-medium-min) {
      width: calc(100% - $column);
    }
  }

  &__description,
  &__unlinked-title,
  .ma__decorative-link {
    display: block;
    font-size: $fonts-xlarge;
    letter-spacing: $letter-spacing-small;
    line-height: 2.188rem;
    margin-bottom: 0;
    margin-top: .8em;
    top: $page-banner-height;

    @media ($bp-large-min) {
      max-width: 820px;
    }
  }

  .ma__decorative-link a,
  &__unlinked-title {
    font-weight: $fonts-normal;
  }

  .ma__decorative-link + &__description,
  &__unlinked-title + &__description {
    margin-top: 0;
    font-weight: lighter;
    width: 100%;
  }

  &__content-wrapper &__description {
    position: relative;
    top: 0;
  }

  &--columns &__description {
    font-size: $fonts-large;
    margin-top: 0;
    padding: 25px 0 20px;
    width: 95%;
    transform: skew(0);
    float: left;
    z-index: 1;

    @media ($bp-medium-min) {

      @include span-columns(4 of 12);
      font-size: $fonts-xlarge;
      letter-spacing: $letter-spacing-small;
      line-height: 2.188rem;
      padding-top: 100px;
      padding-right: 20px;
      position: relative;
      top: 0;
    }
  }

  &--columns &__image {
    background-position: 50% 50%;
    background-size: cover;
    height: $page-banner-height;
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;

    @media ($bp-medium-min) {
      height: 460px;
      max-width: 820px;
      right: 40px;
      width: 62.12903%; // @include span(8 of 12) was too big
    }
  }
}

//theme
$page-banner-inner-width: 612px;

.ma__page-banner {

  &__container {

    &:before {
      background-color: rgba($c-primary-alt, 0.8);
    }
  }

  &--blue &__container {

    &:before {
      background-color: rgba($c-primary, 0.8);
    }
  }

  &__content {
    background-image: linear-gradient(-90deg, rgba($c-primary-alt, .7), $c-primary-alt 95%);

    &:before {
      background-color: $c-primary-alt;
    }
  }

  &--blue &__content {
    background-image: linear-gradient(-90deg, rgba($c-primary, .7), $c-primary 95%);

    &:before {
      background-color: $c-primary;
    }
  }

  &--overlay &__content {
    background-image: none;
  }

  &--columns &__content {

    &:after {
      background-color: rgba($c-primary-alt,.7);
    }

    @media ($bp-x-small-min) {

      &:after {
        background-color: transparent;
      }
    }
  }

  &--linked &__container {

    @media ($bp-large-extended) {
      background-color: $c-primary-alt;
    }
  }

  &--linked &__content {
    background-color: $c-primary-alt;
    background-image: none;
  }



  &__icon {

    svg,
    svg > g {
      fill: rgba($c-font-inverse,.5);
    }
  }

  &__title {
    font-weight: $fonts-light;
    color: $c-font-inverse;
  }

  &__description {
    color: $c-font-inverse;
    font-weight: $fonts-normal;

    .ma__page-banner__descriptionSubText {
      display: block;
      font-weight: $fonts-lighter;
    }
  }

  .ma__decorative-link {

    a {
      color: $c-font-inverse;

      &:hover {
        border-bottom-color: rgba($c-font-inverse, 0.5);
      }
    }

    svg {
      fill: rgba($c-font-inverse, 0.5);
    }

  }

  &__unlinked-title {
    color: $c-font-inverse;
  }

  &--columns &__description {
    color: $c-font-base;
    font-weight: $fonts-light;
  }
}
