Pair-production opacity at high and very-high gamma-ray energies