I don’t think you’re doing anything wrong. I think you’ve stumbled on a bug in Obsidian that’s been around for a while: PDF export does not respect cssclass
specified in YAML. You can read more about it here:
It’s painful to me, because I use PDF export often and I would really love to be able to customize the PDF per note. For some notes I want multi columns, for others I want different fonts, etc.
The bug report is still open, so I have hope that the dev team is aware of it and will eventually fix it. If you’d like to draw attention to it, you might add a heart or a comment to the bug report post.