I didn't read the full majority opinion but Gorsuch actually made a really good argument in the majority opinion of the LGBT workplace protections ruling.
The text of the law indeed doesn't refer to sexuality at all, nor did it intend to. To bridge that gap, Gorsuch provided a great example.
I don't recall the exact details but it basically goes like this:
Employee A is a good employee who is married to a man. If the employer is intent on discriminating based on sexuality, then what changes the scenario in this example is whether Employee A is a man or a woman. Thus sex is the defining factor in this hypothetical, because there would be no issue to the employer if Employee A, married to a man, was a woman.
It's a fantastic and simple argument that bypasses the counter-argument that the letter of law strictly refers to sex-based discrimination.
Very smart thinking from Gorsuch.