padding-inline covering the border but still maintaining transparency to the background behind (which obviously isn't a solid colour) is like <fieldset> & <legend>, but using those elements here would be wrongly semantically and I'm struggling to think how to do it otherwise as there aren't relevant default styles on those elements to emulate