The law’s transgender pronoun provision “restricts more speech than is necessary to achieve the government’s compelling interest in eliminating discrimination, including harassment, on the basis of sex,” a state appellate court ruled.