<?php
header('Content-Type: application/xml; charset=UTF-8');
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '');
$base = $host ? $scheme . '://' . $host : '';
$pages = ['/', '/brand-story/', '/recommend/', '/cases/', '/insights/', '/guide/'];
$today = date('Y-m-d');
function x($value) { return htmlspecialchars($value, ENT_XML1 | ENT_COMPAT, 'UTF-8'); }
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach ($pages as $path): ?>
  <url>
    <loc><?= x($base . $path) ?></loc>
    <lastmod><?= x($today) ?></lastmod>
    <changefreq>daily</changefreq>
    <priority><?= $path === '/' ? '1.0' : '0.8' ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
