Smooth scroll offset adjusted to the viewport

How to adjust the offset from the smooth scroll to the view port ?

I have a fixed navbar on the page. On a wide screen bootstrap puts the navbar links in line (60px) but on a mobile screen he puts the links in column (180px). So I need to adjust the offset from the smoot scroll likewise.
Is it possible to adjust the offset for xs, sm, md, lg , xl ?

Try adding a padding/margin to the sections for mobile breakpoints. And reduce/remove them for the tablet or higher breakpoints.

This is not a solution because this method does not take into account the navigation whether or not colapsed.

I am suggesting to adjust the CSS and not make any changes in the scroll method.
I know scroll method does not know about navigation state, but CSS does.
So, use CSS to add padding/margin which will compensate for the offset.