Unraveling residual trapping for geologic hydrogen storage and production using pore-scale modeling