Handling theme custom css (inject or save to disk) ?

When it comes to custom css for a theme, I’ve always used generated css directly queening it in the head. The proper wordpress way.
However, now I have a lot more css that is generated dynamically (more than 1000 lines) and I was wondering if I should still queue that css in the head, or should I generate a proper css file and save it to disk?

There are some security issues to generating files and saving them (file ownership etc…)
I’m curious how are you guys tackling this problem?