Fundamental mechanisms of titanium nitride formation by d.c. magnetron sputtering