Outside controlled airspace VFR flight shall always adhere to VFR restrictions i class G (or F) airspace, e.g. clear of clouds, flying visibility etc.
ie, below 140kts, clear of cloud in sight of the surface, perfectly possible in 350m shallow fog.
Ironically, the potentially illegal bit would be once you pop out, but are still below 1000', in infinite vis.