.region-sticky {
  position: sticky;
  top: var(--gin-toolbar-y-offset);
  z-index: 101;
  padding: 0;
  width: 100%;
  background: var(--gin-bg-app);
  box-sizing: border-box;
  transition: var(--gin-transition);

  .gin--edit-form & {
    top: calc(var(--gin-toolbar-y-offset) - var(--gin-spacing-xxxl));
    padding-top: var(--gin-spacing-m);

    @include mq(large) {
      padding-top: var(--gin-spacing-s);
    }
  }

  @include mq(large) {
    top: -1px;
    width: 100%;
    height: var(--gin-height-sticky);
    padding: var(--gin-spacing-s) 0;

    &-watcher {
      position: sticky;
      top: -1px;
      height: 0;
    }

    &--is-sticky {
      opacity: .95;
      background: var(--gin-bg-app);

      @supports (backdrop-filter: blur()) {
        opacity: .999;
        background: rgba(var(--gin-bg-app-rgb), .8);
        backdrop-filter: blur(12px);
      }

      .gin--high-contrast-mode & {
        background: var(--gin-bg-app);
        backdrop-filter: none;
      }
    }

    .gin--vertical-toolbar &,
    .gin--horizontal-toolbar &,
    .gin--classic-toolbar & {
      top: var(--gin-toolbar-y-offset);
    }

    .gin--classic-toolbar:not(.gin--edit-form) & {
      position: static;
    }
  }

  &__items {
    display: flex;
    align-items: center;
    margin-bottom: var(--gin-spacing-m);

    @include mq(small) {
      height: 100%;

      .settings-tray-editable {
        flex-shrink: 0;
      }
    }

    &__inner {
      display: flex;
      flex-wrap: wrap;
      width: 100%;

      @include mq(large) {
        flex-wrap: nowrap;
        align-items: center;
        margin-bottom: 0;

        .block-page-title-block {
          margin: 0;
        }
      }
    }

    .block-page-title-block {
      flex-grow: 1;
      align-self: center;
      display: flex;
      margin: 0;
      min-width: 0;

      .page-title {
        align-self: center;
        margin: 0;
      }
    }

    .gin-sticky {
      display: flex;

      @include mq(large) {
        padding-left: var(--gin-spacing-l);
      }
    }
  }
}

.content-header {
  padding-top: 0;
  margin-bottom: 0;
  background-color: transparent;
  overflow: initial;
}

.sticky-shadow {
  @include mq(large) {
    z-index: 98;
    position: relative;
    pointer-events: none;
    height: 40px;
    margin: calc(var(--gin-spacing-xxxl) * -1) auto var(--gin-spacing-l);
    box-shadow: 0 10px 20px -16px rgba(0, 0, 0, .4);

    .gin--dark-mode & {
      box-shadow: none;
    }
  }

  @include mq(large) {
    position: sticky;
    top: calc(var(--gin-toolbar-y-offset) + var(--gin-spacing-xl));
    width: calc(100% - min(10vw, 96px) + var(--gin-spacing-l));

    // Classic, legacy toolbar
    .gin--classic-toolbar:not(.gin--edit-form) & {
      display: none;
    }

    .gin--edit-form & {
      max-width: 1300px;
    }
  }
}

.page-wrapper {
  @include mq(large) {
    margin-top: 1px; // fix for top: auto;
  }
}

.toolbar-tray-open:not(.toolbar-vertical) .layout-container,
body:not(.toolbar-tray-open) .layout-container {
  margin-left: var(--gin-spacing-m);
  margin-right: var(--gin-spacing-m);

  @include mq(small) {
    margin-left: var(--gin-spacing-xl);
    margin-right: var(--gin-spacing-xl);
  }

  @include mq(medium) {
    margin-left: m#{i}n(5vw, var(--gin-spacing-xxl));
    margin-right: m#{i}n(5vw, var(--gin-spacing-xxl));

    .layout-container {
      margin-left: 0;
      margin-right: 0;
    }
  }
}

// Hide action bar
.layout-node-form__actions {
  display: none;
}

.gin-sticky {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  width: 100%;

  @include mq(large) {
    flex-wrap: nowrap;
    width: max-content;
  }

  .form-actions {
    margin: 0;
    flex-grow: 1;
    align-items: center;
    justify-content: flex-end;

    :last-child {
      margin-right: 0;
    }
  }

  .field--name-status {
    display: flex;
    align-items: center;
    margin-right: var(--gin-spacing-l);

    .form-type--checkbox {
      margin-top: var(--gin-spacing-xs);
      margin-bottom: var(--gin-spacing-xs);
    }
  }
}
