import PageLayout from '~/components/PageLayout'
import { SITE_NAME } from '~/lib/site-config'

const companyName = 'PiPup Technologies, LLC'
const lastUpdated = '2026-05-22'

export function meta() {
  return [{ title: `Privacy Policy — ${SITE_NAME}` }]
}

export default function PrivacyPolicy() {
  return (
    <PageLayout spacing="8">
      <h1 className="font-display text-2xl font-semibold text-stone-900 dark:text-white">Privacy Policy</h1>
      <div className="prose prose-stone dark:prose-invert max-w-none text-sm text-stone-700 dark:text-stone-300 space-y-6">
        <p className="text-stone-500 dark:text-stone-400 text-xs">
          Last Updated: <strong>{lastUpdated}</strong>.<br />
          Company: <strong>{companyName}</strong> (a Delaware limited liability company) ("Company," "we," "us," or "our").<br />
          Service: The platform available at <strong>lemma.pub</strong> (the "Service").
        </p>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">1. Scope</h2>
          <p>
            This Privacy Policy explains how we collect, use, disclose, and safeguard personal information when you use our platform (the "Service").
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">2. How the Service Works</h2>
          <p>
            Lemma is a single-page application built on the <strong>AT Protocol</strong>. Your blog posts and publication settings are stored on your own <strong>Personal Data Server (PDS)</strong> — a server you control, hosted by Bluesky or another AT Protocol provider. Lemma does not host your content.
          </p>
          <p>
            When you create a post, Lemma writes it to your PDS on your behalf. Lemma also indexes posts — including their full content — in its own database to power the reading feed.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">3. Information We Collect</h2>
          <ul>
            <li><strong>AT Protocol Identity:</strong> your Decentralized Identifier (DID) and handle, which are public identifiers on the AT Protocol network.</li>
            <li><strong>Post Index Data:</strong> metadata and content of posts you create through the Service, stored in our database to power the reading feed.</li>
            <li><strong>Terms Acceptance:</strong> a timestamp recording when you accepted the Terms of Service, associated with your DID.</li>
            <li><strong>Server Logs:</strong> standard request log data generated by our infrastructure, retained for a limited period for security and operational purposes.</li>
            <li><strong>Payment Information:</strong> if paid features are introduced, payment method details will be processed by <strong>Stripe</strong>. We will not store full card numbers; Stripe will process and store them subject to its own privacy policy.</li>
            <li><strong>Support Communications:</strong> any information you provide when contacting us for support.</li>
          </ul>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">4. How We Use Information</h2>
          <ul>
            <li>Provide, maintain, and improve the Service and its security and performance.</li>
            <li>Serve the reading feed by indexing post metadata from across the AT Protocol network.</li>
            <li>Communicate with you about security alerts and administrative matters.</li>
            <li>Detect, investigate, and prevent abuse or violations of our Terms.</li>
            <li>Comply with legal obligations and enforce our rights.</li>
          </ul>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">5. How We Share Information</h2>
          <ul>
            <li><strong>Service Providers:</strong> with vendors that help us operate the Service, under contractual confidentiality and data-use limits. If paid features are introduced, payment processing will be handled by Stripe.</li>
            <li><strong>AT Protocol Network:</strong> post metadata you publish is public on the AT Protocol network by design and may be indexed by other AT Protocol services.</li>
            <li><strong>Legal:</strong> to comply with laws, lawful requests, or to protect rights, safety, and property.</li>
            <li><strong>Business Transfers:</strong> as part of any merger, acquisition, financing, or sale of assets.</li>
          </ul>
          <p><strong>We do not sell personal information.</strong></p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">6. Cookies &amp; Browser Storage</h2>
          <p>
            The Service does not use cookies. Authentication is handled via AT Protocol OAuth; session state is stored in your browser's local storage, not transmitted as a cookie. No third-party tracking cookies are set.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">7. Data Retention</h2>
          <p>
            Post index data is retained as long as the corresponding post exists on your PDS. If you delete a post from your PDS, it will be removed from our index. Other information is kept only as long as necessary for the purposes described in this Policy, for legitimate business needs, and to comply with legal obligations.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">8. Security</h2>
          <p>
            We implement reasonable administrative, technical, and physical safeguards designed to protect personal information. However, no method of transmission or storage is completely secure.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">9. Your Rights &amp; Choices</h2>
          <p>
            Because your content is stored on your own PDS, you have direct control over it: you can edit or delete posts at any time through the Service or directly via your PDS. Depending on your location, you may also have rights to access, correct, delete, or receive a copy of any other personal information we hold about you, and to object to or restrict certain processing (e.g., under U.S. state privacy laws or the GDPR). To exercise these rights, contact us. We may need to verify your identity before responding.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">10. Children's Privacy</h2>
          <p>
            The Service is not directed to children under <strong>13</strong>, or under <strong>16</strong> where required by local law. We do not knowingly collect personal information from such children. If we learn we have collected such data, we will delete it.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">11. International Data Transfers</h2>
          <p>
            We are based in the United States. If you use the Service from outside the U.S., your information may be transferred to, stored, and processed in the U.S. and other countries with different data protection laws. Where required, we use appropriate safeguards for such transfers.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">12. Changes to this Policy</h2>
          <p>
            We may update this Policy from time to time. We will post the updated Policy with a new Last Updated date, and for material changes we may provide additional notice. Your continued use of the Service after the Last Updated date indicates your acceptance.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">13. Contact Us</h2>
          <address className="not-italic space-y-2">
            <a
              href="https://bsky.app/profile/lemma.pub"
              target="_blank"
              rel="noopener noreferrer"
              className="inline-flex items-center gap-2 no-underline hover:underline"
            >
              <img src="/Bluesky_Logo.svg" alt="Bluesky" className="w-4 h-4" />
              @lemma.pub
            </a>
          </address>
        </section>
      </div>
    </PageLayout>
  )
}
