$generatedFontsPresent: true;

{strip}
    {if isset($fonts.body)}
        $font-body-family: {if $fonts.body.family}{if str_contains($fonts.body.family, "'") || str_contains($fonts.body.family, ',')}{$fonts.body.family}{else}'{$fonts.body.family}'{/if}{else}default{/if};
        $font-body-color: {if $fonts.body.color !== ''}{$fonts.body.color}{else}default{/if};
        $font-body-xs: {$fonts.body.sizes.xs}px;
        $font-body-sm: {$fonts.body.sizes.sm}px;
        $font-body-md: {$fonts.body.sizes.md}px;
        $font-body-lg: {$fonts.body.sizes.lg}px;
        $font-body-xl: {$fonts.body.sizes.xl}px;
        $font-body-weight: {if in_array("bold", $fonts.body.decorations)}bold{else}normal{/if};
        $font-body-style: {if in_array("italic", $fonts.body.decorations)}italic{else}normal{/if};
        $font-body-decoration: {if in_array("underline", $fonts.body.decorations)}underline{else}none{/if};
        @include font-configuration(body, $font-body-family, $font-body-color, $font-body-xs, $font-body-sm, $font-body-md, $font-body-lg, $font-body-xl, $font-body-weight, $font-body-style, $font-body-decoration);
        @include font-configuration(p, $font-body-family, $font-body-color, $font-body-xs, $font-body-sm, $font-body-md, $font-body-lg, $font-body-xl, $font-body-weight, $font-body-style, $font-body-decoration);
    {/if}
{/strip}

{strip}
    {if isset($fonts.h1)}
        $font-h1-family: {if $fonts.h1.family}{if str_contains($fonts.h1.family, "'") || str_contains($fonts.h1.family, ',')}{$fonts.h1.family}{else}'{$fonts.h1.family}'{/if}{else}default{/if};
        $font-h1-color: {if $fonts.h1.color !== ''}{$fonts.h1.color}{else}default{/if};
        $font-h1-xs: {$fonts.h1.sizes.xs}px;
        $font-h1-sm: {$fonts.h1.sizes.sm}px;
        $font-h1-md: {$fonts.h1.sizes.md}px;
        $font-h1-lg: {$fonts.h1.sizes.lg}px;
        $font-h1-xl: {$fonts.h1.sizes.xl}px;
        $font-h1-weight: {if in_array("bold", $fonts.h1.decorations)}bold{else}normal{/if};
        $font-h1-style: {if in_array("italic", $fonts.h1.decorations)}italic{else}normal{/if};
        $font-h1-decoration: {if in_array("underline", $fonts.h1.decorations)}underline{else}none{/if};
        @include font-configuration('h1, .h1', $font-h1-family, $font-h1-color, $font-h1-xs, $font-h1-sm, $font-h1-md, $font-h1-lg, $font-h1-xl, $font-h1-weight, $font-h1-style, $font-h1-decoration);
    {/if}
{/strip}

{strip}
    {if isset($fonts.h2)}
        $font-h2-family: {if $fonts.h2.family}{if str_contains($fonts.h2.family, "'") || str_contains($fonts.h2.family, ',')}{$fonts.h2.family}{else}'{$fonts.h2.family}'{/if}{else}default{/if};
        $font-h2-color: {if $fonts.h2.color !== ''}{$fonts.h2.color}{else}default{/if};
        $font-h2-xs: {$fonts.h2.sizes.xs}px;
        $font-h2-sm: {$fonts.h2.sizes.sm}px;
        $font-h2-md: {$fonts.h2.sizes.md}px;
        $font-h2-lg: {$fonts.h2.sizes.lg}px;
        $font-h2-xl: {$fonts.h2.sizes.xl}px;
        $font-h2-weight: {if in_array("bold", $fonts.h2.decorations)}bold{else}normal{/if};
        $font-h2-style: {if in_array("italic", $fonts.h2.decorations)}italic{else}normal{/if};
        $font-h2-decoration: {if in_array("underline", $fonts.h2.decorations)}underline{else}none{/if};
        @include font-configuration('h2, .h2', $font-h2-family, $font-h2-color, $font-h2-xs, $font-h2-sm, $font-h2-md, $font-h2-lg, $font-h2-xl, $font-h2-weight, $font-h2-style, $font-h2-decoration);
    {/if}
{/strip}

