This bit is inaccurate - to be rewritten when time allows. See comments below: The height of the element with tag HTML is defined to be the viewport height.
On a screen this is normally the height of the screen minus any bits being used for other things.
So giving the HTML element that background covers the viewport in a partially transparent dark grayish color.
I think this is the end of the inaccurate bit.
Then the body element is given a height of 500px so another layer of that partially transparent color is painted but only for 500px.
Where the two partially transparent colors overlap the system works out what the new color should be. The basic rgb colors are the same in this case. The alpha channel (the 0.78 in your example) gets a new value which is calculated from the two overlaid alpha channels:
top-alpha-channel + bottom-alpha-channel * (1 - top-alpha-channel)
see e.g. Alpha Compositing Algorithm (Blend Modes)
Putting in your 0.78 value in both cases the new alpha channel (=opacity) value is 0.9516.
So, it's darker - a bit less see-through - but it's not completely opaque.
If you just want the viewport (the bit the user sees at any time) to have the original color then just set it for the html element.
OR just set it for the body. The whole of the viewport will pick up that background color but (for reasons I hope someone can explain - UPDATE: the accepted answer here explains it: Why does styling the background of the body element affect the entire screen?) the blending of the body and viewport colors does not take place so you see the color you want over the whole viewport.
Whether you want to set your body to a fixed 500px will depend on your particular context of course.