Joseph was of the Royal line through Solomon. The Royal line had a blood curse, (Jeconiah or Coniah,) that no of his seed would sit on the throne of David. Marys line is not the Royal line and does not have the blood curse. Jesus is Josephs first son through adoption, and can claim the throne of David while he is also a descendant of David through Mary.
Great post thank you. And ergo the virgin birth was the only way to reconcile to legal and royal lines!