/*
 * Independent column scroll for Valentus 2.x on the DevCentr docs hub.
 *
 * Root cause (still after 11d35d6): site-doc-layout
 *   (1) align-self:stretch + height:auto on .nav so the rail grows with the article
 *   (2) overflow-y:visible on .nav-panel-menu and overflow-y:auto on nav.nav-menu
 *       so the tree (not the SoftNav scroll key) is the scrollport — or neither is
 *   (3) overscroll-behavior:auto !important chains wheel to the page
 * A fixed height of (100vh - navbar) on a column that starts *below* the tool band
 * also hangs past the fold, so page scroll was required to reach the tree bottom.
 *
 * Fix: sticky + max-height = remaining viewport under sticky top; panel
 * [data-panel=menu] is the only vertical scrollport (SoftNav scroll-y key);
 * contain overscroll; tree grows with content (horizontal edge-fade only).
 */
:root {
  --adt-nav-sticky-top: var(--navbar-height, 3.5rem);
  --adt-nav-sticky-max: calc(100vh - var(--adt-nav-sticky-top));
}

@supports (height: 100dvh) {
  :root {
    --adt-nav-sticky-max: calc(100dvh - var(--adt-nav-sticky-top));
  }
}

@media screen and (min-width: 1024px) {
  .body.adt-body {
    align-items: flex-start !important;
  }

  .body.adt-body > .nav-container,
  .nav-container {
    align-self: flex-start !important;
    position: sticky !important;
    top: var(--adt-nav-sticky-top) !important;
    max-height: var(--adt-nav-sticky-max) !important;
    height: var(--adt-nav-sticky-max) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .nav-container .nav,
  .nav {
    position: static !important;
    top: auto !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
  }

  .nav .panels {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
  }

  /*
   * Vertical scrollport = [data-panel=menu] (JS restore key).
   * Defeat Valentus overflow-y:visible + overscroll chaining.
   */
  body.adt-body .nav .nav-panel-menu,
  .nav-container .nav-panel-menu,
  .nav-panel-menu {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -ms-scroll-chaining: none !important;
  }

  body.adt-body .nav nav.nav-menu.nav-tree-only,
  body.adt-body .nav nav.nav-menu.adt-nav-tree-only,
  .nav-container nav.nav-menu.nav-tree-only,
  .nav-container nav.nav-menu.adt-nav-tree-only,
  nav.nav-menu.nav-tree-only,
  nav.nav-menu.adt-nav-tree-only {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }
}

/* SoftNav seamlessness: do NOT blank the tree with visibility:hidden.
 * Prior data-snt-nav-ready hide caused a flash on every soft navigation
 * (worse than DeepWiki). site-nav-tree 0.5.3 + SoftNav 0.2.0 patch currents
 * in place instead.
 */
