Nonlocal gravity-induced density profiles in gases near the critical point