The best way to handle this is to create some template files, and then have a php script process them and output flat CSS files. You can dig around on the internet and find some nice CSS minimizer, while you're at it, to squeeze out a little more performance. A couple of things to keep in mind:
1) Security - if your builder script will be run via the web, it's probably a smart idea to keep your template files outside of the web root. If it were me, I'd keep both the builder and the templates outside of the web root, and run the builder script from the command line.
2) If your CSS is complex enough that this is really worthwhile, think long and hard about "names for things". $red is not a particularly good name. Since it's now variable, at some point $red might actually be blue (as in #00F)! Every time I've done this, coming up with descriptive names for variables that represent values in a stylesheet has been a real puzzle.