Mixing and phase separation at supercritical and transcritical pressures