Stern–Gerlach detection of neutral-atom qubits in a state-dependent optical lattice