Mode localization in dynamics and buckling of linear imperfect continuous structures