The font-size of elements with the parent <body> inherit the font-size of 1em=16px

h1 font-size is 2.5 em = 40px

Font-size of elements with the parent <main> inherit the font-size of 1.25em=20px

h2 font-size is 2 em = 40 px

This happens because the em unit is equal to the font-size of the parent element - i.e. 2 em is 2 times the size of the current font, not the <body> font.