import type { Metadata } from "next";
import { buildMetadata } from "@/lib/seo";
import { siteConfig } from "@/lib/constants";

export const metadata: Metadata = buildMetadata({
  title: "Terms of Service",
  description: `Terms of service for ${siteConfig.name}.`,
  path: "/terms",
});

const UPDATED = "October 1, 2025";

export default function TermsPage() {
  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">Terms of Service</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>1. Acceptance</h2>
        <p>
          By using {siteConfig.name} you agree to these terms. If you disagree with any part of
          them, please don't use the service.
        </p>
        <h2>2. The service</h2>
        <p>
          {siteConfig.name} is a free, in-browser Markdown editor. We provide the service "as is" —
          we don't promise it will be uptime-perfect or that every feature works on every browser,
          although we do try.
        </p>
        <h2>3. Acceptable use</h2>
        <ul>
          <li>Don't use the service to host or distribute unlawful content.</li>
          <li>Don't attempt to break, abuse, or overload the infrastructure.</li>
          <li>Respect the rights of other users and third parties.</li>
        </ul>
        <h2>4. Your content</h2>
        <p>
          You retain ownership of everything you write. Because your drafts never leave your
          browser, we don't make any claim to them.
        </p>
        <h2>5. Open source</h2>
        <p>
          The {siteConfig.name} source code is released under the MIT license. You can fork, modify,
          and self-host it freely.
        </p>
        <h2>6. Liability</h2>
        <p>
          To the maximum extent permitted by law, {siteConfig.name} is provided without warranty.
          We're not liable for lost work, data corruption, or other damages — please keep your own
          backups for important documents.
        </p>
        <h2>7. Changes</h2>
        <p>
          We may update these terms occasionally. Material changes will be reflected with a new
          "Last updated" date at the top of this page.
        </p>
      </div>
    </div>
  );
}
