Hi,
You will have to set some padding-top to the sidenav to stop it being hidden by the top fixed navigation. You can use the border-box model and soak up the padding so that you don’t exceed 100% of the viewport height.
Fixed positioned items are notoriously difficult to accommodate and should be used very sparingly. Trying to account for the flow is almost impossible for disparate elements like these and the best you can do is some magic number padding (or resort to much more complicated approaches using script or duplicate content).
I would not have duplicated the navigation either as that means maintaining two sets of links when you could have done it with one set and then just positioned them where you wanted for the smaller screen.
Anyway here’s a few pointers for the way you have it now.
I would set the overlay like this:
.overlay {
box-sizing:border-box;
padding-top: 6rem;
width: 0;
top:0;
bottom:0;
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
background-color: rgb(0,0,0); /* Black fallback color */
background: linear-gradient(top, rgba(232,232,232,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
overflow-x: hidden; /* Disable horizontal scroll */
transition: 0.5s; /* 0.5 second transition effect to slide in or slide down the overlay (height or width, depending on reveal) */
}
.overlayopen {
width: 100%;
}
I set the open overlay to 100% width because 90% looks very awkward and loses you the screen space when you most need it on smaller devices. (As these (header and sidenav) are fixed positioned elements I would suggest that instead of z-index 1 and 2 you make them a lot higher as they will need to sit on top of everything else e.g. z-index:1000 and z-index:999.)
You need to stop the vertical scrollbar showing when you animate the nav sideways which can be done by using white-space:nowrap on the items.
.overlay a {
white-space:nowrap;
}
I would set a consistent width for the icons to align them better.
e.g.
#myNav.overlay a svg {
width:2rem
}
Lastly you need to hide the sidenav when the page is opened wider and the subnav is showing. (i.e. you have reduced the viewport widh and the toggle is showing so you click the hamburger to show the sidenav but when you open the screen wider the subnav still shows along with the tonav).
@media screen and (min-width:767px){
.overlayopen{display:none;}
}