{strip}
    {if isset($fonts.h3)}
        $font-h3-family: {if $fonts.h3.family}{if str_contains($fonts.h3.family, "'") || str_contains($fonts.h3.family, ',')}{$fonts.h3.family}{else}'{$fonts.h3.family}'{/if}{else}default{/if};
        $font-h3-color: {if $fonts.h3.color !== ''}{$fonts.h3.color}{else}default{/if};
        $font-h3-xs: {$fonts.h3.sizes.xs}px;
        $font-h3-sm: {$fonts.h3.sizes.sm}px;
        $font-h3-md: {$fonts.h3.sizes.md}px;
        $font-h3-lg: {$fonts.h3.sizes.lg}px;
        $font-h3-xl: {$fonts.h3.sizes.xl}px;
        $font-h3-weight: {if in_array("bold", $fonts.h3.decorations)}bold{else}normal{/if};
        $font-h3-style: {if in_array("italic", $fonts.h3.decorations)}italic{else}normal{/if};
        $font-h3-decoration: {if in_array("underline", $fonts.h3.decorations)}underline{else}none{/if};
        @include font-configuration('h3, .h3', $font-h3-family, $font-h3-color, $font-h3-xs, $font-h3-sm, $font-h3-md, $font-h3-lg, $font-h3-xl, $font-h3-weight, $font-h3-style, $font-h3-decoration);
    {/if}
{/strip}

{strip}
    {if isset($fonts.h4)}
        $font-h4-family: {if $fonts.h4.family}{if str_contains($fonts.h4.family, "'") || str_contains($fonts.h4.family, ',')}{$fonts.h4.family}{else}'{$fonts.h4.family}'{/if}{else}default{/if};
        $font-h4-color: {if $fonts.h4.color !== ''}{$fonts.h4.color}{else}default{/if};
        $font-h4-xs: {$fonts.h4.sizes.xs}px;
        $font-h4-sm: {$fonts.h4.sizes.sm}px;
        $font-h4-md: {$fonts.h4.sizes.md}px;
        $font-h4-lg: {$fonts.h4.sizes.lg}px;
        $font-h4-xl: {$fonts.h4.sizes.xl}px;
        $font-h4-weight: {if in_array("bold", $fonts.h4.decorations)}bold{else}normal{/if};
        $font-h4-style: {if in_array("italic", $fonts.h4.decorations)}italic{else}normal{/if};
        $font-h4-decoration: {if in_array("underline", $fonts.h4.decorations)}underline{else}none{/if};
        @include font-configuration('h4, .h4', $font-h4-family, $font-h4-color, $font-h4-xs, $font-h4-sm, $font-h4-md, $font-h4-lg, $font-h4-xl, $font-h4-weight, $font-h4-style, $font-h4-decoration);
    {/if}
{/strip}

{strip}
    {if isset($fonts.h5)}
        $font-h5-family: {if $fonts.h5.family}{if str_contains($fonts.h5.family, "'") || str_contains($fonts.h5.family, ',')}{$fonts.h5.family}{else}'{$fonts.h5.family}'{/if}{else}default{/if};
        $font-h5-color: {if $fonts.h5.color !== ''}{$fonts.h5.color}{else}default{/if};
        $font-h5-xs: {$fonts.h5.sizes.xs}px;
        $font-h5-sm: {$fonts.h5.sizes.sm}px;
        $font-h5-md: {$fonts.h5.sizes.md}px;
        $font-h5-lg: {$fonts.h5.sizes.lg}px;
        $font-h5-xl: {$fonts.h5.sizes.xl}px;
        $font-h5-weight: {if in_array("bold", $fonts.h5.decorations)}bold{else}normal{/if};
        $font-h5-style: {if in_array("italic", $fonts.h5.decorations)}italic{else}normal{/if};
        $font-h5-decoration: {if in_array("underline", $fonts.h5.decorations)}underline{else}none{/if};
        @include font-configuration('h5, .h5', $font-h5-family, $font-h5-color, $font-h5-xs, $font-h5-sm, $font-h5-md, $font-h5-lg, $font-h5-xl, $font-h5-weight, $font-h5-style, $font-h5-decoration);
    {/if}
{/strip}

{strip}
    {if isset($fonts.h6)}
        $font-h6-family: {if $fonts.h6.family}{if str_contains($fonts.h6.family, "'") || str_contains($fonts.h6.family, ',')}{$fonts.h6.family}{else}'{$fonts.h6.family}'{/if}{else}default{/if};
        $font-h6-color: {if $fonts.h6.color !== ''}{$fonts.h6.color}{else}default{/if};
        $font-h6-xs: {$fonts.h6.sizes.xs}px;
        $font-h6-sm: {$fonts.h6.sizes.sm}px;
        $font-h6-md: {$fonts.h6.sizes.md}px;
        $font-h6-lg: {$fonts.h6.sizes.lg}px;
        $font-h6-xl: {$fonts.h6.sizes.xl}px;
        $font-h6-weight: {if in_array("bold", $fonts.h6.decorations)}bold{else}normal{/if};
        $font-h6-style: {if in_array("italic", $fonts.h6.decorations)}italic{else}normal{/if};
        $font-h6-decoration: {if in_array("underline", $fonts.h6.decorations)}underline{else}none{/if};
        @include font-configuration('h6, .h6', $font-h6-family, $font-h6-color, $font-h6-xs, $font-h6-sm, $font-h6-md, $font-h6-lg, $font-h6-xl, $font-h6-weight, $font-h6-style, $font-h6-decoration);
    {/if}
{/strip}

