/* Compute effective top offset: header + (optional) banner */
:root {
  --header-offset: calc(var(--md-header-height, 3.2rem) + var(--md-banner-height, 0px));
}

/* Desktop and up (Material’s breakpoint ~1220px) */
@media (min-width: 76.25em) {
  /* Left (primary) sidebar */
  .md-sidebar--primary {
    position: sticky;
    top: var(--header-offset);
    height: calc(100vh - var(--header-offset));
  }
  .md-sidebar--primary .md-sidebar__scrollwrap {
    max-height: 100%;
    overflow: auto;
  }

  /* If you later disable toc.integrate and want a right sticky ToC too, keep this */
  .md-sidebar--secondary {
    position: sticky;
    top: var(--header-offset);
    height: calc(100vh - var(--header-offset));
  }
  .md-sidebar--secondary .md-sidebar__scrollwrap {
    max-height: 100%;
    overflow: auto;
  }

  /* Make in-page anchor jumps land below sticky header+banner */
  .md-typeset [id] {
    scroll-margin-top: var(--header-offset);
  }
}

/* Print: don’t stick sidebars */
@media print {
  .md-sidebar--primary,
  .md-sidebar--secondary {
    position: static !important;
    height: auto !important;
  }
}
