<!DOCTYPE html>
<html lang="{{ language }}">
<head>

    {% block head %}
        <meta charset="{{ charset }}">
        <title>{{ title }}</title>
        <base href="{{ base }}">

        {% block meta %}
            <meta name="robots" content="{{ robots|default }}">
            <meta name="description" content="{{ description }}">
            <meta name="generator" content="Contao Open Source CMS">
            <meta name="viewport" content="width=device-width, initial-scale=1">
            {% set pageModel = app.request.attributes.get('pageModel') %}
            {% if pageModel %}
                <link rel="canonical"
                      href="{{ content_url(pageModel, {'_locale': pageModel.rootLanguage}) }}">
                {% for locale, prefix in constant('Ferienpass\\CmsBundle\\Routing\\LocaleRouteProviderDecorator::MAP') %}
                    <link rel="alternate" hreflang="{{ locale }}"
                          href="{{ content_url(pageModel, {'_locale': locale}) }}">
                {% endfor %}
            {% endif %}
            <link rel="apple-touch-icon" sizes="180x180"
                  href="{{ asset('favicon/apple-touch-icon.png', 'ferienpass_core') }}">
            <link rel="icon" type="image/png" sizes="32x32"
                  href="{{ asset('favicon/favicon-16x16.png', 'ferienpass_core') }}">
            <link rel="icon" type="image/png" sizes="16x16"
                  href="{{ asset('favicon/favicon-16x16.png', 'ferienpass_core') }} ?>">
            <link rel="manifest" href="{{ asset ('favicon/site.webmanifest', 'ferienpass_core') }}">
            <link rel="mask-icon" href="{{ asset('favicon/safari-pinned-tab.svg', 'ferienpass_core') }}"
                  color="#209bc9">
            <link rel="shortcut icon" href="{{ asset('favicon/favicon.ico', 'ferienpass_core') }}">
            <meta name="msapplication-TileColor" content="#2d89ef">
            <meta name="msapplication-config" content="{{ asset('favicon/browserconfig.xml', 'ferienpass_core') }}">
            <meta name="theme-color" content="#209bc9">
        {% endblock %}

        {% block javascripts %}
            <link rel="stylesheet" href="{{ asset ('css/www.tailwind.css') }}">

            {# Per-tenant brand color (PageConfig): re-derives the full --color-primary-50…900
               Tailwind scale at runtime — no custom build needed. #}
            {{ brand_color_css(page_config().colorPrimary) }}

            {{ importmap('www') }}
            {% if app.request.attributes.get('plausible') %}
                <script async src="/js/script.js"></script>
                <script>
                    window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
                    plausible.init({
                        endpoint: "/api/event"
                    })
                </script>
            {% endif %}
        {% endblock %}

        {{ head|default }}
    {% endblock %}

</head>
<body id="top" itemscope itemtype="http://schema.org/WebPage" class="{% block bodyClass %}bg-[color:var(--bg-body)] dark:bg-gray-900{% endblock %}">

{% block body %}

    {% if 'staging' == app.environment %}
        <div class="bg-red-600 dark:bg-red-500/20 px-6 py-2.5 sm:px-3.5 sm:before:flex-1">
            <p class="text-sm leading-6 text-white dark:text-red-400 text-center">
                <strong class="font-semibold">{{ 'stagingEnvironment.strong'|trans({}, 'cms') }}</strong> {{ 'stagingEnvironment.text'|trans({}, 'cms') }}
            </p>
        </div>
    {% endif %}

    {% if app.request.attributes.get('_machine_translated') and app.request.attributes.get('_route') %}
        <div class="bg-blue-600 dark:bg-blue-500/20 px-6 py-2.5 sm:px-3.5 sm:before:flex-1">
            <p class="text-sm leading-6 text-white dark:text-blue-400 text-center">
                <span class="font-semibold">{{ 'machineTranslated.strong'|trans({}, 'cms') }}</span>
                {{ 'machineTranslated.legalNotice'|trans({}, 'cms') }}
                <a href="{{ content_url(app.request.attributes.get('pageModel'), {'_locale': app.request.attributes.get('pageModel').rootLanguage}, true) }}"
                   class="underline ml-2">{{ 'machineTranslated.toGerman'|trans({}, 'cms') }}</a>
            </p>
        </div>
    {% endif %}

    <div id="flash-banners"></div>

    <div id="wrapper">

        {% block header %}
            {% if header|default %}
                <header id="header">
                    <div class="inside">
                        {{ header|raw }}
                    </div>
                </header>
            {% endif %}
        {% endblock %}

        {% block container %}
            <div id="container">

                {% block main %}
                    <main id="main" class="">
                        <div class="inside">
                            {{ main|raw }}
                        </div>
                    </main>
                {% endblock %}
            </div>
        {% endblock %}

        {% block footer %}
            {% if footer|default %}
                <footer id="footer">
                    <div class="inside">
                        {{ footer|raw }}
                    </div>
                </footer>
            {% endif %}
        {% endblock %}

    </div>

    <twig:Cms:Notifications/>
    <twig:Cms:Modal/>

{% endblock %}

</body>
</html>