Legacy's explanation is right on.
One thing to keep in mind is that "offset" can only apply to live-ball fouls. When fouls "offset," the penalties associated them are neither accepted, nor declined. By rule, the fouls themselves - not their penalties (regardless of different distances, loss of down, etc.) simply offset each other, and the down is to be repeated. And, yes, a single live-ball foul by one team can offset multiple live-ball fouls by the other team.
Example: B59 is offside, A77 holds B66, and A11 intentionally grounds the ball. The FOULS offset, and the down is repeated.
In the cases of dead-ball fouls by opponents, the fouls are "accepted," but, when all fouls are reported to the R before any of them are 'completed' (as defined), the distance penalties cancel each other; the ball remains at the dead-ball spot/succeeding spot, and the down number that has already been established is not affected.
Example: 2/25, A-20. A88 catches a pass at the A-25 and 'taunts' B55, who then immediately flips off A88. Both fouls occurred before either had been completed. Those fouls are, officially, accepted, but, by rule, the distance penalties cancel each other, so the location of the succeeding spot AND the number of the next down, established by the natural result of the down, are unaffected, for 3/20, A-25. The significance here is that, had there only been a single UNS foul by Team B, Team A would get an automatic first down, even though the distance penalty would leave the ball short of the line-to-gain. In this case(DBFs by both teams) the penalties cancel, including the first down component of Team B's penalty.
(But, both players get one foul on their UNS counters.)
In the cases of dead-ball fouls that occur in different time frames, i.e., one is reported and completed before the other is reported to the R, then each of those penalties is enforced in the order of their occurrence.
Example: 2/10, A-30. A88 catches a pass and is 'down' at the A-35, then 'taunts' B55. The foul is reported to the R, who acknowledges to the U that this penalty will be accepted at the succeeding spot, and the next down will be 3rd down. At that point the A88's penalty is completed. Then B55 makes a 'throat slash' action toward A88. The penalty for this UNS foul is enforced from the point that A88's penalty left the ball (A-20), to the A-35, and a first down is awarded to Team A. (And, both players get one foul on their UNS counters.)
Fouls offset (when prescribed by rule). Penalties cancel (when prescribed by rule).