The Koper line is on the edge of an escarpment, and has to twist and turn through hairpin bends (some in tunnel) to lose height. A beautiful line to ride, and with slide-down opening windows in a coach with compartments and corridor, perfect for viewing the scenery and photography.
Train travel in Slovenia is also very cheap.