/**
 * Липкое меню #sidebar — после dop.css:
 * <link href="/static/css/sidebar-sticky.css?v=5" rel="stylesheet">
 * <script src="/static/js/sidebar-sticky.js?v=5"></script>
 */

.page__sidebar.egs-sidebar-host {
  align-self: stretch;
  position: relative;
  /*
   * Не режем по X: .sidebar-bg-offset { margin-left: -30px } —
   * форма «Заказать звонок» выходит влево за колонку.
   * По Y clip — absolute-меню не растягивает страницу ниже футера.
   */
  overflow-x: visible;
  overflow-y: clip;
  /* иначе overflow + flex-shrink сжимает колонку до 0px */
  flex-shrink: 0;
  width: 307px;
  min-width: 307px;
  box-sizing: border-box;
}

/* in-flow спейсер: держит ширину, пока #sidebar в fixed/absolute */
.egs-sidebar-spacer {
  display: block;
  width: 100%;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

#sidebar.egs-sidebar--sticky {
  z-index: 4;
  transform: none !important;
  will-change: top, bottom, position;
  box-sizing: border-box;
  max-width: 100%;
}

@media (max-width: 1100px) {
  #sidebar.egs-sidebar--sticky {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: auto !important;
  }

  .page__sidebar.egs-sidebar-host {
    overflow: visible;
    width: auto;
    min-width: 0;
    flex-shrink: 1;
  }

  .egs-sidebar-spacer {
    display: none;
  }
}
