<?xml version="1.0" encoding="UTF-8"?>
<!-- Renders sitemap XML as a readable page in browsers. Search engines ignore this stylesheet. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:s="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="robots" content="noindex"/>
    <title>XML Sitemap</title>
    <style>
        body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: #1e293b; background: #f6f7fc; }
        header { background: linear-gradient(120deg, #2147f0, #7c3aed 55%, #db2777); color: #fff; padding: 32px 24px; }
        header h1 { margin: 0; font-size: 26px; }
        header p { margin: 6px 0 0; opacity: .85; }
        main { max-width: 1100px; margin: -20px auto 40px; padding: 0 16px; }
        .card { background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgb(0 0 0 / .06); overflow: hidden; }
        table { width: 100%; border-collapse: collapse; }
        th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; background: #f8fafc; padding: 10px 14px; }
        td { padding: 10px 14px; border-top: 1px solid #f1f5f9; vertical-align: top; }
        tr:hover td { background: #faf5ff; }
        a { color: #4f46e5; text-decoration: none; word-break: break-all; }
        a:hover { text-decoration: underline; }
        .muted { color: #94a3b8; white-space: nowrap; }
        .pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #ede9fe; color: #6d28d9; font-size: 11px; font-weight: 700; }
    </style>
</head>
<body>
<header>
    <h1>XML Sitemap</h1>
    <xsl:choose>
        <xsl:when test="s:sitemapindex">
            <p>This index lists <strong><xsl:value-of select="count(s:sitemapindex/s:sitemap)"/></strong> sitemaps. It is meant for search engines.</p>
        </xsl:when>
        <xsl:otherwise>
            <p>This sitemap contains <strong><xsl:value-of select="count(s:urlset/s:url)"/></strong> URLs. <a href="/sitemap.xml" style="color:#fff;text-decoration:underline">← Sitemap index</a></p>
        </xsl:otherwise>
    </xsl:choose>
</header>
<main>
    <div class="card">
        <xsl:choose>
            <xsl:when test="s:sitemapindex">
                <table>
                    <tr><th>Sitemap</th><th>Last modified</th></tr>
                    <xsl:for-each select="s:sitemapindex/s:sitemap">
                        <tr>
                            <td><a href="{s:loc}"><xsl:value-of select="s:loc"/></a></td>
                            <td class="muted"><xsl:value-of select="substring(s:lastmod, 1, 10)"/></td>
                        </tr>
                    </xsl:for-each>
                </table>
            </xsl:when>
            <xsl:otherwise>
                <table>
                    <tr><th>#</th><th>URL</th><th>Images</th><th>Last modified</th></tr>
                    <xsl:for-each select="s:urlset/s:url">
                        <tr>
                            <td class="muted"><xsl:value-of select="position()"/></td>
                            <td><a href="{s:loc}"><xsl:value-of select="s:loc"/></a></td>
                            <td><xsl:if test="count(image:image) &gt; 0"><span class="pill"><xsl:value-of select="count(image:image)"/></span></xsl:if></td>
                            <td class="muted"><xsl:value-of select="substring(s:lastmod, 1, 10)"/></td>
                        </tr>
                    </xsl:for-each>
                </table>
            </xsl:otherwise>
        </xsl:choose>
    </div>
</main>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
