Why it took so long to build a medieval cathedral