<!DOCTYPE html>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{htmlEscape .Title}}</title>
    <meta name="description" content="{{htmlEscape .Description}}">
    <link rel="canonical" href="{{htmlEscape .Canonical}}">
    <script type="application/ld+json">{{safe .Schema}}</script>
    <style>
        :root { --primary: #2c3e50; --secondary: #3498db; --bg: #f9f9f9; --text: #333; }
        body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; margin: 0; background: #111; color: white; }
        .container { padding: 40px; }
        h1 { font-weight: 200; letter-spacing: 2px; text-align: center; margin-bottom: 20px; text-transform: uppercase; }
        .intro { max-width: 800px; margin: 0 auto 50px; text-align: center; color: #aaa; font-style: italic; }
        .related-box { margin-top: 50px; padding: 30px; background: #fff; border-radius: 12px; border: 1px solid #eee; }
        .related-box h4 { color: var(--primary); margin-bottom: 20px; font-size: 1.4rem; border-bottom: 2px solid var(--secondary); display: inline-block; padding-bottom: 5px; }
    </style>
    {{safe .InjectHeader}}
</head>
<body>
    <div class="container">
        <h1>{{htmlEscape .Title}}</h1>
        {{if .InjectAds}}<div style="text-align:center; margin:20px 0;">{{safe .InjectAds}}</div>{{end}}
        <p class="intro">{{htmlEscape .Description}}</p>
            <div class="ai-article-section" style="max-width: 800px; margin: 0 auto 50px; color: #eee; line-height: 1.8;">
                {{renderCompleteArticle .AIBlocks .Images .InjectAds "gallery"}}
            </div>
        {{if .InjectAds}}<div class="ads-container" style="text-align:center; margin-bottom:30px;">{{safe .InjectAds}}</div>{{end}}
        {{if .HasRelated}}
        <div class="related-box">
            <h4>Related Articles</h4>
            <ul class="related-list" style="list-style:none; padding:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:15px;">
                {{range .RelatedArticles}}
                <li><a href="{{htmlEscape .Slug}}.html" style="color:var(--secondary); text-decoration:none; padding:10px; background:#333; border-radius:6px; display:block;">{{htmlEscape .Keyword}}</a></li>
                {{end}}
            </ul>
        </div>
        {{end}}
    </div>
    {{safe .InjectFooter}}
</body>
</html>