{% load friendly_loader wagtailcore_tags wagtailsettings_tags cjkcms_tags static %}
{% friendly_load webpack_loader %}
    {% if settings.cjkcms.LayoutSettings.frontend_theme == 'python-webpack' %} {# use python-webpack from Michael Yin #}
        {% if_has_tag stylesheet_pack %}
            {% stylesheet_pack 'app' %}
        {% endif_has_tag %}
    {% else %}
        <link href="{% theme_css %}" 
            rel="stylesheet" 
            crossorigin="anonymous">
    {% endif %}

    {% if settings.cjkcms.LayoutSettings.color_scheme == 'custom' %}
        <!-- Load local css variables sheet to override default colors etc -->
        <link
            href="{% static 'cjkcms/css/cjkcms-custom-theme.css' %}"
            rel="stylesheet">
    {% endif %}

    {% if settings.cjkcms.LayoutSettings.bootstrap_icons %}
        <!-- Bootstrap icons (local) -->
        <link
            href="{% static 'cjkcms/bi/bootstrap-icons.css' %}"
            rel="stylesheet">
    {% endif %}

    {% if settings.cjkcms.LayoutSettings.awesome_cdn %}
        <!-- Font Awesome -->
        <link
            href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
            rel="stylesheet"
            crossorigin="anonymous">
    {% endif %}
    {% if settings.cjkcms.LayoutSettings.custom_font %}
        <!-- Google Fonts -->
        <link
        href="{{ settings.cjkcms.LayoutSettings.font_url }}"
        rel="stylesheet"
        crossorigin="anonymous">
        <style>
            body {
                font-family: {{ settings.cjkcms.LayoutSettings.font_family }} !important;
            }
        </style>
    {% endif %}
