<!DOCTYPE html>
<html lang="{{ t.html_lang | default(locale | default('en')) }}" class="no-js">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {% if theme.favicon %}
    <link rel="icon" href="{{ base_path | default('') }}{{ theme.favicon }}">
    {% endif %}
    <title>{% block title %}{{ title | default(site.title) }}{% endblock %} - {{ site.title }}</title>
    <meta name="description" content="{{ t.meta_description | default(site.tagline | default('')) }}">
    <meta property="og:title" content="{{ title | default(site.title) }} - {{ site.title }}">
    <meta property="og:description" content="{{ t.meta_description | default(site.tagline | default('')) }}">
    <meta property="og:type" content="website">
    {% if theme.hero_image %}
    <meta property="og:image" content="{{ theme.hero_image }}">
    {% endif %}
    <meta property="og:locale" content="{{ t.html_lang | default(locale | default('en')) }}">
    <meta name="twitter:card" content="summary_large_image">
    <link rel="stylesheet" href="{{ base_path | default('') }}css/fonts.css">
    <link rel="stylesheet" href="{{ base_path | default('') }}css/terradoc.css">
    <script>document.documentElement.classList.remove('no-js');document.documentElement.classList.add('js');</script>
    <style>
        :root {
            --td-color-primary: {{ theme.colors.primary | default('#3D352F') }};
            --td-color-accent: {{ theme.colors.accent | default('#B7522C') }};
            --td-color-accent-muted: {{ theme.colors.accent_muted | default('#9A4427') }};
            --td-color-bg: {{ theme.colors.bg | default('#F9F6F2') }};
            --td-color-bg-light: {{ theme.colors.bg_light | default('#F5EDE8') }};
            --td-color-bg-infobox: {{ theme.colors.bg_infobox | default('#FAF8F5') }};
            --td-color-border: {{ theme.colors.border | default('#E8E4DF') }};
            --td-color-border-dark: {{ theme.colors.border_dark | default('#C8B8A8') }};
            --td-color-text: {{ theme.colors.text | default('#333333') }};
            --td-color-text-muted: {{ theme.colors.text_muted | default('#6B6B6B') }};
            --td-color-highlight: {{ theme.colors.highlight | default('#fff59d') }};
            --td-color-warning-bg: {{ theme.colors.warning_bg | default('#fff8e1') }};
            --td-color-surface: {{ theme.colors.surface | default('#FFFFFF') }};
            --td-color-border-light: {{ theme.colors.border_light | default('#EEEEEE') }};
            --td-color-text-secondary: {{ theme.colors.text_secondary | default('#555555') }};
            --td-color-accent-light: {{ theme.colors.accent_light | default('#FDF0EB') }};
            --td-color-success: {{ theme.colors.success | default('#5B8C5A') }};
            --td-color-error: {{ theme.colors.error | default('#CC0000') }};
            --td-color-accent-ring: {{ theme.colors.accent_ring | default('rgba(183, 82, 44, 0.2)') }};
            --td-radius: {{ theme.border_radius | default('28px') }};
            --td-color-dark: {{ theme.colors.dark | default('#0B0F17') }};
            --td-radius-lg: {{ theme.border_radius | default('28px') }};
            --td-radius-pill: 999px;
            --td-font-family: {{ theme.font_family | default("'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif") }};
            --td-font-headings: {{ theme.font_family_headings | default("'Sora', 'Inter', sans-serif") }};
            --td-font-mono: {{ theme.font_family_mono | default("'IBM Plex Mono', 'Consolas', monospace") }};
            --td-term-color: {{ theme.term_color or theme.colors.accent_muted | default('#A85D33') }};
            --td-term-weight: {{ theme.term_weight | default('600') }};
            --td-color-gold: {{ theme.colors.gold | default('#D4A03A') }};
        }
        {% if theme.colors_dark %}
        @media (prefers-color-scheme: dark) {
            :root {
                --td-color-primary: {{ theme.colors_dark.primary }};
                --td-color-accent: {{ theme.colors_dark.accent }};
                --td-color-accent-muted: {{ theme.colors_dark.accent_muted }};
                --td-color-bg: {{ theme.colors_dark.bg }};
                --td-color-bg-light: {{ theme.colors_dark.bg_light }};
                --td-color-bg-infobox: {{ theme.colors_dark.bg_infobox }};
                --td-color-border: {{ theme.colors_dark.border }};
                --td-color-border-dark: {{ theme.colors_dark.border_dark }};
                --td-color-text: {{ theme.colors_dark.text }};
                --td-color-text-muted: {{ theme.colors_dark.text_muted }};
                --td-color-highlight: {{ theme.colors_dark.highlight }};
                --td-color-warning-bg: {{ theme.colors_dark.warning_bg }};
                --td-color-surface: {{ theme.colors_dark.surface }};
                --td-color-border-light: {{ theme.colors_dark.border_light }};
                --td-color-text-secondary: {{ theme.colors_dark.text_secondary }};
                --td-color-accent-light: {{ theme.colors_dark.accent_light }};
                --td-color-success: {{ theme.colors_dark.success }};
                --td-color-error: {{ theme.colors_dark.error }};
                --td-color-accent-ring: {{ theme.colors_dark.accent_ring }};
            }
        }
        {% endif %}
        {% if theme.grain_pattern and theme.grain_pattern != "dots" %}
        {% if theme.grain_pattern == "lattice" %}
        .td-style-terra::before {
            background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='24' y2='24' stroke='%23B8AFA2' stroke-width='0.4' opacity='0.3'/%3E%3Cline x1='24' y1='0' x2='0' y2='24' stroke='%23B8AFA2' stroke-width='0.4' opacity='0.3'/%3E%3C/svg%3E");
        }
        {% elif theme.grain_pattern == "weave" %}
        .td-style-terra::before {
            background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='2' y='8' width='6' height='3' rx='1.5' fill='%23B8AFA2' opacity='0.2'/%3E%3Crect x='12' y='2' width='3' height='6' rx='1.5' fill='%23B8AFA2' opacity='0.2'/%3E%3C/svg%3E");
        }
        {% elif theme.grain_pattern == "none" %}
        .td-style-terra::before { background-image: none; }
        {% endif %}
        {% endif %}
        {% block extra_styles %}{% endblock %}
    </style>
