A no-coding solution can be to add another (almost invisible) anchor a bit higher.
See How to make button scroll to specific section on same page - #3 by tim_1
Another option is to use JS to override anchor link handling.
Finally, should it be scroll-margin-top or scroll-padding-top?
The latter specifically suggests your use-case :
Ah, this depends on where you apply this property – scroll-margin-top works for target elements (as in your code), while scroll-padding-top – on container – try this on body, like
body {
scroll-padding-top: var(--header-height);
}