<?php
require __DIR__ . '/includes/config.php';
$page_title = ($LOCALE === 'de' ? 'Preise' : 'Pricing') . ' — ' . SITE_NAME;
$page_description = $LOCALE === 'de'
  ? 'Tradelyst-Preise — Trader €29, Pro €69, Elite €149. Plus ein Founder-Lifetime-Tier auf 100 Plätze begrenzt.'
  : 'Tradelyst pricing — Trader €29, Pro €69, Elite €149. Plus a founder lifetime tier capped at 100 seats.';
include __DIR__ . '/includes/head.php';
include __DIR__ . '/includes/header.php';

$founder_remaining = FOUNDER_SEATS_REMAINING;

// Tier features could also be translated; for v0.1 of i18n keep them in
// config.php as English. Lawyer-reviewed German tier copy lands later.
?>

<section class="hero" style="padding-bottom: 32px;">
  <div class="container">
    <span class="hero-eyebrow"><?= h(t('price.eyebrow')) ?></span>
    <h1><?= h(t('price.h1')) ?></h1>
    <p class="lead"><?= h(t('price.lead')) ?></p>
  </div>
</section>

<section class="block" style="padding-top: 0; padding-bottom: 96px;">
  <div class="container">
    <div class="pricing-grid">
      <?php foreach (TIERS as $key => $tier): ?>
        <?php
          $highlight = !empty($tier['highlight']);
          $oneTime   = !empty($tier['one_time']);
        ?>
        <div class="tier <?= $highlight ? 'tier-highlight' : '' ?>">
          <?php if ($highlight && !$oneTime): ?>
            <span class="tier-highlight-label"><?= h(t('price.popular')) ?></span>
          <?php elseif ($oneTime): ?>
            <span class="tier-highlight-label"><?= h(t('price.founder')) ?></span>
          <?php endif; ?>

          <h3><?= h($tier['name']) ?></h3>
          <p class="tier-tagline"><?= h($tier['tagline']) ?></p>

          <p class="tier-price">
            €<?= h((string) $tier['price_eur']) ?>
            <span class="tier-price-suffix">
              <?= $oneTime ? h(t('price.onetime')) : h(t('price.month')) ?>
            </span>
          </p>
          <?php if (!$oneTime && $tier['price_yearly']): ?>
            <div class="tier-price-yearly"><?= sprintf(h(t('price.yearly')), $tier['price_yearly']) ?></div>
          <?php else: ?>
            <div class="tier-price-yearly">&nbsp;</div>
          <?php endif; ?>

          <?php if ($oneTime): ?>
            <div class="founder-counter">
              <strong><?= h((string) $founder_remaining) ?></strong>
              <?= ' ' . sprintf(h(t('price.seats')), $founder_remaining, FOUNDER_SEATS_TOTAL) ?>
            </div>
          <?php endif; ?>

          <ul>
            <?php foreach ($tier['features'] as $f): ?>
              <li><?= h($f) ?></li>
            <?php endforeach; ?>
          </ul>

          <a href="<?= h(APP_URL) ?>/invite?tier=<?= h($key) ?>"
             class="btn <?= $highlight ? 'btn-primary' : 'btn-secondary' ?>">
            <?= $oneTime ? h(t('cta.claim_founder')) : h(t('cta.start') . ' ' . $tier['name']) ?>
          </a>
        </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<section class="block">
  <div class="container">
    <h2 class="section-title"><?= h(t('price.faq_title')) ?></h2>
    <div style="max-width: 720px;">
      <?php for ($i = 1; $i <= 6; $i++): ?>
        <h3 style="font-size: 17px; margin-top: 32px;"><?= h(t("price.faq{$i}_q")) ?></h3>
        <p class="text-muted" style="font-size: 15px;"><?= h(t("price.faq{$i}_a")) ?></p>
      <?php endfor; ?>
    </div>
  </div>
</section>

<?php include __DIR__ . '/includes/footer.php'; ?>
