From a community of refugees hiding out in the Italian lagoons, to one of the medieval world's most powerful maritime states.