@property --sg-pane-top-fade {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@media (min-width: 80rem) {
  /* The translated homepage grid moves its sticky descendants with it. */
  .is-home.enable-banner .layout-three-column > #main-grid {
    --sg-column-sticky-top: calc(1rem - var(--banner-height-extend));
  }

  .layout-three-column > #main-grid > :is(#sidebar, #right-sidebar) {
    --sg-column-height: max(0px, calc(100vh - max(1rem, var(--sg-grid-viewport-top, var(--panel-top))) - 1rem));
    position: sticky;
    top: var(--sg-column-sticky-top, 1rem);
    align-self: start;
    min-height: 0;
    height: var(--sg-column-height);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    /* Let the page receive input through the space between and below widgets. */
    pointer-events: none;
    border-radius: var(--radius-large);
    --sg-pane-top-fade: 0px;
    mask-image: linear-gradient(to bottom, rgb(0 0 0 / 24%) 0, #000 var(--sg-pane-top-fade));
  }

  .layout-three-column > #main-grid > :is(#sidebar, #right-sidebar) .card-base {
    pointer-events: auto;
  }

  .layout-three-column > #main-grid > :is(#sidebar, #right-sidebar)[data-sg-scrolled] {
    --sg-pane-top-fade: .875rem;
  }

  @media (prefers-reduced-motion: no-preference) {
    .layout-three-column > #main-grid > :is(#sidebar, #right-sidebar) {
      transition: --sg-pane-top-fade 160ms ease-out;
    }
  }

  .layout-three-column > #main-grid > :is(#sidebar, #right-sidebar),
  .layout-three-column > #main-grid > #right-sidebar #toc-inner-wrapper-right {
    scrollbar-width: none;
  }

  .layout-three-column > #main-grid > :is(#sidebar, #right-sidebar)::-webkit-scrollbar,
  .layout-three-column > #main-grid > #right-sidebar #toc-inner-wrapper-right::-webkit-scrollbar {
    display: none;
  }

  /* Each whole sidebar owns its scrollport, including the profile above the widgets. */
  .layout-three-column > #main-grid > #sidebar #sidebar-sticky,
  .layout-three-column > #main-grid > #right-sidebar #right-sidebar-sticky {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .layout-three-column > #main-grid > #right-sidebar > * {
    flex-shrink: 0;
  }

  /* The theme scrolls this element to follow the highlighted heading in long articles. */
  .layout-three-column > #main-grid > #right-sidebar #toc-inner-wrapper-right {
    max-height: max(6rem, calc(var(--sg-column-height) - 4rem));
  }
}