{strip}
    {if isset($fonts.body)
    || isset($fonts.h1)
    || isset($fonts.h2)
    || isset($fonts.h3)
    || isset($fonts.h4)
    || isset($fonts.h5)
    || isset($fonts.h6)}

    $etImportForCrit: false !default;

    @if $etImportForCrit == true {
        :root {
            {if isset($fonts.body)}
                --et-font-body-family: {if $fonts.body.family}{if str_contains($fonts.body.family, "'") || str_contains($fonts.body.family, ',')}{$fonts.body.family}{else}'{$fonts.body.family}'{/if}{else}default{/if};
                --et-font-body-color: {if $fonts.body.color !== ''}{$fonts.body.color}{else}default{/if};
                --et-font-body-xs: {$fonts.body.sizes.xs}px;
                --et-font-body-sm: {$fonts.body.sizes.sm}px;
                --et-font-body-md: {$fonts.body.sizes.md}px;
                --et-font-body-lg: {$fonts.body.sizes.lg}px;
                --et-font-body-xl: {$fonts.body.sizes.xl}px;
                --et-font-body-weight: {if in_array("bold", $fonts.body.decorations)}bold{else}normal{/if};
                --et-font-body-style: {if in_array("italic", $fonts.body.decorations)}italic{else}normal{/if};
                --et-font-body-decoration: {if in_array("underline", $fonts.body.decorations)}underline{else}none{/if};
            {/if}
            {if isset($fonts.h1)}
                --et-font-h1-family: {if $fonts.h1.family}{if str_contains($fonts.h1.family, "'") || str_contains($fonts.h1.family, ',')}{$fonts.h1.family}{else}'{$fonts.h1.family}'{/if}{else}default{/if};
                --et-font-h1-color: {if $fonts.h1.color !== ''}{$fonts.h1.color}{else}default{/if};
                --et-font-h1-xs: {$fonts.h1.sizes.xs}px;
                --et-font-h1-sm: {$fonts.h1.sizes.sm}px;
                --et-font-h1-md: {$fonts.h1.sizes.md}px;
                --et-font-h1-lg: {$fonts.h1.sizes.lg}px;
                --et-font-h1-xl: {$fonts.h1.sizes.xl}px;
                --et-font-h1-weight: {if in_array("bold", $fonts.h1.decorations)}bold{else}normal{/if};
                --et-font-h1-style: {if in_array("italic", $fonts.h1.decorations)}italic{else}normal{/if};
                --et-font-h1-decoration: {if in_array("underline", $fonts.h1.decorations)}underline{else}none{/if};
            {/if}
            {if isset($fonts.h2)}
                --et-font-h2-family: {if $fonts.h2.family}{if str_contains($fonts.h2.family, "'") || str_contains($fonts.h2.family, ',')}{$fonts.h2.family}{else}'{$fonts.h2.family}'{/if}{else}default{/if};
                --et-font-h2-color: {if $fonts.h2.color !== ''}{$fonts.h2.color}{else}default{/if};
                --et-font-h2-xs: {$fonts.h2.sizes.xs}px;
                --et-font-h2-sm: {$fonts.h2.sizes.sm}px;
                --et-font-h2-md: {$fonts.h2.sizes.md}px;
                --et-font-h2-lg: {$fonts.h2.sizes.lg}px;
                --et-font-h2-xl: {$fonts.h2.sizes.xl}px;
                --et-font-h2-weight: {if in_array("bold", $fonts.h2.decorations)}bold{else}normal{/if};
                --et-font-h2-style: {if in_array("italic", $fonts.h2.decorations)}italic{else}normal{/if};
                --et-font-h2-decoration: {if in_array("underline", $fonts.h2.decorations)}underline{else}none{/if};
            {/if}
            {if isset($fonts.h3)}
                --et-font-h3-family: {if $fonts.h3.family}{if str_contains($fonts.h3.family, "'") || str_contains($fonts.h3.family, ',')}{$fonts.h3.family}{else}'{$fonts.h3.family}'{/if}{else}default{/if};
                --et-font-h3-color: {if $fonts.h3.color !== ''}{$fonts.h3.color}{else}default{/if};
                --et-font-h3-xs: {$fonts.h3.sizes.xs}px;
                --et-font-h3-sm: {$fonts.h3.sizes.sm}px;
                --et-font-h3-md: {$fonts.h3.sizes.md}px;
                --et-font-h3-lg: {$fonts.h3.sizes.lg}px;
                --et-font-h3-xl: {$fonts.h3.sizes.xl}px;
                --et-font-h3-weight: {if in_array("bold", $fonts.h3.decorations)}bold{else}normal{/if};
                --et-font-h3-style: {if in_array("italic", $fonts.h3.decorations)}italic{else}normal{/if};
                --et-font-h3-decoration: {if in_array("underline", $fonts.h3.decorations)}underline{else}none{/if};
            {/if}
            {if isset($fonts.h4)}
                --et-font-h4-family: {if $fonts.h4.family}{if str_contains($fonts.h4.family, "'") || str_contains($fonts.h4.family, ',')}{$fonts.h4.family}{else}'{$fonts.h4.family}'{/if}{else}default{/if};
                --et-font-h4-color: {if $fonts.h4.color !== ''}{$fonts.h4.color}{else}default{/if};
                --et-font-h4-xs: {$fonts.h4.sizes.xs}px;
                --et-font-h4-sm: {$fonts.h4.sizes.sm}px;
                --et-font-h4-md: {$fonts.h4.sizes.md}px;
                --et-font-h4-lg: {$fonts.h4.sizes.lg}px;
                --et-font-h4-xl: {$fonts.h4.sizes.xl}px;
                --et-font-h4-weight: {if in_array("bold", $fonts.h4.decorations)}bold{else}normal{/if};
                --et-font-h4-style: {if in_array("italic", $fonts.h4.decorations)}italic{else}normal{/if};
                --et-font-h4-decoration: {if in_array("underline", $fonts.h4.decorations)}underline{else}none{/if};
            {/if}
            {if isset($fonts.h5)}
                --et-font-h5-family: {if $fonts.h5.family}{if str_contains($fonts.h5.family, "'") || str_contains($fonts.h5.family, ',')}{$fonts.h5.family}{else}'{$fonts.h5.family}'{/if}{else}default{/if};
                --et-font-h5-color: {if $fonts.h5.color !== ''}{$fonts.h5.color}{else}default{/if};
                --et-font-h5-xs: {$fonts.h5.sizes.xs}px;
                --et-font-h5-sm: {$fonts.h5.sizes.sm}px;
                --et-font-h5-md: {$fonts.h5.sizes.md}px;
                --et-font-h5-lg: {$fonts.h5.sizes.lg}px;
                --et-font-h5-xl: {$fonts.h5.sizes.xl}px;
                --et-font-h5-weight: {if in_array("bold", $fonts.h5.decorations)}bold{else}normal{/if};
                --et-font-h5-style: {if in_array("italic", $fonts.h5.decorations)}italic{else}normal{/if};
                --et-font-h5-decoration: {if in_array("underline", $fonts.h5.decorations)}underline{else}none{/if};
            {/if}
            {if isset($fonts.h6)}
                --et-font-h6-family: {if $fonts.h6.family}{if str_contains($fonts.h6.family, "'") || str_contains($fonts.h6.family, ',')}{$fonts.h6.family}{else}'{$fonts.h6.family}'{/if}{else}default{/if};
                --et-font-h6-color: {if $fonts.h6.color !== ''}{$fonts.h6.color}{else}default{/if};
                --et-font-h6-xs: {$fonts.h6.sizes.xs}px;
                --et-font-h6-sm: {$fonts.h6.sizes.sm}px;
                --et-font-h6-md: {$fonts.h6.sizes.md}px;
                --et-font-h6-lg: {$fonts.h6.sizes.lg}px;
                --et-font-h6-xl: {$fonts.h6.sizes.xl}px;
                --et-font-h6-weight: {if in_array("bold", $fonts.h6.decorations)}bold{else}normal{/if};
                --et-font-h6-style: {if in_array("italic", $fonts.h6.decorations)}italic{else}normal{/if};
                --et-font-h6-decoration: {if in_array("underline", $fonts.h6.decorations)}underline{else}none{/if};
            {/if}
        }
    }
    {/if}
{/strip}

{strip}
    {if !empty($fonts.activeFonts)}
        {foreach $fonts.activeFonts as $font}
            {if !empty($font.loading) && $font.loading === 'manual' && !empty($font.styles)}
                {foreach $font.styles as $style}
                    @font-face {
                        font-display: swap;
                        font-family: {implode(',', $font.families)};
                        font-style: {if mb_substr($style, 0, 1) === 'n'}normal{else}italic{/if};
                        font-weight: {mb_substr($style, 1, 1)}00;
                        {if !empty($font.styleUrls[$style])}src: url('{$font.styleUrls[$style]}');{/if}
                    }
                {/foreach}
            {/if}
        {/foreach}
    {/if}
{/strip}