Are long-term capital gains calculated progressively? If so, how does the calculation work when you have a mix of short & long-term gains?

I know that long term gains are based on your total taxable income.  But I'm confused on how the tax is calculated if a little bit of the long-term gains goes beyond the $40,000 threshold.

For example, suppose I have no taxable income other than $10,000 of short-term capital gains from stocks and $45,000 of long-term capital gains from stocks (i.e. 55,000 total in taxable income). 

Assume we use these 2020-2021 rates:
Income tax brackets:
0 to 9875 = 10%
9875 to 20125 = 22%

Long term capital gains:
0 to 40,000 = 0%
40,000 to 441,450 = 15%

Would the calculation be...
A)
Regular income tax from short-term gains = 9,875*0.1+(10,000-9,875)*0.12 = $1002.5
Long term cap gains tax = (45,000 - 10,000) * 0.0 + (55,000 -40,000)* 0.15 = $2250
Total = $3252.5

OR
B)
Regular income tax from short-term gains = 9,875*0.1+(10,000-9,875)*0.12 = $1002.5
Long term cap gains tax = $45,000 *.15 = $6,750
Total = $7,752.5

Or is it something different?  I'm assuming that the regular income tax gets taxed "first" in the above examples (i.e. as opposed to having all of the short term gains taxed at 22% if it were taxed "second"). But I'm confused even after lots of googling.

Any help would be really appreciated!