I think you should have a .thumbnail.nth-child(3n) { margin-right: 0.1rem; } here, right?

Or maybe it would be better to make this case the default, and then have a media query for non-hd 320px devices where you change the width and the margins.  Maybe width divisible by three is the normal case and width not divisible by three is the special case that needs a media query.