Spectral characteristics of zero-phonon transitions in crystal impurities: A diagrammatic approach