A complexity approach to sustainability