“By discriminating against homosexuals, the employer intentionally penalizes men for being attracted to men and women for being attracted to women"
Basically, if a particular gay man wasn't a man then he wouldn't have been penalized, so it follows that the discrimination is tied to his sex.