improved nav scrolling logic