Div auto resets to block and not Flex

I am using a simple bit of javascript [see below] to open/close a modal form. The modal wrapper is set to Flex to center form on the page. When I set the modal wrapper to display none and publish the site for testing, it is putting the modal wrapper back to block and not Flex…thus the form is in top left and not centered. Thoughts? suggestions?

Here is my read-only link:

Here is the javascript I’m using: