I hope the title is accurate/descriptive. Open to suggestions edits if something makes more sense after reading.
The best way I can describe this is with a scenario. So:
$5,000 is invested in stock A
Stock A increases in value by 20%($1,000) over the next 3 months
Stock A is sold and $5,000 taken out of the brokerage account as cash on hand while $1,000 is invested in stock B
It's the end of year and $1,000 + profit/loss is still invested
Would I pay short term capital gains on $1,000, and long term capital gains on profit from the 'left over' $1,000 when sold? Or no tax yet as the profit isn't realized since it was reinvested into a "security of the same type", and long term capital gains after Stock B is sold.
Another way to phrase this might be: "If money is removed from an investment after it's increased in value with exact balance of the profit still invested, is the profit still invested considered your capital gain, or would the profit be considered a part of the divested money, and what's left a portion of the initially deposited amount?"