{%- set families = {
    'inter': 'Inter', 'plus-jakarta-sans': 'Plus Jakarta Sans', 'manrope': 'Manrope', 'poppins': 'Poppins',
    'nunito': 'Nunito', 'dm-sans': 'DM Sans', 'outfit': 'Outfit', 'figtree': 'Figtree', 'lexend': 'Lexend',
    'cairo': 'Cairo', 'tajawal': 'Tajawal', 'almarai': 'Almarai', 'noto-sans-arabic': 'Noto Sans Arabic',
    'noto-naskh-arabic': 'Noto Naskh Arabic', 'alexandria': 'Alexandria'
} -%}
{%- set wanted = [families[theme.font] ?? null, theme.heading_font != 'same' ? (families[theme.heading_font] ?? null) : null]|filter(f => f) -%}
{%- set wanted = wanted|length == 2 and wanted[0] == wanted[1] ? [wanted[0]] : wanted -%}
{%- if wanted -%}
{%- if theme.font_host == 'google' -%}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?{% for f in wanted %}family={{ f|replace({' ': '+'}) }}:wght@400;500;600;700;800&amp;{% endfor %}display=swap">
{%- else -%}
<link rel="preconnect" href="https://fonts.bunny.net" crossorigin>
<link rel="stylesheet" href="https://fonts.bunny.net/css?family={% for f in wanted %}{{ f|lower|replace({' ': '-'}) }}:400,500,600,700,800{{ loop.last ? '' : '|' }}{% endfor %}&amp;display=swap">
{%- endif -%}
{%- endif %}
