top margin value is not the same as
headheight, as can be seen from the graphics (from
geometry.pdf package documentation). There's a small
\headsep value too, that serves as vertical spacing between the page header content and the real text body.
If some content shall be squeezed right at the top boundary of the page,
headheight should be quite identical, the values in the solution above are just arbitrary ones, depending on the real size of the graphics that should be placed there.
In case the potential warning reported by
headheight values should not be ignored -- the reported values are quite helpful to prevent wrong page headers!