You cannot connect SharePoint designer to modern team sites because custom scripts is disabled on modern team sites. The solution is to enable custom script using SharePoint online management shell.

Connect-SPOService -Url https://tenantname-admin.sharepoint.com
Set-SPOsite <SiteURL> -DenyAddAndCustomizePages 0

You then wait as it could take up to 24 hours to enable this feature.