The 2023 rules stipulate that when you stop being a resident of Portugal, you cough up 28% of the capital gains on the current VALUE of your holdings
It's an Exit Tax.
Do not move to Portugal!! Unless you want to stay forever (or pay a third of your gains)