Coevolution of parental investment and sexually selected traits drives sex-role divergence