/* RC15 — keep the article sidebar as one coherent sticky rail.
   The old design made only the TOC card sticky, so the cards below could scroll
   underneath it. Sticky positioning now belongs to the sidebar wrapper instead. */
@media (min-width: 901px) {
  .content-grid > .sidebar {
    position: sticky;
    top: 30px;
    align-self: start;
    z-index: 1;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    overflow-x: visible;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #b8cfc5 transparent;
    padding-right: 3px;
  }
  body.admin-bar .content-grid > .sidebar {
    top: 62px;
    max-height: calc(100vh - 92px);
  }
  .content-grid > .sidebar .toc {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
  }
  .content-grid > .sidebar > .side-card {
    position: relative;
    z-index: 0;
  }
}

/* Once the article layout becomes a single column, all sidebar cards return to
   ordinary document flow. */
@media (max-width: 900px) {
  .content-grid > .sidebar {
    position: static;
    top: auto;
    z-index: auto;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (min-width: 901px) {
  .content-grid > .sidebar::-webkit-scrollbar { width: 7px; }
  .content-grid > .sidebar::-webkit-scrollbar-thumb { background: #b8cfc5; border-radius: 999px; }
  .content-grid > .sidebar::-webkit-scrollbar-track { background: transparent; }
}
