Evolution of sex differences in trait- and age-specific vulnerability