<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{relay_name}</title>
    <style>
        {base_css}
        .hero {{
            height: 100vh;
            padding: 4rem 24px 3rem;
            text-align: center;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            position: relative;
        }}
        .hero-content {{
            max-width: 720px;
            width: 100%;
        }}
        .header {{
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 16px;
            margin-bottom: 24px;
        }}
        .relay-icon {{
            width: 48px;
            height: 48px;
            max-width: 48px;
            max-height: 48px;
            object-fit: contain;
            border-radius: 8px;
        }}
        h1 {{
            font-size: 2rem;
            font-weight: 600;
            letter-spacing: -0.02em;
        }}
        .subtitle {{
            color: var(--text-muted);
            font-size: 1.125rem;
        }}
        .scroll-indicator {{
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
        }}
        .scroll-down {{
            display: flex;
            flex-direction: column;
            align-items: center;
            animation: float 2s ease-in-out infinite;
            text-decoration: none;
        }}
        .scroll-text {{
            font-size: 0.8rem;
            opacity: 0.7;
            margin-bottom: 4px;
        }}
        @keyframes float {{
            0%, 100% {{
                transform: translateY(0);
            }}
            50% {{
                transform: translateY(-8px);
            }}
        }}
        .scroll-down svg {{
            fill: none;
            stroke: currentColor;
            opacity: 0.8;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
        }}
        .scroll-down:hover svg {{
            opacity: 1;
            transform: scale(1.2);
            stroke-width: 2.5;
        }}
        .scroll-down:hover .scroll-text {{
            opacity: 1;
        }}
        .container {{
            max-width: 720px;
            margin: 0 auto;
            padding: 80px 24px;
        }}
        .section {{
            margin-bottom: 40px;
        }}
        .section-title {{
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--brand);
            margin-bottom: 16px;
        }}
        .card {{
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 20px;
        }}
        .card + .card {{
            margin-top: 12px;
        }}
        .card-title {{
            font-weight: 500;
            margin-bottom: 4px;
        }}
        .card-desc {{
            color: var(--text-muted);
            font-size: 0.875rem;
        }}
        .badge {{
            display: inline-block;
            background: var(--brand);
            color: white;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: 500;
            margin-right: 8px;
        }}
        .badge-nip {{
            background: var(--success);
        }}
        code {{ padding: 2px 8px; }}
        .tag-container {{
            margin: 16px 0;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
            justify-content: center;
        }}
        .tag-label {{
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-right: 4px;
        }}
        .tag {{
            display: inline-block;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 500;
        }}
        .tag-grasp {{
            background: rgba(68, 52, 255, 0.15);
            color: var(--brand-light);
            border: 1px solid rgba(68, 52, 255, 0.3);
        }}
        .tag-nip {{
            background: rgba(34, 197, 94, 0.15);
            color: var(--success);
            border: 1px solid rgba(34, 197, 94, 0.3);
        }}
        .browse-link {{
            display: inline-block;
            background: var(--brand);
            color: white;
            padding: 14px 24px;
            border-radius: 8px;
            font-weight: 500;
            font-size: 1rem;
            margin: 32px 0;
            transition: background 0.2s;
        }}
        .browse-link:hover {{
            background: var(--brand-light);
            text-decoration: none;
        }}
        /* Relay Information Document table styles */
        .info-table {{
            width: 100%;
            border-collapse: collapse;
            font-size: 0.875rem;
        }}
        .info-table th {{
            text-align: left;
            padding: 8px 12px;
            color: var(--text-muted);
            font-weight: 500;
            width: 140px;
            vertical-align: top;
            border-bottom: 1px solid var(--border);
        }}
        .info-table td {{
            padding: 8px 12px;
            color: var(--text);
            border-bottom: 1px solid var(--border);
            word-break: break-all;
        }}
        .info-table tr:last-child th,
        .info-table tr:last-child td {{
            border-bottom: none;
        }}
        .info-table a {{
            color: var(--brand-light);
        }}
        .info-table code {{
            font-size: 0.75rem;
        }}
        .footer {{ margin-top: 64px; }}
        .footer-separator {{ margin: 0 0.5em; opacity: 0.5; }}
    </style>
