import LegalLayout, { CONTACT_EMAIL, H2, LegalLink } from "./LegalLayout";

export default function PrivacyPolicy() {
  return (
    <LegalLayout title="Privacy Policy">
      <p>
        Siftlode is a personal, non-commercial project operated by an individual in Hungary
        ("we", "us"). It lets you view and organize your own YouTube subscriptions as a
        filterable feed. This policy explains what data Siftlode accesses, how it is used, and
        the choices you have. By using Siftlode you agree to this policy.
      </p>

      <H2>What we access</H2>
      <p>Siftlode only accesses data you explicitly authorize, in two separate steps:</p>
      <ul className="list-disc pl-5 space-y-1">
        <li>
          <span className="text-fg font-medium">Sign-in (always):</span> your basic Google
          profile — name, email address, profile picture, and Google account identifier — used
          solely to create and identify your account.
        </li>
        <li>
          <span className="text-fg font-medium">YouTube read (optional, opt-in):</span> with the{" "}
          <code className="text-xs">youtube.readonly</code> scope, your list of YouTube
          subscriptions and the public metadata of those channels and their videos (titles,
          thumbnails, durations, view counts, publish dates), used to build your feed.
        </li>
        <li>
          <span className="text-fg font-medium">YouTube manage (optional, opt-in):</span> with
          the <code className="text-xs">youtube</code> scope, the ability to unsubscribe from a
          channel on YouTube — performed only when you click to do so.
        </li>
      </ul>
      <p>
        You can use Siftlode with sign-in alone, and grant or decline each YouTube permission
        independently.
      </p>

      <H2>How we use it</H2>
      <p>
        Your data is used exclusively to provide Siftlode's features to you: building and
        displaying your personalized subscription feed, and carrying out actions (such as
        unsubscribing) that you initiate. We do not use it for advertising, profiling, or any
        purpose unrelated to the app.
      </p>

      <H2>Limited Use disclosure</H2>
      <p>
        Siftlode's use and transfer of information received from Google APIs to any other app
        will adhere to the{" "}
        <LegalLink href="https://developers.google.com/terms/api-services-user-data-policy">
          Google API Services User Data Policy
        </LegalLink>
        , including the Limited Use requirements. We do not sell your data, do not transfer it
        to third parties (except as needed to operate the app, e.g. the hosting infrastructure
        we control), and do not use it for advertising.
      </p>

      <H2>Storage &amp; security</H2>
      <p>
        Data is stored in a private PostgreSQL database on a server we control, accessible only
        to the operator. Google OAuth refresh tokens are encrypted at rest. Access is restricted
        to the emails explicitly invited to the app. No system is perfectly secure, but we take
        reasonable measures to protect your data.
      </p>

      <H2>Retention &amp; deletion</H2>
      <p>
        We keep your data while your account is active. You can revoke Siftlode's access to your
        Google data at any time at{" "}
        <LegalLink href="https://myaccount.google.com/permissions">
          myaccount.google.com/permissions
        </LegalLink>
        ; once revoked, the stored tokens can no longer be used. To have your account and
        associated data deleted, email{" "}
        <a href={`mailto:${CONTACT_EMAIL}`} className="text-accent hover:underline">
          {CONTACT_EMAIL}
        </a>
        .
      </p>

      <H2>Cookies</H2>
      <p>
        Siftlode sets a single, signed session cookie to keep you logged in. It is not used for
        tracking or advertising, and there are no third-party analytics cookies.
      </p>

      <H2>YouTube &amp; Google</H2>
      <p>
        Siftlode uses YouTube API Services. By using Siftlode you also agree to the{" "}
        <LegalLink href="https://www.youtube.com/t/terms">YouTube Terms of Service</LegalLink>,
        and your use of Google data is subject to the{" "}
        <LegalLink href="https://policies.google.com/privacy">Google Privacy Policy</LegalLink>.
      </p>

      <H2>Changes</H2>
      <p>
        We may update this policy; material changes will be reflected by the "Last updated" date
        above. Continued use after a change constitutes acceptance.
      </p>

      <H2>Contact</H2>
      <p>
        Questions about this policy or your data:{" "}
        <a href={`mailto:${CONTACT_EMAIL}`} className="text-accent hover:underline">
          {CONTACT_EMAIL}
        </a>
        .
      </p>
    </LegalLayout>
  );
}
