The Huang-Rhys factor S(a1g) for transition-metal impurities: a microscopic insight