Fair Value of Financial Instruments - Fair Values of Financial Instruments Measured on a Recurring Basis (Details) - USD ($) $ in Thousands | Dec. 31, 2021 | Dec. 31, 2020 |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | $ 1,419,630 | $ 669,230 |
Marketable securities | 1,060,488 | 1,091,076 |
Corporate bonds | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 449,417 | 454,487 |
Corporate bonds | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 449,417 | 454,487 |
Corporate bonds | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Corporate bonds | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 449,417 | 454,487 |
Corporate bonds | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Commercial paper | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 247,560 | 234,253 |
Commercial paper | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 247,560 | 234,253 |
Commercial paper | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Commercial paper | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 247,560 | 234,253 |
Commercial paper | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
U.S. treasury securities | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 189,010 | 203,054 |
U.S. treasury securities | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 189,010 | 203,054 |
U.S. treasury securities | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 189,010 | 203,054 |
U.S. treasury securities | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
U.S. treasury securities | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Certificates of deposit | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 82,486 | 134,882 |
Certificates of deposit | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 82,486 | 134,882 |
Prepaid expenses and other current assets | 1,137 | 571 |
Restricted cash | 6,297 | 9,110 |
Certificates of deposit | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Prepaid expenses and other current assets | 0 | 0 |
Restricted cash | 0 | 0 |
Certificates of deposit | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 82,486 | 134,882 |
Prepaid expenses and other current assets | 1,137 | 571 |
Restricted cash | 6,297 | 9,110 |
Certificates of deposit | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Prepaid expenses and other current assets | 0 | 0 |
Restricted cash | 0 | 0 |
Municipal securities | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 49,331 | 17,619 |
Municipal securities | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 49,331 | 17,619 |
Municipal securities | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Municipal securities | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 49,331 | 17,619 |
Municipal securities | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Non-U.S. government and supranational bonds | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 41,684 | 15,950 |
Non-U.S. government and supranational bonds | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 41,684 | 15,950 |
Non-U.S. government and supranational bonds | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Non-U.S. government and supranational bonds | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 41,684 | 15,950 |
Non-U.S. government and supranational bonds | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
U.S. agency bonds | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 1,000 | 16,018 |
U.S. agency bonds | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 1,000 | 16,018 |
U.S. agency bonds | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
U.S. agency bonds | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 1,000 | 16,018 |
U.S. agency bonds | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | 0 | 0 |
Asset-backed securities | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | | 14,813 |
Asset-backed securities | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | | 14,813 |
Asset-backed securities | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | | 0 |
Asset-backed securities | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | | 14,813 |
Asset-backed securities | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Marketable securities | | 0 |
Money market funds | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 711,188 | 225,643 |
Money market funds | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 711,188 | 225,643 |
Money market funds | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 711,188 | 225,643 |
Money market funds | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 0 | 0 |
Money market funds | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 0 | 0 |
Commercial paper | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 114,976 | 48,532 |
Commercial paper | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 114,976 | 48,532 |
Commercial paper | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 0 | 0 |
Commercial paper | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 114,976 | 48,532 |
Commercial paper | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 0 | 0 |
Corporate bonds | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 4,310 | |
Corporate bonds | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 4,310 | |
Corporate bonds | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 0 | |
Corporate bonds | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | 4,310 | |
Corporate bonds | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | $ 0 | |
U.S. treasury securities | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 39,998 |
U.S. treasury securities | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 39,998 |
U.S. treasury securities | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 39,998 |
U.S. treasury securities | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 0 |
U.S. treasury securities | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 0 |
Certificates of deposit | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 2,996 |
Certificates of deposit | Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 2,996 |
Certificates of deposit | Recurring | Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 0 |
Certificates of deposit | Recurring | Level 2 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | 2,996 |
Certificates of deposit | Recurring | Level 3 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash equivalents | | $ 0 |