Sex is biology. Gender is literary. There are 2 sexes, male and female. There are three genders, masculine, feminine, and neuter.
There is no such THING as a gender. There are Boys there are Girls, nowhere in science or reality is there a gender.
Gender is a slave word.