We develop a new criterion to tell if a group G has the maximal gap of 1/2 in stable commutator length (scl). For amalgamated free products G = A C B we show that every element g in the commutator subgroup of G which does not conjugate into A or B satisfies scl(g) ≥ 1/2, provided that C embeds as a left relatively convex subgroup in both A and B. We deduce from this that every non-trivial element g in the commutator subgroup of a right-angled Artin group G satisfies scl(g) ≥ 1/2. This bound is sharp and is inherited by all fundamental groups of special cube complexes.We prove these statements by constructing explicit extremal homogeneous quasimorphisms φ : G → R satisfyingφ(g) ≥ 1 and D(φ) ≤ 1. Such maps were previously unknown, even for non-abelian free groups. For these quasimorphismsφ there is an action ρ : G → Homeo + (S 1 ) on the circle such that [δ 1φ ] = ρ * eu R b ∈ H 2 b (G, R), for eu R b the real bounded Euler class.