The enigma of medieval craft guilds: a model of social inertia and technological change