Invert the colour gradient inside a buffer

Using the geometry generator based on a line I was able to create the following:

enter image description here

The idea is: Create a transparent buffer (10 %) to one side of the line (hopefully all you lines have been drawn in the same direction). This is done by single_sided_buffer($geometry,50,25).

$geometry is the line in this case, 50 is the width of the buffer in layer units and 25 is how many segments a quarter-circle should be represented by.

Then I duplicated this symbology-layer and made the copy a bit more narrow (45 m in this case). And so on, until I reached 5 m width. The result has isolines in it, but if you make your steps small enough, they will become nigh invisible.

Updated: to improve my original answer, you can do as follows: create a buffer from your shoreline. This Buffer-polygon must be behind your land-polygon. If you than style the buffer with shapeburst symbol layer type, you just have to select a color ramp and set a distance. That's all, see here:

Shapeburst shore

Original answer:

Have you tried Shapeburst symbol layer type? What you want to achieve is easier to realise with that rendering style. However, even than you have the gradient coming form all lines of the polygon coming... set the last color to transparent and set a fixed distance. To hide the color on the opposite side, consider creating an additional layer on top of it to mask the gradient form the opposite side.

enter image description here

You have in the background your layer for the ocean in a set color. Use the same color as second color in the gradient of your shapeburst on top ot the ocean-layer and use again the same color as 3rd color with 100% transparency. The mask-layer on the top is again in the same color. Together with the mask-layer on top, it could look like this (the thin dotted line is just to indicate the polygon-shape of the mask-layer):

enter image description here

This is a Line-based approach using Array of offset (parallel) lines tool in the QGIS Processing Toolbox > Vector Creation.

(1) Start the tool and set number of features, say 100 lines at 1.0 m (or -1m to make them the right-side) step distance.

enter image description here

(2) The tool will produce Offset lines layer. Set Graduated symbol using the offset value.

enter image description here

(3) The output would be like below. As we are working on lines, benefit of this approach would be seen when you have narrow kinks.

enter image description here