/* Nation Builders Digital School v529
 * Native bidirectional vertical scrolling for trackpads, mouse wheels,
 * touchscreens and installed-PWA windows.
 *
 * The document scrolls on ordinary pages. Role dashboards keep their fixed
 * shell, while the visible main pane becomes the native vertical scroller.
 */
:root{
  --nbds-native-vh:100vh;
  --nbds-safe-bottom:env(safe-area-inset-bottom,0px);
}
@supports(height:100dvh){:root{--nbds-native-vh:100dvh}}

/* Ordinary pages: keep the browser/document as the scroll owner. */
html.nbds-scroll-document-v529{
  width:100%!important;
  min-height:100%!important;
  height:auto!important;
  max-height:none!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior-x:none!important;
  overscroll-behavior-y:auto!important;
  -webkit-text-size-adjust:100%;
  touch-action:pan-y pinch-zoom!important;
  scroll-behavior:auto!important;
}
body.nbds-scroll-document-v529{
  width:100%!important;
  min-height:100%!important;
  height:auto!important;
  max-height:none!important;
  overflow-x:hidden!important;
  overscroll-behavior-y:auto!important;
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-y pinch-zoom!important;
  scroll-behavior:auto!important;
}
body.nbds-scroll-document-v529:not(.nbds-home-welcome-open):not(.nbds-install-modal-open):not(.nbds-video-css-fullscreen-open):not(.nbds-upload-video-fullscreen-open):not(.nbds-review-modal-open):not(.nbds-native-menu-open-v498):not(.nbds-unified-menu-open-v516):not(.nbds-unified-menu-open-v518):not(.modal-open):not(.no-scroll):not(.scroll-lock):not(.scroll-locked){
  overflow-y:auto!important;
}

/* Dashboard/application shells: the page itself stays fixed and the visible
   main content pane owns native vertical scrolling. */
html.nbds-scroll-shell-v529,
body.nbds-scroll-shell-v529{
  width:100%!important;
  height:100%!important;
  min-height:100%!important;
  max-height:100%!important;
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
body.nbds-scroll-shell-v529{position:relative!important;touch-action:auto!important}

.nbds-v529-scroll-shell{
  width:100%!important;
  height:var(--nbds-native-vh)!important;
  min-height:0!important;
  max-height:var(--nbds-native-vh)!important;
  overflow:hidden!important;
}
.nbds-v529-primary-scroll{
  min-width:0!important;
  min-height:0!important;
  height:100%!important;
  max-height:100%!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior-x:none!important;
  overscroll-behavior-y:auto!important;
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-y pinch-zoom!important;
  scroll-behavior:auto!important;
  scrollbar-gutter:stable;
  padding-bottom:max(var(--nbds-safe-bottom),0px);
}
.nbds-v529-drawer-scroll{
  min-height:0!important;
  max-height:100%!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior-y:contain!important;
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-y pinch-zoom!important;
}

/* Let a vertical gesture begin on normal content, cards, headings, images and
   whitespace. This is the important touchscreen/trackpad recovery layer. */
html.nbds-scroll-document-v529 body :where(main,section,article,header,footer,nav,aside,.math-shell,.shell,.container,.content,.page-content),
body.nbds-scroll-shell-v529 .nbds-v529-primary-scroll :where(main,section,article,header,footer,nav,aside,.container,.content,.page-content){
  touch-action:pan-y pinch-zoom!important;
  overscroll-behavior-y:auto;
}

/* Horizontal strips and tables must not trap a two-finger vertical gesture at
   their upper/lower boundary. Horizontal movement remains available. */
html.nbds-scroll-document-v529 body :where(.table-wrap,.studio-nav,.progression,.level-roadmap,.roadmap,.tabs,.tab-list,.nav-tabs,[data-horizontal-scroll]),
body.nbds-scroll-shell-v529 .nbds-v529-primary-scroll :where(.table-wrap,.studio-nav,.progression,.level-roadmap,.roadmap,.tabs,.tab-list,.nav-tabs,[data-horizontal-scroll]){
  overscroll-behavior-y:auto!important;
  touch-action:pan-x pan-y pinch-zoom!important;
}

/* Interactive surfaces keep their own gestures. */
iframe,
video,
canvas,
svg,
[contenteditable="true"],
input[type="range"],
.nbds-simulation-stage,
.nbds-video-css-fullscreen,
[data-nbds-gesture-surface]{
  touch-action:auto!important;
}
textarea,select,input,button,a{-webkit-tap-highlight-color:transparent}

/* Intentional overlays remain independently scrollable and may lock the
   background while open. */
dialog[open],
[aria-modal="true"],
.nbds-welcome-dialog,
.nbds-install-dialog,
.nbds-live-chat-panel,
.nbds-dashboard-drawer-panel{
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}

/* The Mathematics Tools catalogue is always a document-scrolling page. */
html:has(body.nbds-document-scroll-page-v529),
body.nbds-document-scroll-page-v529{
  min-height:100%!important;
  height:auto!important;
  max-height:none!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior-y:auto!important;
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-y pinch-zoom!important;
}
body.nbds-document-scroll-page-v529 :where(main,section,article,header,footer,.math-shell,.hero,.topic-panel,.recommend,.tool-grid,.tool-card,.privacy){
  touch-action:pan-y pinch-zoom!important;
  overscroll-behavior-y:auto!important;
}

@media(max-width:1024px),(pointer:coarse){
  .nbds-v529-primary-scroll,.nbds-v529-drawer-scroll,body.nbds-scroll-document-v529{scrollbar-width:thin}
}
@media(display-mode:standalone){
  .nbds-v529-primary-scroll,body.nbds-scroll-document-v529{padding-bottom:max(var(--nbds-safe-bottom),0px)}
}
