Modal with cookie flickers before hiding

Hi,

I am creating a newsletter subscription form pop-up for our company site.
I used Nelson’s tutorial, to set cookies to remember that the user clicked out of the modal for 7 days. It works. However, when I refresh the page, the modal shows for the fraction of a second, and then disappears.
The modal container is set to display none by default (I have also tried setting opacity to 0% in addition to that, but it didn’t work), so I am not sure what’s going on.

Does anybody have any idea, and can point me in the right direction?
Read only link is here
Live website is here


Here is my site Read-Only: [LINK](Webflow - Wild)
(how to share your site Read-Only link)

On your close button interaction the initial state is set and is re-displaying the modal. So it’s hidden, then interactions initialize and it’s made visible, then your cookie code runs and it’s made invisible.