/* stop parent wrappers from clipping sticky */
html, body { overflow: visible !important; }
.wp-site-blocks,
.wp-block-group,
.wp-block-template-part,
.layout-3col,
.is-layout-constrained,
.is-layout-flow { overflow: visible !important; }

/* grid sane defaults */
.layout-3col { align-items: start !important; }

/* admin bar offset */
body.admin-bar { --adminbar-offset: 32px; }
@media (max-width: 782px) { body.admin-bar { --adminbar-offset: 46px; } }

/* sticky rails */
.sidebar-left,
.sidebar-right {
  position: sticky !important;
  top: calc(var(--adminbar-offset, 0px) + env(safe-area-inset-top, 0px)) !important;
  align-self: start !important;
  height: auto !important;
  max-height: calc(100dvh - var(--adminbar-offset, 0px) - env(safe-area-inset-top, 0px)) !important;
  overflow: auto !important;
  padding: 12px 8px;
  scrollbar-gutter: stable both-edges;
}

/* responsive */
@media (max-width: 1200px) {
  .layout-3col { grid-template-columns: 72px 1fr 280px !important; }
}
@media (max-width: 992px) {
  .layout-3col { grid-template-columns: 1fr 320px !important; }
  .sidebar-right { display: none !important; }
}
@media (max-width: 720px) {
  .layout-3col { grid-template-columns: 1fr !important; padding: 0 !important; }
  .sidebar-left, .sidebar-right { display: none !important; }
}