Classical statistical mechanics approach to multipartite entanglement