Here is the standard, typical stability diagram;
In this model an external force causes the ship to incline putting the ship out of equilibrium, the GZ will then act as a restoring force and return the ship to upright.
This model is helpful to a point but showing the sea as a straight, horizontal line is not always the case.
This is from the book “Know your ship”
This explains why a stiff ship, one with high GM in a swell sometimes snap rolls to large angles. The ship is trying to match the wave slope. The epitome of a stiff vessel is a raft as it always matches wave slope.