$bp-illustrated-header-image-width: 360px;

@use "00-base/configure" as *;

.ma__illustrated-header {
  margin-bottom: 40px;
  position: relative;

  @media ($bp-large-extended-min) {
    margin: 60px 0;
  }

  .ma__page-header__title {
    margin-bottom: 1.625rem;
  }

  .ma__page-header--has-optional-content .ma__page-header__title:last-child {
    margin-bottom: 1.625rem;
  }

  &__image {
    background-position: center;
    background-size: cover;

    @media ($bp-large-extended-min) {
      background-position: center left;
      height: 100%;
      position: absolute;
      top: 0;
      right: 0;
      width: $bp-illustrated-header-image-width + 40px; // 40px is right padding of the page
    }

    @media ($bp-large-extended-max) {
      min-height: 300px;
    }

    @media ($bp-page-width-min) {
      width: calc(50vw - 220px);
    }
  }

  &__container {

    @include ma-container;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  &__content {
    padding: 35px 0;
    position: relative;
    z-index: 2;

    @media ($bp-large-extended-min) {
      float: none;
      width: calc(100% - #{$bp-illustrated-header-image-width}); // width of right rail

      &:after {
        content: "";
        height: 200%;
        position: absolute;
        bottom: 0;
        right: 0;
        transform: rotate(30deg);
        transform-origin: bottom right;
        width: 200%;
        z-index: -1;
      }
    }

    @media ($bp-page-width-min) {
      width: 840px;
    }

  }

  &__category {
    font-size: $fonts-large;
    font-weight: $fonts-bold;
    color: var(--mf-c-font-detail);
    letter-spacing: $letter-spacing-large;
    text-transform: uppercase;
  }

  .ma__page-header,
  .ma__page-header-addons {
    padding: 0;

    &__content {
      padding: 0;
      width: 100%;
    }

    .page-content {
      padding: 0;
      width: 100%;
    }
  }

  &--no-image {

    .ma__illustrated-header__image {
      display: none;
    }

    .ma__illustrated-header__content {

      @media ($bp-page-width-min) {
        width: 935px;
      }

      &:after {
        content: none;
      }
    }

    &.ma__illustrated-header {
      margin-top: 0;

      @media ($bp-large-extended-min) {
        margin-bottom: 0;
      }
    }
  }
}

.ma__illustrated-header--inverted {

  .ma__illustrated-header__content::after {
    content: none;
  }

  .ma__page-header,
  .ma__page-header-addons {
    width: 100%;
  }

  .ma__illustrated-header__content {
    display: flex;
      flex-direction: column;
      justify-content: center;
  }
}

.ma__illustrated-header--centered {

  .ma__illustrated-header__image {

    @media ($bp-large-extended-min) {
      background-position: center;
    }
  }
}

//theme

.ma__illustrated-header {

  &__image--empty {
    background-color: var(--mf-c-primary-alt);
  }

  &__content {
    background-color: var(--mf-c-bg);

    &:after {
      background-color: var(--mf-c-bg);
    }
  }

  &__category {
    font-weight: $fonts-bold;
  }
}

.ma__illustrated-header--inverted {

  &,
  .ma__page-header__title,
  .ma__illustrated-header__category {
    color: var(--mf-c-font-inverse);
  }

  &,
  .ma__illustrated-header__content,
  .ma__illustrated-header__image--empty {
    background: var(--mf-c-primary);
  }
}
