<?php
declare(strict_types=1);
header('Content-Type: application/xml; charset=UTF-8');
$host = htmlspecialchars($_SERVER['HTTP_HOST'] ?? '', ENT_QUOTES | ENT_XML1, 'UTF-8');
$isHttps = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (($_SERVER['SERVER_PORT'] ?? '') === '443');
$scheme = $isHttps ? 'https' : 'http';
$base = $host === '' ? '' : $scheme . '://' . $host;
$today = date('Y-m-d');
$paths = [
    '/',
    '/video/',
    '/download/',
    '/install/',
    '/faq/',
    '/contact/',
    '/brand-story/',
    '/featured/',
    '/cases/',
    '/insights/',
    '/guide/'
];
echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
?>
<urlset xmlns="<?php echo 'http://' . implode('.', ['www', 'sitemaps', 'org']) . '/schemas/sitemap/0.9'; ?>">
<?php foreach ($paths as $path): ?>
  <url>
    <loc><?php echo $base . $path; ?></loc>
    <lastmod><?php echo $today; ?></lastmod>
    <changefreq>daily</changefreq>
    <priority><?php echo $path === '/' ? '1.0' : '0.8'; ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
