<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Reddit Analyzer - GPT-5 Data API</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
            line-height: 1.6;
            color: #333;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background: #f8fafc;
        }
        .container {
            background: white;
            padding: 40px;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .header {
            text-align: center;
            margin-bottom: 40px;
        }
        .logo {
            font-size: 2.5rem;
            font-weight: 700;
            color: #2563eb;
            margin-bottom: 10px;
        }
        .subtitle {
            color: #64748b;
            font-size: 1.1rem;
        }
        .status {
            display: inline-block;
            background: #10b981;
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.9rem;
            font-weight: 500;
            margin: 20px 0;
        }
        .section {
            margin: 30px 0;
        }
        .section h2 {
            color: #1e293b;
            border-bottom: 2px solid #e2e8f0;
            padding-bottom: 10px;
        }
        .code-block {
            background: #1e293b;
            color: #e2e8f0;
            padding: 20px;
            border-radius: 8px;
            font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
            font-size: 0.9rem;
            line-height: 1.4;
            overflow-x: auto;
        }
        .url-list {
            background: #f1f5f9;
            border-left: 4px solid #3b82f6;
            padding: 15px 20px;
            margin: 15px 0;
        }
        .url-list a {
            color: #2563eb;
            text-decoration: none;
            font-family: monospace;
        }
        .url-list a:hover {
            text-decoration: underline;
        }
        .note {
            background: #fef3c7;
            border: 1px solid #f59e0b;
            padding: 15px;
            border-radius: 8px;
            margin: 20px 0;
        }
        .note strong {
            color: #92400e;
        }
        footer {
            text-align: center;
            margin-top: 40px;
            padding-top: 20px;
            border-top: 1px solid #e2e8f0;
            color: #64748b;
            font-size: 0.9rem;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <div class="logo">📊 Reddit Analyzer</div>
            <div class="subtitle">GPT-5 Compatible Data API</div>
            <div class="status">✅ Active</div>
        </div>

        <div class="section">
            <h2>🎯 Purpose</h2>
            <p>This subdomain serves static JSON bundles optimized for GPT-5 consumption. Each Reddit thread is processed into multiple slices for efficient AI analysis without authentication barriers.</p>
        </div>

        <div class="section">
            <h2>📋 URL Structure</h2>
            <div class="code-block">https://data.claritydesk.app/v1/threads/{threadId}/
├── overview.json        # Thread metadata & slice directory (~1KB)
├── critical-path.json   # Highest-value comment chain (~5KB)
├── top-50.json         # Top comments by score (~20KB)
└── op-replies.json     # All OP responses (~variable)</div>
        </div>

        <div class="section">
            <h2>🔗 Example Thread Data</h2>
            <div class="url-list">
                <strong>Sample Thread (NFL RedZone):</strong><br>
                <a href="/v1/threads/thr_AvnmjK2Nmghw5AaVoV67i/overview.json">→ overview.json</a><br>
                <a href="/v1/threads/thr_AvnmjK2Nmghw5AaVoV67i/critical-path.json">→ critical-path.json</a><br>
                <a href="/v1/threads/thr_AvnmjK2Nmghw5AaVoV67i/top-50.json">→ top-50.json</a><br>
                <a href="/v1/threads/thr_AvnmjK2Nmghw5AaVoV67i/op-replies.json">→ op-replies.json</a>
            </div>
        </div>

        <div class="section">
            <h2>🤖 GPT-5 Usage Pattern</h2>
            <div class="code-block"># Reddit Thread Analysis (Skeleton)

Thread: [Your Thread Title] (r/subreddit)
Reddit: https://reddit.com/...

One-Click Data (public, no auth):
- Overview (open first): https://data.claritydesk.app/v1/threads/{id}/overview.json
- Critical Path: https://data.claritydesk.app/v1/threads/{id}/critical-path.json
- Top-50 by Score: https://data.claritydesk.app/v1/threads/{id}/top-50.json
- OP Replies: https://data.claritydesk.app/v1/threads/{id}/op-replies.json

Notes:
- Comment IDs are stable (e.g., c0..cN).
- Please read overview.json first, then critical-path.json if needed.</div>
        </div>

        <div class="section">
            <h2>⚡ Technical Specs</h2>
            <ul>
                <li><strong>CORS:</strong> Wide-open (<code>*</code>) for AI model access</li>
                <li><strong>Content-Type:</strong> <code>application/json; charset=utf-8</code></li>
                <li><strong>Caching:</strong> Immutable content, 24hr edge cache</li>
                <li><strong>No Auth:</strong> Public static files, no tokens required</li>
                <li><strong>Size Limits:</strong> Each bundle ≤ 2MB for model efficiency</li>
            </ul>
        </div>

        <div class="note">
            <strong>🔒 Privacy Note:</strong> This API only serves publicly available Reddit comments. All data is already public on Reddit. No private information or user data is exposed beyond what's publicly visible on reddit.com.
        </div>

        <footer>
            <p>🚀 Powered by <strong>Reddit Analyzer</strong> • Static hosting via <strong>Cloudflare Pages</strong></p>
            <p>Main app: <a href="https://claritydesk.app">claritydesk.app</a></p>
        </footer>
    </div>

    <script>
        // Simple status check
        console.log('🎯 Reddit Analyzer Data API - Ready for GPT-5 consumption');
        
        // Test CORS headers
        fetch('/v1/threads/thr_AvnmjK2Nmghw5AaVoV67i/overview.json')
            .then(response => {
                console.log('✅ CORS test successful');
                console.log('📊 Sample data accessible');
            })
            .catch(error => {
                console.log('⚠️ Sample data not yet deployed');
            });
    </script>
</body>
</html>