import type { Metadata } from "next";

export const metadata: Metadata = {
  title: "Privacy Policy",
  description: "How Tia handles your family's data. We don't sell it — we preserve it.",
  alternates: { canonical: "/privacy" },
  openGraph: {
    type: "website",
    url: "/privacy",
    title: "Privacy Policy | Tia",
    description: "How Tia handles your family's data. We don't sell it — we preserve it.",
  },
};

export default function PrivacyPage() {
  return (
    <div className="max-w-2xl mx-auto px-4 py-20">
      <h1 className="text-3xl font-bold text-gray-900 mb-2">Privacy Policy</h1>
      <p className="text-sm text-gray-400 mb-10">Last updated: May 2026</p>

      <div className="prose prose-gray max-w-none space-y-8 text-gray-700 leading-relaxed">
        <section>
          <h2 className="text-xl font-bold text-gray-900 mb-3">The short version</h2>
          <p>
            We don&apos;t sell your data. We don&apos;t show you ads. We don&apos;t share your records
            with third parties. Your family&apos;s data exists in Tia for one purpose: to
            be preserved for you and your child.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-bold text-gray-900 mb-3">What we collect</h2>
          <ul className="list-disc pl-5 space-y-2 text-sm">
            <li>Your name and email address, via Google Sign-In.</li>
            <li>Activity logs you enter (feeds, sleep, diapers, medical records, milestones).</li>
            <li>Photos and media you upload to the heirloom archive.</li>
            <li>Device and session information for security purposes.</li>
          </ul>
        </section>

        <section>
          <h2 className="text-xl font-bold text-gray-900 mb-3">How we protect it</h2>
          <p>
            Your family&apos;s data is isolated at the database level using Row-Level Security (RLS).
            No other user — no other family — can access your records. We use HTTPS everywhere.
            Sessions are managed with secure, httpOnly cookies.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-bold text-gray-900 mb-3">Who we share it with</h2>
          <p>
            We use the following third-party services to operate Tia. We do not sell your data
            to any third party, ever.
          </p>
          <ul className="list-disc pl-5 space-y-2 text-sm mt-3">
            <li><strong>Google</strong> — authentication only.</li>
            <li><strong>Cloudflare R2</strong> — media storage (photos, video).</li>
            <li><strong>Telegram</strong> — vaccination alerts, if you opt in.</li>
            <li><strong>Resend</strong> — transactional email (invites, verification).</li>
            <li><strong>Plausible Analytics</strong> — privacy-preserving, cookie-free analytics on our marketing pages only. No tracking inside the app.</li>
          </ul>
        </section>

        <section>
          <h2 className="text-xl font-bold text-gray-900 mb-3">Your rights</h2>
          <ul className="list-disc pl-5 space-y-2 text-sm">
            <li><strong>Export:</strong> You can export all your data at any time from Settings. The heirloom is portable and yours.</li>
            <li><strong>Deletion:</strong> You can delete your account and all associated data. Contact us at <a href="mailto:tia@manohargupta.com" className="text-rose-500 hover:underline">tia@manohargupta.com</a>.</li>
            <li><strong>Correction:</strong> You can edit or delete any log or record within the app.</li>
          </ul>
        </section>

        <section>
          <h2 className="text-xl font-bold text-gray-900 mb-3">Contact</h2>
          <p>
            Questions about this policy? Email us at{" "}
            <a href="mailto:tia@manohargupta.com" className="text-rose-500 hover:underline">
              tia@manohargupta.com
            </a>
            .
          </p>
        </section>
      </div>
    </div>
  );
}
