If your document has no groups, then doc.layers and doc.artLayers will be the same. But if you groups then doc.layers will give all
- art layers in the doc root
- the groups you have an doc root
- any art layers and sub groups in the root level groups.
I.e. doc.layers will return the full document hierarchy as a flat list, but the order that list is not guaranteed to be something (as far as I know). Most likely order is always the visual top to bottom. I.e. item 0 is always the visually topmost element.
Also note that if you use doc.layers, you need to check if the item is a layer or a group (=folder=layerset). That's why you also have the collections .artLayers and .layerSets that give just layers and groups respectfully.