<?php
/**
 * Exoplanet Ledger — About
 * https://exoplanetledger.org/about
 */
declare(strict_types=1);

$config = require __DIR__ . '/../config/db.php';
$umami = $config['site']['umami'] ?? [];
$utcNow = gmdate('Y-m-d H:i:s');
?>
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>About & Methodology — Exoplanet Ledger</title>
    <meta name="description" content="The mission, data pipeline, and habitability classification criteria of Exoplanet Ledger. Direct from the NASA Exoplanet Archive with zero hype.">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:ital,wght@0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
    
    <?php if (!empty($umami['website_id'])): ?>
    <script defer src="<?= htmlspecialchars($umami['script'] ?? 'https://farol.rogerle.com/farol') ?>" data-website-id="<?= htmlspecialchars($umami['website_id']) ?>"></script>
    <?php endif; ?>

    <style>
        :root, html[data-theme="dark"] {
            --bg-void: #06090e;
            --bg-panel: #0c1017;
            --bg-panel-hover: #111722;
            --border: #1a2333;
            --border-highlight: #28374f;
            --text-primary: #e6edf5;
            --text-muted: #8d9ba8;
            --text-dim: #505e70;
            --exo-cyan: #38bdf8;
            --exo-gold: #fbbf24;
            --exo-green: #4ade80;
            --glow: rgba(56, 189, 248, 0.12);
            --bg-telemetry: rgba(12, 16, 23, 0.94);
            --telemetry-border: #1a2333;
            --telemetry-text: #8d9ba8;
            --telemetry-val: #e6edf5;
            --font-serif: 'Instrument Serif', Georgia, serif;
            --font-sans: 'Inter', -apple-system, sans-serif;
            --font-mono: 'JetBrains Mono', monospace;
            --grid-line: rgba(56, 189, 248, 0.025);
        }

        html[data-theme="light"] {
            --bg-void: #f8fafc;
            --bg-panel: #ffffff;
            --bg-panel-hover: #f1f5f9;
            --border: #cbd5e1;
            --border-highlight: #94a3b8;
            --text-primary: #0f172a;
            --text-muted: #475569;
            --text-dim: #64748b;
            --exo-cyan: #0284c7;
            --exo-gold: #d97706;
            --exo-green: #15803d;
            --glow: rgba(2, 132, 199, 0.06);
            --bg-telemetry: rgba(255, 255, 255, 0.96);
            --telemetry-border: #cbd5e1;
            --telemetry-text: #475569;
            --telemetry-val: #0f172a;
            --grid-line: rgba(0, 0, 0, 0.035);
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            background-color: var(--bg-void);
            color: var(--text-primary);
            font-family: var(--font-sans);
            font-size: 14.5px;
            line-height: 1.7;
            min-height: 100vh;
            background-image: 
                radial-gradient(ellipse 85% 45% at 50% 0%, var(--glow), transparent 70%),
                repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px 24px),
                repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 24px);
            background-attachment: fixed;
        }

        a { color: var(--exo-cyan); text-decoration: none; }
        a:hover { text-decoration: underline; }

        .telemetry-bar {
            position: sticky;
            top: 0;
            z-index: 100;
            background: var(--bg-telemetry);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--telemetry-border);
            padding: 10px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-family: var(--font-mono);
            font-size: 11.5px;
            color: var(--telemetry-text);
        }

        .telemetry-left {
            display: flex;
            align-items: center;
            gap: 14px;
            flex-wrap: wrap;
        }

        .btn-theme {
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text-muted);
            padding: 4px 10px;
            border-radius: 4px;
            cursor: pointer;
            font-family: var(--font-mono);
            font-size: 11px;
            transition: all 0.15s ease;
        }
        .btn-theme:hover {
            color: var(--text-primary);
            border-color: var(--border-highlight);
        }

        .container {
            max-width: 820px;
            margin: 0 auto;
            padding: 40px 24px 80px;
        }

        .back-link {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-family: var(--font-mono);
            font-size: 12px;
            margin-bottom: 24px;
            color: var(--text-muted);
        }
        .back-link:hover { color: var(--exo-cyan); }

        h1 {
            font-family: var(--font-serif);
            font-size: 42px;
            font-weight: 400;
            line-height: 1.15;
            margin-bottom: 16px;
            color: var(--text-primary);
        }
        h1 em { font-style: italic; color: var(--exo-gold); }

        .lead {
            font-size: 18px;
            color: var(--text-muted);
            line-height: 1.6;
            margin-bottom: 36px;
            border-left: 3px solid var(--exo-cyan);
            padding-left: 18px;
        }

        .card {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 28px 30px;
            margin-bottom: 24px;
        }

        h2 {
            font-family: var(--font-serif);
            font-size: 24px;
            font-weight: 400;
            margin-bottom: 12px;
            color: var(--text-primary);
        }

        p { margin-bottom: 14px; color: var(--text-muted); }
        p:last-child { margin-bottom: 0; }

        ul { margin-left: 20px; margin-bottom: 14px; color: var(--text-muted); }
        li { margin-bottom: 8px; }

        .code-tag {
            font-family: var(--font-mono);
            font-size: 12px;
            background: var(--bg-void);
            padding: 2px 6px;
            border-radius: 4px;
            border: 1px solid var(--border);
            color: var(--text-primary);
        }

        footer {
            margin-top: 60px;
            padding-top: 24px;
            border-top: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-family: var(--font-mono);
            font-size: 11.5px;
            color: var(--text-dim);
            flex-wrap: wrap;
            gap: 12px;
        }
    </style>
