Long-term orbital and spin dynamics of Mars