Spin-lattice couplings in 3⁢d ferromagnets: Analysis from first principles