We demonstrate that the observed increase of some nebular line ratios with height above the midplane in the diffuse ionized gas (DIG) in the Milky Way and other galaxies is a natural consequence of the progressive hardening of the radiation field far from the midplane ionizing sources. To obtain increasing temperatures and line ratios away from the midplane, our photoionization simulations of a multicomponent interstellar medium do not require as much additional heating (over and above that from photoionization) as previous studies that employed one-dimensional, spherically averaged models.Radiation leaking into the DIG from density bounded HII regions is generally harder in the H-ionizing continuum and has its He-ionizing photons suppressed compared to the ionizing source of the HII region. In line with other recent investigations, we find that such leaky HII region models can provide elevated temperatures and line ratios, and a lower He+ fraction in the DIG. For a composite model representing the relative spectral types of O stars in the solar neighbourhood, we find that the natural hardening of the radiation field reaching large heights in our simulations can explain most of the observed line ratios. However, additional heating is required to reproduce the largest line ratios in the DIG.