How seagull maintaine in the same place while fiying against wind

Imagine a seagull flying not against the wind, but in still air. Its wings will produce lift, which allows the bird to stay airborne by counteracting the force of gravity, and thrust, which propels the bird forwards at a rate of, say, 40 km/h. If the same bird is flying against a 15 km/h wind, it is essentially flying within a stream of air that is carrying it backwards at 15 km/h, like a person running the wrong way on a conveyor belt. In theory, the seagull should be able to fly forwards at 40 - 15 = 25 km/h. Its wings produce enough thrust that it can keep advancing despite the headwind, albeit more slowly, and enough lift to keep it aloft just as in still air.

Now imagine that the wind speed increases to 40 km/h. The seagull is now flying in a stream of air that is carrying it backwards exactly as fast as its wings can propel it forwards. The wings are still producing lift, so the seagull does not fall out of the air, but it hovers in the same place without advancing, as if it were in a wind tunnel. If the wind starts to blow even harder, and the seagull is unable to flap more powerfully in order to compensate, it will theoretically start to be blown backward.

The short answer, then, is that the seagull is not "trying" to remain in the same place when flying against the wind; it is trying to move forward, but the wind is blowing hard enough to hold it in place. Of course, the wind doesn't usually blow at a perfectly steady rate, so sometimes a bird will be "held" by strong gusts but can advance in between gusts when the wind speed is lower.