A judge has temporarily blocked a Montana law that restricts transgender people’s use of bathrooms in public buildings.