<?php
// Shown at the bare domain root once the app is installed, instead of
// pointing anonymous visitors at the admin login. Its main audience is
// users who landed here with a mistyped or trimmed /claim/{token} link and
// just need pointing back to it -- so the default branch below stays a
// light, generic pitch (no gaming-specific platform names, no
// "creator"/"influencer" framing), not a hard sell.
//
// keylair.com itself is the one install this ships from -- Secret Item
// Games' own vendor site for the product -- so it alone gets the full
// sales page instead: real screenshots, the brand mark, and pricing.
// Every other install (including the company's own production instance)
// keeps the generic pitch. This is a plain hostname check rather than a
// config flag since it's a one-off distinction for exactly one domain,
// not a general per-install feature.
require __DIR__ . '/bootstrap.php';

use KeyLair\Helpers;
use KeyLair\Settings;

$isSalesDomain = stripos($_SERVER['HTTP_HOST'] ?? '', 'keylair.com') !== false;

if ($isSalesDomain) {
    require __DIR__ . '/welcome_sales.php';
    return;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= Helpers::e(Settings::siteName()) ?></title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/assets/css/tokens.css">
<link rel="stylesheet" href="/assets/css/claim-overview.css">
<?= Settings::faviconTag() ?>
<style>
  .hero-image{display:block; width:200px; height:200px; margin:0 auto 22px;}
  @media (min-width:640px){
    .hero-image{width:480px; height:480px;}
  }
  .pitch-list{
    list-style:none; margin:28px auto 0; padding:0; max-width:440px;
    display:flex; flex-direction:column; gap:12px;
  }
  .pitch-list li{
    display:flex; gap:12px; align-items:flex-start;
    background:var(--bg-panel); border:1px solid var(--line);
    border-radius:var(--radius-md); padding:12px 14px;
    font-size:13px; color:var(--text-muted); line-height:1.45;
  }
  .pitch-list strong{color:var(--text-primary); font-weight:600;}
  .pitch-list svg{flex-shrink:0; width:16px; height:16px; margin-top:2px; color:var(--signal);}
  .footnotes{
    text-align:center; color:var(--text-faint); font-size:12px;
    line-height:1.6; margin:20px 0 0;
  }
  .footnotes p{margin:0;}
</style>
</head>
<body>
<div class="page">
  <img class="hero-image" src="<?= Helpers::e(Settings::welcomeHeroOrDefault()) ?>" alt="">

  <div class="intro">
    <h1>Key Lair</h1>
    <p class="subtitle">Self-hosted key distribution, without accounts, spreadsheets, or shared logins. A user opens their personal link, makes a selection, and gets an unused key instantly.</p>
  </div>

  <ul class="pitch-list">
    <li>
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 12l5 5L20 6"/></svg>
      <span><strong>Nothing to install for users.</strong> They click a link, pick an option, and their key is waiting — no account, no login.</span>
    </li>
    <li>
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 12l5 5L20 6"/></svg>
      <span><strong>Every key handed out exactly once.</strong> Atomic allocation under load, full redemption history, and per-link or per-campaign claim limits.</span>
    </li>
    <li>
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 12l5 5L20 6"/></svg>
      <span><strong>Runs entirely on your own server.</strong> Your keys and your users' data never pass through a third party.</span>
    </li>
    <li>
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 12l5 5L20 6"/></svg>
      <span><strong>Built for teams, not just one admin.</strong> Multiple admin accounts, two-factor authentication, and a full audit log.</span>
    </li>
  </ul>

  <div class="footnotes">
    <p>Got a link from someone? Open it directly and you'll be taken straight to your keys.</p>
    <p>Interested in running this for your own business? Get in touch with Secret Item Games GmbH.</p>
  </div>

  <footer>
    Powered by <a href="https://www.keylair.com" target="_blank" rel="noopener">Key Lair</a><br>
    <a href="/imprint">Imprint</a> · <a href="/privacy">Privacy</a>
  </footer>
</div>
</body>
</html>
