After experimenting a bit, I stumbled upon a solution (using today's CSS features):
Although percentage values are not supported, you can utilize calc with decimal fractions.
div[id^=shadow] {
background: #000000;
color: #ffffff;
margin-block-end: 3em;
}
#shadow-1 {box-shadow: 0 calc(.05 * 1em) 0 red;}
#shadow-2 {box-shadow: 0 calc(.25 * 1em) 0 red;}
#shadow-3 {box-shadow: 0 calc(1.5 * 1em) 0 red;}
#shadow-4 {box-shadow: 0 calc(.75 * 5px) 0 red;}
#shadow-5 {box-shadow: 0 calc(2 * 5px) 0 red;}
<div id="shadow-1">5% of 1em</div>
<div id="shadow-2">25% of 1em</div>
<div id="shadow-3">150% of 1em</div>
<div id="shadow-4">75% of 8px</div>
<div id="shadow-5">200% of 8px</div>
In your specific scenario, it could look like this:
.shadowright
{
--offset: 5px;
box-shadow: var(--offset) var(--offset) calc(2 * var(--offset)) #454545;
}