Diffuse gas properties and stellar metallicities in cosmological simulations of disc galaxy formation