<!DOCTYPE html>
<html lang="{{ .Site.Language }}">
<head>
    <title>{{ if not .IsHome }}{{ .Title | title }} | {{ end }}{{ .Site.Title }}</title>
    <link rel="canonical" href="{{ .Site.BaseURL }}">
    <link rel='alternate' type='application/rss+xml' title="{{ .Site.Title }} RSS" href='/index.xml'>
    <link rel='stylesheet' type='text/css' href='/style.css'>
    {{ with .Site.Params.favicon }}<link rel="icon" href="{{ . }}">{{ end -}}
    <meta name="description" content="{{ with .Params.description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}">
    {{ if isset .Params "tags" }}<meta name="keywords" content="{{ with .Params.tags }}{{ delimit . ", " }}{{ end }}">{{ end -}}
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="index, follow">
    <meta charset="utf-8">
</head>
<body>
    <!-- Left Banner -->
    <div class="banner-left"></div>
    
    <!-- Main Content Wrapper -->
    <div class="content-wrapper">
        {{ if .Site.Menus.main }}{{ partial "nav.html" . }}{{ end -}}
        
        <!-- Main Content Area -->
        <main>
            <header><h1 id="tag_{{ .Title }}">{{ block "title" . }}{{ end }}</h1></header>
            <article>
                {{ block "main" . }}
                    {{ .Content }}
                {{ end }}
            </article>
        </main>
        
        <!-- Language Switcher Footer -->
	<footer class="language-switcher">
  {{ $currentLang := .Site.Language.Lang }}
  {{ $pageLang := .Language.Lang }}
  {{ $translations := .Translations }}

  {{ range .Site.Languages }}
    {{ if eq .Lang $currentLang }}
      <span class="flag active">{{ if eq .Lang "en" }}🇬🇧{{ else }}🇷🇺{{ end }}</span>
    {{ else }}
      {{ $translation := index (where $translations "Lang" .Lang) 0 }}
      <a href="{{ if $translation }}{{ $translation.Permalink }}{{ else }}{{ .Lang | relURL }}{{ end }}" class="flag">
        {{ if eq .Lang "en" }}🇬🇧{{ else }}🇷🇺{{ end }}
      </a>
    {{ end }}
  {{ end }}
</footer>
    </div>
    
    <!-- Right Banner -->
    <div class="banner-right"></div>
</body>
</html>
