You're not crazy.
Psst. Discovery folks. You've got yourself a race condition. You're calculating a `margin-top` to center an image vertically irrespective of whether that image has loaded. You either need to explicitly set the width and height as attributes on the image (good for preventing reflow anyway) or hold off on calculating your dimensions until after the image has loaded. You could even just wait for window load (instead of DOMContentLoaded).
EDIT: Here's an untested, hacky fix. Not an ideal solution but concise and without having to change anything. https://gist.github.com/anonymous/c40e8baf679aad65cb2c