Maybe don't use custom properties in shorthand properties | CSS-Tricks
Briefly

The article discusses the implications of using invalid custom properties in CSS, revealing that an invalid property can lead to the failure of the entire declaration process. This serves as a reminder of CSS cascading and evaluation rules, where the system does not ignore invalid inputs. Particularly, when shorthand properties are involved, invalid custom properties can have broader consequences on an entire set of styles, leading to potential frustrations for developers. The author suggests avoiding shorthand when using custom properties to mitigate these risks.
That an invalid custom property invalidates the entire declaration isn't surprising, but I didn't consider it until I saw one of my declarations break.
If a custom property is invalid, the cascade won't ignore it, and it gets evaluated, which invalidates the declaration.
So, maybe don't use custom properties in shorthand properties or use custom properties but don't use shorthand properties.
Read at CSS-Tricks
[
|
]