{{- $themevariants := slice | append (.Site.Params.themeVariant | default "auto") -}}
{{- $themevariantsauto := slice | append (.Site.Params.themeVariantAuto | default slice) -}}
{{- $i := 0 -}}
{{- if eq (int (len $themevariantsauto)) 0 -}}
	{{- range $themevariants -}}
		{{- $i = add $i 1 -}}
		{{- if ne . "auto" -}}
			{{- $themevariantsauto = $themevariantsauto | append . -}}
			{{- break -}}
		{{- end -}}
	{{- end -}}
{{- end -}}
{{- if eq (int (len $themevariantsauto)) 0 -}}
	{{- $themevariantsauto = $themevariantsauto | append "relearn-light" -}}
{{- end -}}
{{- if eq (int (len $themevariantsauto)) 1 -}}
	{{- $poppedthemevariants := last (sub (len $themevariants) $i) $themevariants -}}
	{{- range $poppedthemevariants -}}
		{{- if ne . "auto" -}}
			{{- $themevariantsauto = $themevariantsauto | append . -}}
			{{- break -}}
		{{- end -}}
	{{- end -}}
{{- end -}}
{{- if eq (int (len $themevariantsauto)) 1 -}}
	{{- $themevariantsauto = $themevariantsauto | append "relearn-dark" -}}
{{- end -}}
{{- $themevariantsauto = ($themevariantsauto | first 2) -}}
{{- with index $themevariantsauto 0 -}}
	{{- if site.IsServer -}}
@import "{{(printf "css/theme-%s.css" .) | relURL}}" screen and (prefers-color-scheme: light);
	{{- else -}}
@import "{{(printf "theme-%s.css" .)}}" screen and (prefers-color-scheme: light);
	{{- end -}}
{{- end -}}
{{- with index $themevariantsauto 1 -}}
	{{- if site.IsServer }}
@import "{{(printf "css/theme-%s.css" .) | relURL}}" screen and (prefers-color-scheme: dark);
	{{- else }}
@import "{{(printf "theme-%s.css" .)}}" screen and (prefers-color-scheme: dark);
	{{- end -}}
{{- end -}}
