@use "../../styles/variables" as vars;
@use "../../styles/colors" as colors;
@use "../../styles/screen" as screen;

.page-layout {
  &__row {
    position: relative;

    display: flex;
    flex-flow: row nowrap;
    align-items: flex-start;

    margin: 0 auto;
    width: 100%;
    max-width: vars.$site-width;

    @include screen.print {
      width: 100% !important;
      padding: 0 !important;
      margin: 0 !important;
      max-width: 100% !important;
    }

    @include screen.smTablet {
      flex-flow: column wrap;
    }
  }

  &__column-left {
    position: sticky;
    top: vars.$space-xl;
    bottom: vars.$space-xl;
    z-index: 1001;

    flex-shrink: 0;
    margin-left: 0;
    margin-right: 1.5%;
    width: vars.$left-aside-width;

    @media (max-width: vars.$media-breakpoint-desktop) {
      width: vars.$left-aside-width-desktop;
    }

    @media (max-width: vars.$media-breakpoint-tablet) {
      position: relative;
      top: 0;

      width: 100%;
      margin-right: 0;
    }
  }

  &__column-right {
    position: relative;
    width: calc(100% - #{vars.$left-aside-width} - #{vars.$column-spacing});

    @include screen.print {
      width: 100% !important;
      margin-top: vars.$space-xl !important;
    }

    @media (max-width: vars.$media-breakpoint-desktop) {
      width: calc(100% - #{vars.$left-aside-width-desktop} - 1.5%);
    }

    @media (max-width: vars.$media-breakpoint-tablet) {
      width: 100%;
    }
  }

  &__header-right {
    margin-top: auto;
    display: flex;
    justify-content: space-between;

    @include screen.smTablet {
      flex-direction: column;
      order: 1;
    }
  }

  &__header-left {
    margin-top: auto;

    @include screen.smTablet {
      order: 2;
    }
  }

  &__title {
    width: calc(100% - 120px);
    // Stack the breadcrumbs pill above the <h1> — Angular renders them
    // in separate rows (page-layout.component.html:7-8). Without this,
    // the inline-flex pill + block heading end up side-by-side because
    // the parent is a plain block div.
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  &__title--fullwidth {
    width: 100%;
  }

  &__header {
    position: relative;
    z-index: 1001;

    padding-top: vars.$space-top-site;
    margin-bottom: vars.$space-xl;

    @include screen.mobile {
      margin-bottom: vars.$space-m;
    }
  }

  &__content &__column-left {
    @include screen.smTablet {
      margin-bottom: vars.$space-xl;
    }

    @include screen.mobile {
      margin-bottom: vars.$space-m;
    }
  }

  &__content &__column-left:empty {
    @include screen.smTablet {
      margin-bottom: 0;
    }
  }

  &__sticky-content {
    @include screen.gt-mobile {
      position: sticky;
      z-index: 1000;
      top: vars.$space-xl;
    }
  }

  // Angular paints a fixed strip across the top 25px of the viewport so
  // flight rows scrolling past the sticky date strip don't peek through
  // the 20px gap. Matches the .page-layout__scroll-overlay rule.
  &__scroll-overlay {
    @include screen.gt-mobile {
      position: fixed;
      z-index: 999;
      top: 0;
      left: 0;
      width: calc(100% - #{vars.$space-xl});
      height: 25px;
      background-color: colors.$blue-dark;
      background-image: url("/assets/img/background.jpg");
      background-repeat: no-repeat;
      background-size: 100vw;
      pointer-events: none;
    }
  }
}
