I would make the dark overlay layer fixed 100wv 100vh opacity:0 display:none
So the first step of your interaction on this object will be 0ms display:block, then opacity:100% in the desired time. The reverse would be opacity:0 in the desired time then another step of 0ms to pass the overlay display:none.
Display:none is useful so it’s not in the way of clicks, for both when you design it and visit it.