I get very confused about what’s allowed and what’s not, I thought you could not fly over buildings and and always have line of sight?
You can fly over buildings! If you read the FAA rules, you may fly at a max of 400', however, within 400' of a structure, you may fly up to 400' over that structure (107.51 Operating Limitations for Small Unmanned Aircraft). And you are correct.... you MUST have the aircraft in view at all times.
§107.51 Operating limitations for small unmanned aircraft.
A remote pilot in command and the person manipulating the flight controls of the small unmanned aircraft system must comply with all of the following operating limitations when operating a small unmanned aircraft system:
(a) The groundspeed of the small unmanned aircraft may not exceed 87 knots (100 miles per hour).
(b) The altitude of the small unmanned aircraft cannot be higher than 400 feet above ground level, unless the small unmanned aircraft:
(1) Is flown within a 400-foot radius of a structure; and
(2) Does not fly higher than 400 feet above the structure's immediate uppermost limit.
(c) The minimum flight visibility, as observed from the location of the control station must be no less than 3 statute miles. For purposes of this section, flight visibility means the average slant distance from the control station at which prominent unlighted objects may be seen and identified by day and prominent lighted objects may be seen and identified by night.
(d) The minimum distance of the small unmanned aircraft from clouds must be no less than:
(1) 500 feet below the cloud; and
(2) 2,000 feet horizontally from the cloud.
§107.31 Visual line of sight aircraft operation.
(a) With vision that is unaided by any device other than corrective lenses, the remote pilot in command, the visual observer (if one is used), and the person manipulating the flight control of the small unmanned aircraft system must be able to see the unmanned aircraft throughout the entire flight in order to:
(1) Know the unmanned aircraft's location;
(2) Determine the unmanned aircraft's attitude, altitude, and direction of flight;
(3) Observe the airspace for other air traffic or hazards; and
(4) Determine that the unmanned aircraft does not endanger the life or property of another.
(b) Throughout the entire flight of the small unmanned aircraft, the ability described in paragraph (a) of this section must be exercised by either:
(1) The remote pilot in command and the person manipulating the flight controls of the small unmanned aircraft system; or
(2) A visual observer.
Hopefully, this helps.