Two years of conflict have shattered Gaza, killed tens of thousands, and eliminated much of Hamas’s leadership. Yet the organisation survives, adapting to new military and political realities.