What is exactly the price of a credit default swap?

Is the price of a CDS the price that we pay to buy a CDS from the market?
Because if it is, it would be super counterintuitive.
From the formula
Upfront premium as a percentage of par = (credit spread - fixed coupon rate)*Duration
We could tell that when credit spread widens, the upfront premium increases
And from the formula
Price of CDS per 100 Par = 100 - upfront premium per 100 Par
We could tell that when the upfront premium increases, the price drop
So from this, we have Credit spread widens -------> price of the swap drops
Isn’t this counterintuitive? If I bought a CDS at t0 and immediately after I bought it the company got downgraded, and the credit spread increased. Wouldn’t this be a preferable event to me? Shouldn’t the price of my CDS be higher?

What am I missing here?