Hi Lilly!
I stumble upon the same issue not so long ago. ![]()
Short answer: Themes and CSS variables are considered strings and, while you can use them in attributes such as color, background, border and so on, they can’t be used in SCSS color functions.
The issue is not related to Discourse:
https://github.com/sass/sass/issues/3006
There’s an overcomplicated way to circumvent this I didn’t try: Issue · GitHub