A crack spread is what a refiner can hedge. A margin is what a refiner earns. They are related and they are not the same number, and the distance between them explains a good deal of otherwise puzzling refinery behaviour.
Start with the gross product worth: value every product the refinery actually makes at its market price, in the proportions it actually yields, and subtract the crude it actually bought at the differential it actually paid. That is already a better number than a 3-2-1 because it uses the real slate. Then subtract variable operating costs, energy, and the portion of the refinery's own output that it burns to run itself.
Energy is the term that has moved the most and surprises people the most. A refinery is a large consumer of natural gas and electricity, and in a gas price spike the margin can collapse while the crack spread barely moves, because the crack spread has no energy term in it at all. A European refiner in a gas crisis and a US Gulf Coast refiner with cheap gas can face the same crack and completely different economics.
There is also a decision margin distinct from the accounting one. Whether to keep running depends on variable costs only, because the fixed costs are sunk in the short run. That is why refineries continue to run at apparently negative margins: the relevant comparison is running versus shutting a unit down, and restarting is expensive and slow.