> The head of state is the leader of the country. They [..] typically are in control of the military.
This isn't true, at least in Western states. E.g in the Netherlands and Germany the king and the President respectively are head of state, but neither of them controls the military, which is done by respectively the Prime Minister and the Chancellor.
It's really hard to make a universal definition for heads of state and government, since they fulfill different roles in forms of government. However, generally, the head of state is a more ceremonial role while the head of government actually governs. But there are exceptions.