Have the script that opens the popup set CSS style properties of an element that covers the entire page area. A true “popup” is a separate window unaffected by the other windows CSS. I think you are actually referring to a “modal”, which is actually part of the same page. It appears similar to a popup, what its container is is the principal difference. In a modal, it needs to be outside the element you are styling to be darker.
It’s simplest to set the opacity of the non-modal element to some fraction of 1, but the effect is to lighten and grey out the page, not darken. If it must be darker, you need an overlay element which is normally transparent, but can be set to a darker transparency with RGBA colors such as rgba(0,0,0,0.5)
.