A sin has to be voluntary but no ignorance (except vincible ignorance) is compatible with free will. So if you absolutely don’t know that what you did was wrong -was it still wrong?
The question I guess is also, is being ignorant of a sin a case of vincible ignorance?
i would recommend reading what the previous poster linked, but i will just also quickly answer,
yes, it is still wrong if you didn’t know it, but i think what you want to know is, is it mortally sinful? or are you held accountable for it?
the answer to that is no, it does not rob you of sanctifying grace because the 3 conditions were not met, which are full consent, full knowledge, and grave matter,
when you did not know something was mortally sinful, then for you it wasn’t, although you should still try to do some penance for it, because it still causes damage(depending on the circumstance) on either the soul or body, or to others, but it always causes damage to the soul, and you should want to repair that.
but it’s also important to keep in mind, that you have an obligation to learn your religion and learn what are sins, especially mortal ones, and to neglect finding out if something is a sin before you do it is a sin in itself, because then you show that you are willing to greatly offend God, and of course that’s no good.
but if you just don’t think of it, then you’re not completely at fault, and you should just try your best, and put in the effort as best as you can to learn these things(though calmly and with peace…don’t do it hastily or get stressed over it)
ok, so i hope this helps, take care.