Why does the Scottish government keep losing court cases? The failed challenge over the fate of Holyrood's gender reform bill is the latest in a series of legal setbacks. Source