On the interplay of photons and charge carriers in thin-film solar cells