creates 3-layer card stack based on z-index and key index value