My thinking is that on requesting the site from the server it might be executing the php before deciding on the viewport size. By just experimenting with only a single mobile size variant does the menu display as expected on a mobile.You never said whether it's uploaded as .php or .html with php placeholders.