@use '../../00-settings/settings' as *;
@use '../../00-mixins/mixins' as *;

/* stylelint-disable no-descending-specificity */
.content-header-container {
  @include theme('background-color', 'color-primary', 'content-header-container-background-primary');

  display: flex;
  position: relative;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 60px;
  padding: 60px 20px;

  @include tablet {
    margin-bottom: 45px;
    padding: 90px 20px;
  }

  h1 {
    max-width: none;
  }

  &.image {
    margin-bottom: calc(100vw - 85px);
    padding-bottom: 120px;

    @include tablet {
      flex-direction: row;
      margin-bottom: 80px;
      padding-top: 80px;
      padding-bottom: 80px;
    }

    @include desktop {
      margin-bottom: 145px;
    }

    &:not(.overlap) {
      margin-bottom: calc(100vw - 85px);

      @include tablet {
        margin-bottom: 190px;
      }
    }
  }

  &.overlap {
    padding-top: 60px;
    padding-bottom: 120px;

    @include tablet {
      flex-direction: row;
      padding-top: 80px;
      padding-bottom: 105px;
    }

    &.image {
      @include tablet {
        margin-bottom: 165px;
        padding-bottom: 90px;
      }
    }
  }

  &.secondary {
    @include theme('background-color', 'color-secondary', 'content-header-container-background-secondary');
  }

  &.accolade-title {
    @include theme('background-color', 'color-tertiary-light', 'content-header-accolade-container-background');

    h1 {
      @include accolade('bottom', 'left', 100px, 36px, 'color-none', 'color-primary');
      @include theme('background-color', 'color-primary', 'content-header-accolade-text-background');

      display: inline;
      padding: 5px 15px;
      color: coloring('white');
      line-height: 130%;
      box-decoration-break: clone;
    }

    &.breakout {
      padding-bottom: 45px;

      @include tablet {
        padding-bottom: 55px;
      }

      .left {
        position: absolute;
        bottom: 3px;
      }

      h1 {
        bottom: 0;
      }
    }
  }

  &:not(.image) {
    .left {
      padding-right: 0;
    }
  }

  .left {
    flex-basis: auto;
    max-width: $bp-max-content;

    @include tablet {
      padding-right: 60px;
    }

    h1 {
      margin: 0;
    }

    h4 {
      margin: 60px 0 20px;
    }

    .summary-text {
      margin: 30px 0 0;

      p {
        @include large-text;

        line-height: 177.778%;
      }

      p:last-of-type {
        margin-bottom: 0;
      }
    }

    time + .summary-text {
      margin: 10px 0 0;
    }

    .tag-list-wrapper {
      margin: 20px 0 0;

      li,
      a {
        width: 100%;

        @include phablet {
          width: auto;
        }
      }
    }
  }

  .right {
    flex: auto;
    align-self: flex-end;
    width: 100%;
    height: auto;

    @include tablet {
      flex: 0 0 calc(47vw - 180px);
      width: auto;
      height: calc(47vw - 80px - 290px);
      text-align: right;
    }

    @media only screen and (width >= 1400px) {
      flex: 0 0 470px;
      height: calc(470px - 190px);
    }

    figure {
      display: block;
      position: absolute;
      bottom: 0;
      width: 100%;
      padding-right: 40px;
      transform: translate(0, calc(100% - 90px));

      @include tablet {
        position: static;
        max-width: 31.5rem;
        padding: 0;
        transform: none;
      }

      img {
        width: 100%;
        height: auto;
      }
    }
  }
}
