<!DOCTYPE html>
<?php
/* Owner-only Marketing Website deliverable. Vars: $baseUrl, $assetsUrl, $ownerName, $dir, $stats */
if (!isset($baseUrl)) $baseUrl = '';
if (!isset($assetsUrl)) $assetsUrl = rtrim($baseUrl, '/') . '/assets';
$dlUrl = rtrim($baseUrl, '/') . '/platform/deliverables/marketing/download';
$fmtSize = static function (int $b): string {
    if ($b < 1024) return $b . ' B';
    if ($b < 1048576) return round($b / 1024, 1) . ' KB';
    return round($b / 1048576, 1) . ' MB';
};
?>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= htmlspecialchars(\PpPhp\Core\Brand::name()) ?> · Marketing Website</title>
    <?php include constant('BASE_PATH') . '/core/views/favicon.php'; ?>
    <link href="<?= $assetsUrl ?>/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="<?= $assetsUrl ?>/icons/bootstrap-icons.css" rel="stylesheet">
    <script src="<?= $assetsUrl ?>/bootstrap/js/bootstrap.bundle.min.js" defer></script>
    <?php include constant('BASE_PATH') . '/core/views/theme-head.php'; ?>
    <style>
        body { background: var(--pp-app-bg, #f5f6fa); color: var(--pp-text, #172033); padding-top: 56px; }
        .ppb-topbar { background: var(--pp-surface, #fff); border-bottom: 1px solid var(--pp-border, #e6e9f0); }
        .ppb-wrap { max-width: 780px; margin: 2.2rem auto; padding: 0 1rem; }
        .ppb-card { background: var(--pp-surface, #fff); border: 1px solid var(--pp-border, #e6e9f0); border-radius: 16px; box-shadow: 0 8px 30px rgba(15,23,42,.06); overflow: hidden; }
        .ppb-head { padding: 1.4rem 1.6rem; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; }
        .ppb-owner { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: rgba(255,255,255,.18); padding: .2rem .6rem; border-radius: 999px; }
        .ppb-body { padding: 1.6rem; }
        .ppb-col h6 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pp-muted, #64748b); margin-bottom: .5rem; }
        .ppb-col ul { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
        .ppb-col li { display: flex; align-items: baseline; gap: .5rem; padding: .18rem 0; }
        .ppb-col li i { color: #16a34a; }
        .ppb-note { display: flex; gap: .6rem; align-items: flex-start; background: var(--pp-surface-soft, #f1f5f9); border: 1px solid var(--pp-border, #e2e8f0); border-radius: 12px; padding: .8rem 1rem; font-size: .86rem; color: var(--pp-muted, #475569); }
        .ppb-stat { display: inline-flex; gap: .4rem; align-items: center; font-size: .82rem; color: var(--pp-muted, #64748b); }
        .ppb-actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-top: 1.3rem; }
    </style>
</head>
<body>
<?php
    $user = $user ?? \PpPhp\Core\Security::CurrentUserData();
    $navBrandLabel = 'Marketing Site';
    $navBrandIcon  = 'globe2';
    $navBack = ['url' => $baseUrl . '/projects', 'label' => 'Projects', 'icon' => 'arrow-left'];
    include constant('BASE_PATH') . '/core/views/console-navbar.php';
?>

    <div class="ppb-wrap">
        <div class="ppb-card">
            <div class="ppb-head">
                <div class="ppb-owner"><i class="bi bi-shield-lock-fill"></i> Owner only</div>
                <h3 class="mt-2 mb-1"><i class="bi bi-globe2 me-2"></i>Marketing Website</h3>
                <p class="mb-0" style="opacity:.92;">The public <strong>ppradhan.com</strong> landing site, packaged for download. Deploy it at your domain root.</p>
            </div>
            <div class="ppb-body">
                <p class="text-muted mb-3">This is a <strong>static site</strong> — there's nothing to build, so the download is always the current source in this install. Unzip it into your web root (it sits <em>alongside</em> <code>/community</code>, not inside it) and you're live.</p>

                <div class="ppb-col mb-3">
                    <h6>What's inside</h6>
                    <ul>
                        <li><i class="bi bi-check-lg"></i> <code>index.html</code> — the landing page (with the Community showcase + link)</li>
                        <li><i class="bi bi-check-lg"></i> <code>assets/</code>, <code>logo.svg</code>, <code>favicon</code></li>
                        <li><i class="bi bi-check-lg"></i> <code>docs/</code> — the public documentation pages</li>
                        <li><i class="bi bi-check-lg"></i> <code>robots.txt</code>, <code>sitemap.xml</code></li>
                    </ul>
                </div>

                <?php if (!empty($stats['exists'])): ?>
                <div class="ppb-note mb-3">
                    <i class="bi bi-info-circle mt-1"></i>
                    <div>
                        <span class="ppb-stat"><i class="bi bi-files"></i> <?= (int) $stats['files'] ?> files</span>
                        &nbsp;·&nbsp;
                        <span class="ppb-stat"><i class="bi bi-hdd"></i> <?= $fmtSize((int) $stats['bytes']) ?></span>
                        &nbsp;— source at <code>Extra/MarketingSite/</code> in this install (edit it there any time).
                    </div>
                </div>
                <?php else: ?>
                <div class="alert alert-warning py-2 px-3 mb-3"><i class="bi bi-exclamation-triangle me-1"></i> The marketing source folder wasn't found in this install.</div>
                <?php endif; ?>

                <div class="ppb-actions">
                    <a href="<?= $dlUrl ?>" class="btn btn-primary"><i class="bi bi-download me-1"></i>Download ZIP</a>
                    <a href="<?= $baseUrl ?>/platform/deliverables/community" class="btn btn-outline-secondary"><i class="bi bi-box-seam me-1"></i>Community Installer</a>
                    <a href="<?= $baseUrl ?>/help/owner_deliverables" class="btn btn-link btn-sm text-decoration-none ms-auto"><i class="bi bi-question-circle me-1"></i>Help</a>
                </div>
                <p class="text-muted mt-3 mb-0" style="font-size:.82rem;">The ZIP is built on demand, streamed to your browser, then deleted from this server — no artifact is left behind.</p>
            </div>
        </div>
        <?php $which = 'marketing'; include __DIR__ . '/partials/deliverables_analytics.php'; ?>
    </div>
</body>
</html>
