Theory of pion photoproduction in 12C