There are many righteous, as in upright, people in the Bible, but the righteousness we receive in Jesus, that which is the forgiveness of sins and which opens to us Heavens gates, came first and most complete to Mary.
But Joseph is called Righteous however. Sorry; nowhere in YHvH's Holy WORD
shalom b'SHEM Yah'shua HaMashiach
do I find Mary called righteous.
Joseph was considered righteous under the law and though he was such, he still could not attain heaven.
Mary was righteous because of the grace of Jesus under the new covenant which made heaven possible.
For it is by grace that we are made righteous and not by the law.
Galatians 2:21 KJV “I do not frustrate the grace of God: for if righteousness come by the law, then Christ is dead in vain.”
We speak of two different conditions of righteousness, one the Judaic and one Christian.
Mary, being full of grace, was made completely righteous by her Son, Jesus.