Legislation outlaws medical interventions ‘aimed at changing the sex of a person’ and altering gender details in public records