OK no offense
@Joao97 , but I don't understand why we're assuming a permanent Castilian-Portuguese union. The logic simply isn't there or paper thin. First off, its highly likely Alfonso and Joanna produce at least one child before the former's death in 1481 (assuming he dies on schedule; Alfonso was only 49 and his health seemed broken by the collapse of his and Joanna's cause in the succession war). That child, boy or girl, is heir to the throne. Second, this isn't the middle ages where men can get away with usurping their wives territories and even legitimate lines of succession; the only potential way for Alfonso to pass the throne to João II is if Joanna died young and childless. However, such a scenario would simply have Fernando and Isabel move into Castile with the support of the country and expel the Portuguese. So if your wanting a Castilian-Portuguese union your best bet is for Alfonso to marry Joanna to his own son João instead of marrying her himself. Or have Alfonso and Joanna have a son before the former dies, leaving Joanna as Queen Regnant of Castile. Then have João die without a son like OTL; the Portuguese throne then passes to Joanna's son. But without one of the two above scenarios this whole idea enters into very out-there territory at best, near ASB at worst.
Exactly... Castile’s line of succession was pretty clear, the only variable was Juana being the heiress or not at all in the succession but after Isabella you have the other Trastamara aka Juan II of Aragon and his children Ferdinand (of Aragon), Eleanor (of Navarre) and Juana (Queen of Naples). If Juana die without heirs will be much more complicated deny who Isabella is the legitimate Queen while if Isabella die childless Ferdinand will become King of Castile in his own right uniting it with Aragon. If he also die childless then his half-sister Eleanor will inhereit both Aragon and Castile plus her own Navarre (and before considering a Castile united to Portugal look at the (very recent) history of Navarre where Juan II of Aragon after marrying the Queen, being named King, strong of a his late wife’s will, in which she wanted Juan to rule Navarre until his own death, he was forced to fight nobility, his own son who claimed to be the rightful King of Navarre and his eldest daughter (who tried to claim the same after her brother’s death) while the younger daughter (aka Eleanor) and her husband supported Juan and waited for their crown (only of Navarre as Aragon was destined to John’s son by his second wife, aka Ferdinand, who had no right on the crown of Navarre).
You can have an united Castile-Portugal only in three ways:
1) Juana married Jõao instead of his father and their children inhereit both crowns (but Jõao was already married when Juana married Alfonso)
2) having Jõao diyong childless and a child of Juana and Alfonso inhereiting both crown
3) Juana and Alfonso have only a girl who marry the son of Jõao (work also with Jõao having only a daughter who married the son of Juana and Alfonso)
So you need an heir of Castile marrying an heir of Portugal unlike the OTL wedding (because Navarre is a clear example of what Castile will likely do if Jõao try to take that crown)