@use "src/styles/framework" as *;
@use "src/styles/positioning";

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

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

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

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

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

  &__column-left {
    position: sticky;
    top: 20px;
    bottom: 20px;
    z-index: 1001;

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

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

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

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

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

    @include print {
      width: 100% !important;
      margin-top: 20px !important;
    }

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

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

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

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

  &__header-left {
    margin-top: auto;

    @include smTablet {
      order: 2;
    }
  }

  &__title {
    width: calc(100% - 120px);
  }

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

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

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

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

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

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

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

  &__feedback-button {
    margin-top: auto;
    flex-shrink: 0;

    @include smTablet {
      margin-bottom: $space-m;
    }

    @include print {
      display: none;
    }
  }

  &__scroll-overlay {
    @include mobile {
      display: none;
    }

    position: fixed;
    z-index: positioning.$sticky-elements-z-index - 1;
    top: 0;
    left: 0;

    width: calc(100% - 20px); // set width less than viewport to prevent scroll clipping on windows
    height: positioning.$sticky-threshold + 5px; // increase height to prevent content revealing when sticky element corners rounded

    background-color: $blue-dark !important;
    background-image: url('~src/assets/img/background.jpg');
    background-repeat: no-repeat;
    background-size: 100vw;
  }

  &__sticky-content {
    @include gt-mobile {
      position: sticky;
      z-index: positioning.$sticky-elements-z-index;
      top: positioning.$sticky-threshold;
    }
  }
}
