/*
 * MachAxis Edition v1.03.0-alpha.11 — sticky sidebar as a single group.
 * The navigation remains sticky independently; sidebar cards never detach
 * into individually sticky widgets.  A tall sidebar can be scrolled within
 * its own viewport, rather than shifting its first widget out of view before
 * the last widget finally catches the sticky boundary.
 * Scoped to the existing sidebar-sticky option and desktop two-column layout.
 */
@media screen and (min-width: 961px) {
  body.machaxis-edition-sticky-sidebar #secondary {
    align-self: stretch !important;
    overflow: visible !important;
  }

  body.machaxis-edition-sticky-sidebar #secondary .machaxis-edition-sidebar-inner {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: var(--mxedition-sidebar-pin-top, 154px) !important;
    height: auto !important;
    max-height: calc(100vh - var(--mxedition-sidebar-pin-top, 154px) - 12px);
    max-height: calc(100dvh - var(--mxedition-sidebar-pin-top, 154px) - 12px);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(105, 110, 128, 0.35) transparent;
    -webkit-overflow-scrolling: touch;
  }

  /* Never pin the final widget independently of the sidebar group. */
  body.machaxis-edition-sticky-sidebar #secondary .machaxis-edition-sidebar-inner > .widget {
    position: static !important;
  }

  /* On unusually short desktop viewports, use regular page flow rather than
     hiding most of a sidebar behind a forced minimum-size scroll region. */
  html.mxedition-sidebar-no-sticky body.machaxis-edition-sticky-sidebar #secondary .machaxis-edition-sidebar-inner {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* WordPress switches Edition from columns to a stacked layout at 960px. */
@media screen and (max-width: 960px) {
  body.machaxis-edition-sticky-sidebar #secondary .machaxis-edition-sidebar-inner {
    position: static !important;
    top: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

@media print {
  body.machaxis-edition-sticky-sidebar #secondary .machaxis-edition-sidebar-inner {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
  }
}