</head>
<body>

    <header class="telemetry-bar">
        <div class="telemetry-left">
            <span>STATION: <a href="/" style="font-weight:600;">EXOPLANETLEDGER.ORG</a></span>
            <span style="color:var(--text-dim)">·</span>
            <span>ABOUT & METHODOLOGY</span>
        </div>
        <div class="telemetry-right">
            <button class="btn-theme" id="themeBtn" type="button">☀️ LIGHT</button>
        </div>
    </header>

    <div class="container">
        <a href="/" class="back-link">← Return to Exoplanet Ledger</a>

        <h1>A Living Ledger of Other Worlds.<br>Strictly <em>Empirical.</em></h1>

        <p class="lead">
            Exoplanet Ledger is a dedicated catalog of verified planets orbiting stars beyond our Solar System, synchronized directly from primary astrophysical surveys without commercial noise or sensationalism.
        </p>

        <div class="card">
            <h2>The Data Pipeline</h2>
            <p>
                Every record in Exoplanet Ledger originates from the <strong>NASA Exoplanet Archive</strong>, operated by the California Institute of Technology (Caltech) and the NASA Exoplanet Science Institute (NExScI).
            </p>
            <p>
                We query the Archive's Table Access Protocol (<span class="code-tag">TAP</span>) endpoint using the composite parameters catalog (<span class="code-tag">pscomppars</span>). This table synthesizes validated planetary characteristics from published, peer-reviewed literature across major space observatories including Kepler, K2, TESS, Spitzer, and ground-based radial velocity spectrographs (e.g. HARPS, ESPRESSO).
            </p>
        </div>

        <div class="card">
            <h2>Habitability & Classification Criteria</h2>
            <p>
                Popular media frequently labels distant planets as "Earth 2.0" based purely on loose orbital distance approximations. Exoplanet Ledger applies rigorous astrophysical boundaries:
            </p>
            <ul>
                <li><strong>Conservative Habitable Zone:</strong> Evaluated based on stellar flux (S<sub>eff</sub>) models developed by Kopparapu et al., requiring an insolation level between 0.35 and 1.1 times the solar flux Earth receives, assuming an Earth-like atmosphere and greenhouse profile.</li>
                <li><strong>Terrestrial Composition Window:</strong> Planetary radius must not exceed 1.5 Earth radii (R<sub>⊕</sub>). Above 1.6 R<sub>⊕</sub>, planets almost universally retain substantial volatile envelopes (hydrogen/helium atmospheres) making them mini-Neptunes rather than rocky terrestrial surfaces.</li>
                <li><strong>System Architecture:</strong> Multi-planet systems are cataloged with relative orbital periods to reveal resonant chains (such as TRAPPIST-1's Laplace resonances).</li>
            </ul>
        </div>

        <div class="card">
            <h2>Our Core Principles</h2>
            <ul>
                <li><strong>Primary Sources Only:</strong> Direct synchronization with Caltech/NExScI and peer-reviewed journals.</li>
                <li><strong>Zero Commercial Incentives:</strong> No advertisements, no sponsored recommendations, and no paywalls.</li>
                <li><strong>Fast & Accessible:</strong> Built with zero-bloat vanilla PHP, CSS, and HTML, rendering instantaneously on desktop, mobile, and low-bandwidth connections.</li>
            </ul>
        </div>

        <div class="card">
            <h2>Hosting & Operation</h2>
            <p>
                Exoplanet Ledger is hosted on independent infrastructure by <a href="https://rogerle.com" target="_blank" rel="noopener">RogerLe.com</a>. Privacy-respecting telemetry is measured via self-hosted Farol (Umami) analytics with zero cookies or cross-site fingerprinting.
            </p>
        </div>

        <footer>
            <div>Hosted by <a href="https://rogerle.com" target="_blank" rel="noopener">RogerLe.com</a> &middot; Data from NASA Exoplanet Archive</div>
            <nav style="display:flex;gap:14px;">
                <a href="/">Home</a>
                <a href="/terms">Terms</a>
                <a href="/privacy">Privacy</a>
            </nav>
        </footer>
    </div>

    <script>
        const themeBtn = document.getElementById('themeBtn');
        const currentTheme = localStorage.getItem('el-theme') || 'dark';
        document.documentElement.setAttribute('data-theme', currentTheme);
        themeBtn.textContent = currentTheme === 'dark' ? '☀️ LIGHT' : '🌙 DARK';

        themeBtn.addEventListener('click', () => {
            const active = document.documentElement.getAttribute('data-theme');
            const next = active === 'dark' ? 'light' : 'dark';
            document.documentElement.setAttribute('data-theme', next);
            localStorage.setItem('el-theme', next);
            themeBtn.textContent = next === 'dark' ? '☀️ LIGHT' : '🌙 DARK';
        });
    </script>
</body>
</html>
