According to https://developer.bitcoin.org/reference/rpc/gettransaction.html the details array contains a list of the outputs of that transaction. Each output has a vout. So in my tests, it seems that the order seem to be the same than the vouts so that the index of the array is equal with the vout.
But is that guaranteed?