Quantum field theory, gravity and cosmology in a fractal universe