{# Standard Button Fields #}
{% set theTitle = '' %}
{% set theButtonText = '' %}
{% set theDescription = '' %}
{% set theId = '' %}
{% set theName = '' %}
{% set theLink = '' %}
{% set theScrollTo = '' %}
{% set theNewTab = '' %}
{% set theDownload = '' %}
{% set theGtmClasses = '' %}
{% set theTheme = '' %}
{% set theDataAttr = '' %}
{% set theType = '' %}
{% set theValue = '' %}

{# Additional Custom Fields #}
{% set theIcon = '' %}
{% set theLoadingIcon = '' %}
{% set theAddedClasses = '' %}

{% if title is defined and title | length %}
    {% set theTitle = title %}
{% endif %}
{% if buttonText is defined and buttonText | length %}
    {% set theButtonText = buttonText %}
{% endif %}
{% if description is defined and description | length %}
    {% set theDescription = description %}
{% else %}
    {% set theDescription = theTitle %}
{% endif %}
{% if id is defined and id | length %}
    {% set theId = id %}
{% endif %}
{% if name is defined and name | length %}
    {% set theName = name %}
{% endif %}
{% if href is defined and href | length %}
    {% set theLink = href %}
{% endif %}
{% if scrollTo is defined and scrollTo | length %}
    {% set theScrollTo = scrollTo %}
{% endif %}
{% if newTab is defined and newTab | length %}
    {% set theNewTab = newTab %}
{% endif %}
{% if download is defined and download | length %}
    {% set theDownload = download %}
{% endif %}
{% if gtmClasses is defined and gtmClasses | length %}
    {% set theGtmClasses = gtmClasses %}
{% endif %}
{% if theme is defined and theme | length %}
    {% set theTheme = theme %}
{% endif %}
{% if dataAttr is defined and dataAttr | length %}
    {% set theDataAttr = dataAttr %}
{% endif %}
{% if type is defined and type | length %}
    {% set theType = type %}
{% endif %}
{% if value is defined and value | length %}
    {% set theValue = value %}
{% endif %}
{% if customIcon is defined and customIcon | length %}
    {% set theIcon = customIcon %}
{% endif %}
{% if customLoadingIcon is defined and customLoadingIcon | length %}
    {% set theLoadingIcon = customLoadingIcon %}
{% endif %}
{% if addClasses is defined and addClasses | length %}
    {% set theAddedClasses = addClasses %}
{% endif %}

{# Check button type - Can be internal-link, external-link, download or std (standard) #}
{% set theButtonType = buttonType is defined ? buttonType : 'std' %}

{# Standard button classes #}
{% set standardButtonClasses = 'w-full xs:w-auto flex flex-row justify-center items-center text-center whitespace-nowrap font-body font-regular transition-colors duration-700 border-2 border-solid group' %}
{% set standardFocusClasses = 'focus:border-brand-terracotta-i active:border-brand-terracotta-i focus:ring-2 focus:ring-brand-terracotta-i active:ring-2 active:ring-brand-terracotta-i' %}

{# Theme settings #}
{% if theTheme == 'primary' %}
    {% set theme = 'button-primary bg-brand-terracotta-aa text-white border-transparent xs:hover:bg-brand-cream-i xs:hover:text-brand-gray-i' %}
{% elseif theTheme == 'secondary' %}
    {% set theme = 'button-secondary bg-brand-cream-i text-brand-gray-i border-transparent xs:hover:bg-brand-crimson-i xs:hover:text-black' %}
{% elseif theTheme == 'tertiary' %}
    {% set theme = 'button-tertiary bg-white text-brand-gray-i border-transparent xs:hover:bg-brand-terracotta-aa xs:hover:text-white' %}
{% elseif theTheme == 'quaternary' %}
    {% set theme = 'button-quaternary bg-transparent text-white border-white xs:hover:bg-white-primary/5' %}
{% elseif theTheme == 'quinary' %}
    {% set theme = 'button-quinary bg-transparent text-black-primary border-black-primary !border xs:hover:bg-black-primary/5 xs:hover:text-black xs:hover:border-black' %}
{% elseif theTheme == 'senary' %}
    {% set theme = 'button-senary bg-transparent text-brand-terracotta-aa border-brand-terracotta-aa xs:hover:bg-brand-terracotta-aa/5' %}
{% elseif theTheme == 'septenary' %}
    {% set theme = 'button-septenary bg-brand-cream-viii text-black-primary border-transparent xs:hover:bg-brand-terracotta-aa/5' %}
{% elseif theTheme == 'octonary' %}
    {% set theme = 'button-septenary bg-mintyy-gray-i text-black-primary border-transparent xs:hover:bg-brand-terracotta-aa/5' %}
{% elseif theTheme == 'nonary' %}
    {% set theme = 'button-septenary bg-mintyy-gray-vii text-white-pure border-transparent xs:hover:bg-brand-terracotta-aaa' %}
{% else %}
    {% set theme = 'button-default bg-brand-terracotta-aa text-white border-transparent xs:hover:bg-brand-crimson-i xs:hover:text-brand-gray-i' %}
{% endif %}

{# Button size settings #}
{% if buttonSize is defined and buttonSize | length %}
    {% set size = buttonSize %}
{% endif %}

{% set sizes = 'px-8 py-4 text-lg' %}
{% if size is defined and size == 'small' %}
    {% set sizes = 'px-6 py-3 text-base' %}
{% endif %}

{# Border settings #}
{% set borderClasses = 'rounded-lg' %}
{% if borderRadius is defined and borderRadius %}
    {% set borderClasses = 'rounded-full' %}
{% endif %}

{# Custom additional classes settings #}
{% if addCustomClasses is defined and addCustomClasses | length %}
    {% set theAddedClasses = theAddedClasses ~ ' ' ~ addCustomClasses %}
{% endif %}


{# -- The Button -- #}

{% if theButtonType == "internal-link" %}
    {% include themeDir ~ '/_includes/_modules/_buttons/_button-internal-link' %}
{% elseif theButtonType == "external-link" %}
    {% include themeDir ~ '/_includes/_modules/_buttons/_button-external-link' %}
{% elseif theButtonType == "download" %}
    {% include themeDir ~ '/_includes/_modules/_buttons/_button-download' %}
{% else %}
    {% include themeDir ~ '/_includes/_modules/_buttons/_button-std' %}
{% endif %}
