import type { Metadata } from "next";
import { buildMetadata } from "@/lib/seo";
import { siteConfig } from "@/lib/constants";

export const metadata: Metadata = buildMetadata({
  title: "Privacy Policy",
  description: `Privacy policy for ${siteConfig.name} — what we collect (almost nothing), how we use it, and your rights.`,
  path: "/privacy",
});

const UPDATED = "October 1, 2025";

export default function PrivacyPage() {
  return (
    <div className="container max-w-3xl py-12 sm:py-16">
      <header className="mb-8">
        <p className="text-sm font-medium uppercase tracking-wider text-primary">Legal</p>
        <h1 className="mt-2 text-3xl font-semibold tracking-tight sm:text-4xl">Privacy Policy</h1>
        <p className="mt-3 text-sm text-muted-foreground">Last updated: {UPDATED}</p>
      </header>

      <div className="prose prose-slate max-w-none dark:prose-invert">
        <h2>Summary</h2>
        <p>
          Your Markdown documents stay on your device. We don't upload them, we don't read them, and
          we don't use them to train anything. This page explains the details.
        </p>
        <h2>What we collect</h2>
        <ul>
          <li>
            <strong>Drafts you write.</strong> Saved to your browser's local storage. Never sent to
            our servers.
          </li>
          <li>
            <strong>Theme and editor preferences.</strong> Also stored locally so the app remembers
            your settings.
          </li>
          <li>
            <strong>Anonymous request logs.</strong> Our hosting provider records standard web
            request metadata (timestamp, IP address, user agent) for abuse prevention and
            performance monitoring.
          </li>
        </ul>
        <h2>What we don't collect</h2>
        <ul>
          <li>The content of your Markdown documents</li>
          <li>Personally identifying information beyond what's in standard server logs</li>
          <li>Behavioral analytics or cross-site tracking</li>
        </ul>
        <h2>Cookies</h2>
        <p>
          {siteConfig.name} does not set tracking cookies. The site stores your theme preference and
          drafts in your browser's local storage, which is functionally similar but is not shared
          with our servers.
        </p>
        <h2>Third parties</h2>
        <p>
          We use the following third-party services, all of which we've audited for privacy:
        </p>
        <ul>
          <li>
            <strong>Vercel</strong> — hosting and edge content delivery.
          </li>
          <li>
            <strong>Google Fonts</strong> — served statically and self-hosted via Next.js Font.
          </li>
        </ul>
        <h2>Your rights</h2>
        <p>
          Because we don't collect personal data, there's nothing for us to delete on request. You
          can clear your local data at any time from your browser's site settings.
        </p>
        <h2>Contact</h2>
        <p>
          Questions about this policy? Open an issue on our{" "}
          <a href={siteConfig.social.github} target="_blank" rel="noopener noreferrer">
            GitHub repository
          </a>
          .
        </p>
      </div>
    </div>
  );
}