</head>
<body class="td-style-{{ theme.style | default('terra') }}">
    <a href="#main-content" class="skip-link">{{ t.skip_link | default('Pular para conteúdo') }}</a>

    {% set np = nav_prefix | default('') %}
    <nav id="td-nav" aria-label="{{ t.nav_label | default('Navegação principal') }}">
        <div class="td-nav-inner">
            <a href="{{ np }}index.html" class="brand">
                {% if theme.logo %}
                <img src="{{ base_path | default('') }}{{ theme.logo }}" alt="" class="brand-logo">
                {% else %}
                <span class="td-logo-mark" aria-hidden="true"><span class="ring-outer"><span class="ring-inner"><span class="ring-dot"></span></span></span></span>
                {% endif %}
                <span>{{ t.nav_brand | default(site.title) }}</span>
            </a>
            <button class="nav-toggle" aria-label="{{ t.nav_menu_label | default('Menu') }}" aria-expanded="false">&#9776;</button>
            <div class="nav-links">
                {% for mod in modules %}
                <a href="{{ np }}{{ mod.slug }}.html"{% if page == mod.slug %} class="active" aria-current="page"{% endif %}>{{ t['nav_' + mod.slug] | default(mod.name) }}</a>
                {% endfor %}
                <a href="{{ np }}about.html"{% if page == 'about' %} class="active" aria-current="page"{% endif %}>{{ t.nav_about | default('About') }}</a>
            </div>
            {% if locale_switches and locale_switches | length > 1 %}
            <div class="lang-switch" aria-label="{{ t.lang_switch_label | default('Language selector') }}">
                {% for switch in locale_switches %}
                    {% if not loop.first %}<span class="lang-sep">/</span>{% endif %}
                    {% if switch.is_current %}
                    <span class="lang-current" aria-current="true">{{ switch.code | default(switch.label) | upper }}</span>
                    {% else %}
                    <a href="{{ switch.href }}" class="lang-link">{{ switch.code | default(switch.label) | upper }}</a>
                    {% endif %}
                {% endfor %}
            </div>
            {% endif %}
        </div>
    </nav>

    <main id="main-content" class="td-container">
        {% block content %}{% endblock %}
    </main>

    <footer>
        <div class="footer-adugo-spine" aria-hidden="true">
            {% if theme.hero_divider and theme.hero_divider != "none" %}
            {% include "hero/hero_divider_" + theme.hero_divider + ".html.j2" ignore missing %}
            {% endif %}
        </div>
        <div class="td-container">
            <div class="footer-grid">
                <div class="footer-brand-col">
                    <a href="{{ np }}index.html" class="brand" style="color:white;text-decoration:none;font-family:var(--td-font-headings);font-weight:700;font-size:1.15rem;display:inline-flex;align-items:center;gap:0.6rem;">
                        {% if theme.logo %}
                        <img src="{{ base_path | default('') }}{{ theme.logo }}" alt="" class="brand-logo" style="width:56px;height:56px;">
                        {% else %}
                        <span class="td-logo-mark" aria-hidden="true" style="--td-color-primary:#fff;"><span class="ring-outer"><span class="ring-inner"><span class="ring-dot"></span></span></span></span>
                        {% endif %}
                        {{ t.nav_brand | default(site.title) }}
                    </a>
                    <p class="footer-brand-desc">{{ t.footer_description | default('') }}</p>
                </div>
                <div>
                    <h4 class="footer-heading">{{ t.footer_nav_heading | default('Navigation') }}</h4>
                    <ul class="footer-links">
                        {% for mod in modules %}
                        <li><a href="{{ np }}{{ mod.slug }}.html">{{ t['nav_' + mod.slug] | default(mod.name) }}</a></li>
                        {% endfor %}
                        <li><a href="{{ np }}about.html">{{ t.nav_about | default('About') }}</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="footer-heading">{{ t.footer_contact_heading | default('Contact') }}</h4>
                    {% if t.footer_email %}
                    <div class="footer-contact-item">
                        <span class="footer-contact-icon">&#9993;</span>
                        <a href="mailto:{{ t.footer_email }}">{{ t.footer_email }}</a>
                    </div>
                    {% endif %}
                    {% if t.footer_location %}
                    <div class="footer-contact-item">
                        <span class="footer-contact-icon">&#9906;</span>
                        <span>{{ t.footer_location }}</span>
                    </div>
                    {% endif %}
                </div>
            </div>
            <div class="footer-bottom">
                <p>{{ t.footer_generated | default('Generated with') }} <a href="https://pypi.org/project/terradoc/">terradoc</a>, <a href="https://pypi.org/project/aptoro/">aptoro</a> &amp; <a href="https://pypi.org/project/kodudo/">kodudo</a></p>
                <p>{{ t.footer_license | default('') }}</p>
            </div>
        </div>
    </footer>

    <script src="{{ base_path | default('') }}js/common.js"></script>
    {% block scripts %}{% endblock %}
</body>
</html>
