Exploring gauge-fixing conditions with gradient-based optimization