When and why do buildings collapse?