/* 0.2.8: desktop mega drawer stays within the available viewport while its content remains reachable. */
@media (min-width: 981px) {
  body .tvs-catalog-navigation .tvs-cg-panel--mega {
    --tvs-cg-drawer-bottom-gap: 16px;
    box-sizing: border-box;
    max-height: calc(100dvh - var(--tvs-cg-drawer-top, 0px) - var(--tvs-cg-drawer-bottom-gap));
    overflow: hidden;
  }

  body .tvs-catalog-navigation .tvs-cg-panel--mega .tvs-cg-panel__inner {
    display: flex;
    max-height: calc(100dvh - var(--tvs-cg-drawer-top, 0px) - var(--tvs-cg-drawer-bottom-gap));
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }

  body .tvs-catalog-navigation .tvs-cg-panel--mega .tvs-cg-mega__header {
    flex: 0 0 auto;
  }

  body .tvs-catalog-navigation .tvs-cg-panel--mega .tvs-cg-mega__content {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }
}

/* Keep the existing narrow-desktop action column as one readable stack. */
@media (min-width: 981px) and (max-width: 1120px) {
  body .tvs-catalog-navigation .tvs-cg-panel--mega .tvs-cg-mega__actions {
    display: block;
  }
}