</head>
<body>
    {theme_toggle}
    <header class="hero">
        <div class="hero-content">
            <div class="header">
                {relay_icon}
                <h1>{relay_name}</h1>
            </div>
            
            <p class="subtitle">{relay_description}</p>
            
            <a id="browse-link" href="https://gitworkshop.dev" class="browse-link" target="_blank">
                Browse Repositories on GitWorkshop.dev &rarr;
            </a>

            <div class="tag-container" style="margin-bottom: 8px;">
                <span class="tag-label">Curation:</span>
                <span class="tag-label">{curation}</span>
            </div>

            <div class="tag-container" style="margin-bottom: 12px;">
                <span class="tag-label">Repo Acceptance Criteria:</span>
                <span class="tag-label" style="max-width: 600px; text-align: center;">{repo_acceptance_criteria}</span>
            </div>

            <div class="tag-container" style="margin-top: 12px;">
                <span class="tag-label">Supports:</span>
                {hero_tags}
            </div>

            
            <div class="card">
                <div class="software-box">
                    <svg class="software-logo" viewBox="0 0 38 38" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <rect width="38" height="38" rx="12" fill="#4434FF"/>
                        <path d="M10.6731 30.6348C8.83687 30.6346 7.34885 29.1458 7.34885 27.3096C7.34891 26.2473 7.84783 25.303 8.62326 24.6943C8.21265 23.3055 7.86571 22.049 7.45334 20.6758C6.90247 18.8412 7.4492 16.8197 8.93576 15.5605L15.7512 9.78906C15.6931 9.54286 15.6614 9.28642 15.6613 9.02246C15.6613 7.51617 16.6628 6.24465 18.0363 5.83594L18.0363 -1.11215e-06C18.511 0.000462658 18.4612 0.000975391 18.9856 0.000975533C19.5102 0.000975578 19.5802 -1.11589e-06 19.9367 -9.46012e-07L19.9367 5.83594C21.3097 6.24503 22.3108 7.5166 22.3108 9.02246C22.3107 9.29118 22.2792 9.55249 22.219 9.80273L29.0783 15.6123C30.5229 16.8359 31.1022 18.8013 30.5539 20.6133L29.3254 24.6758C30.1142 25.2837 30.6232 26.2367 30.6233 27.3096C30.6233 29.1459 29.1344 30.6348 27.2981 30.6348C25.4619 30.6346 23.9738 29.1458 23.9738 27.3096C23.974 25.4734 25.4619 23.9846 27.2981 23.9844C27.3814 23.9844 27.4643 23.9891 27.5461 23.9951L28.7356 20.0625C29.0645 18.9753 28.7166 17.7966 27.8498 17.0625L21.2424 11.4648C20.8746 11.8048 20.4294 12.0622 19.9367 12.209L19.9367 18.9258C21.0425 19.3175 21.836 20.3694 21.8362 21.6094C21.8362 23.1834 20.5596 24.46 18.9856 24.46C17.4117 24.4598 16.136 23.1833 16.136 21.6094C16.1361 20.3689 16.93 19.3172 18.0363 18.9258L18.0363 12.21C17.5395 12.0622 17.0916 11.801 16.7219 11.457L10.1643 17.0107C9.27919 17.7605 8.93068 18.9867 9.27365 20.1289C9.68708 21.5056 10.0175 22.7009 10.3986 23.998C10.4892 23.9906 10.5806 23.9844 10.6731 23.9844C12.5093 23.9844 13.9981 25.4733 13.9983 27.3096C13.9983 29.1459 12.5094 30.6348 10.6731 30.6348Z" fill="white"/>
                    </svg>
                    <div class="software-content">
                        <h3 class="software-heading"><a href="https://gitworkshop.dev/danconwaydev.com/ngit-grasp">Grasp Server</a> Powered by <a href="https://gitworkshop.dev/danconwaydev.com/ngit-grasp">ngit-grasp</a> ({nip11_version})</h3>
                        <p class="software-desc">Git hosting distributed across relays using Nostr for authorization. <a href="https://ngit.dev/grasp">Find out more...</a></p>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="scroll-indicator">
            <a href="#content" class="scroll-down" aria-label="Scroll to content">
                <span class="scroll-text">SCROLL</span>
                <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <polyline points="7 13 12 18 17 13"></polyline>
                    <polyline points="7 6 12 11 17 6"></polyline>
                </svg>
            </a>
        </div>
    </header>
    
    <main class="container" id="content">
        <div class="section">
            <div class="section-title">Supported GRASPs</div>
            {grasp_cards}
        </div>
        
        <div class="section">
            <div class="section-title">Supported NIPs</div>
            {nip_cards}
        </div>
        
        <div class="section">
            <div class="section-title">Relay Information Document</div>
            <div class="card">
                <table class="info-table">
                    {relay_info_rows}
                </table>
            </div>
        </div>
        
        <div class="footer">
            <span id="footer-domain"></span><span class="footer-separator">•</span>powered by <a href="https://gitworkshop.dev/danconwaydev.com/ngit-grasp"><strong>ngit-grasp</strong></a><span class="footer-separator">•</span>{version}<span class="footer-separator">•</span>MIT Licensed
        </div>
    </main>
    <script>
        // Detect protocol and construct gitworkshop relay link
        const protocol = window.location.protocol; // 'http:' or 'https:'
        const host = window.location.host; // 'domain.com' or 'domain.com:port'
        
        // For http, use ws:// prefix and URL encode; for https, just use host (implies wss://)
        let relayref = host;
        if (protocol === 'http:') relayref = encodeURIComponent("ws://" + host);
        
        // Update the browse link to point to the relay on gitworkshop
        const browseLink = document.getElementById('browse-link');
        browseLink.setAttribute('href', 'https://gitworkshop.dev/relay/' + relayref);
        
        // Set footer domain
        var footerDomain = document.getElementById('footer-domain');
        if (footerDomain) {{
            footerDomain.textContent = host;
        }}
    </script>
    {theme_script}
</body>
</html>