Stack and Queue Layouts via Layered Separators