{% extends "base.html" %}

{% block title %}Privacy Policy — {{ config.APP_NAME }}{% endblock %}

{% block content %}
<main class="container-page py-12">
  <div class="max-w-3xl mx-auto">
    <div class="page-header">
      <h1>Privacy Policy</h1>
      <p class="text-sm text-stone">Last updated: February 2025</p>
    </div>

    <div class="card space-y-8">

      <section>
        <h2 class="text-xl mb-3">1. Data Controller</h2>
        <p class="text-stone">
          Hendrik Dreesmann<br>
          c/o COCENTER, Koppoldstr. 1, 86551 Aichach, Germany<br>
          Email: <a href="mailto:{{ config.EMAIL_FROM }}" class="underline">{{ config.EMAIL_FROM }}</a>
        </p>
      </section>

      <section>
        <h2 class="text-xl mb-3">2. Data We Collect</h2>
        <p class="text-stone mb-2"><strong>Data you provide directly:</strong></p>
        <ul class="list-disc pl-5 space-y-1 text-sm text-stone mb-4">
          <li>Email address — required to create an account and deliver the service</li>
          <li>Payment information — collected and processed by Paddle (we never see your card details)</li>
        </ul>
        <p class="text-stone mb-2"><strong>Data collected automatically:</strong></p>
        <ul class="list-disc pl-5 space-y-1 text-sm text-stone">
          <li>IP address and browser type — used for security and abuse prevention</li>
          <li>Session data — stored in a server-side cookie to keep you logged in</li>
          <li>Usage data — anonymised page views collected by Umami Analytics (no cookies, no cross-site tracking)</li>
        </ul>
      </section>

      <section>
        <h2 class="text-xl mb-3">3. Legal Basis (GDPR Art. 6)</h2>
        <ul class="list-disc pl-5 space-y-1 text-sm text-stone">
          <li><strong>Art. 6(1)(b) — Contract:</strong> email address and payment data, to provide and bill the service</li>
          <li><strong>Art. 6(1)(f) — Legitimate interest:</strong> security logs, anonymised analytics, fraud prevention</li>
          <li><strong>Art. 6(1)(c) — Legal obligation:</strong> invoicing records retained for 10 years as required by German tax law</li>
        </ul>
      </section>

      <section>
        <h2 class="text-xl mb-3">4. Sub-processors</h2>
        <div class="text-sm text-stone space-y-2">
          <p><strong>Paddle</strong> (payments) — processes payment data on our behalf. <a href="https://www.paddle.com/legal/privacy" class="underline" target="_blank" rel="noopener">Paddle Privacy Policy</a></p>
          <p><strong>Resend</strong> (transactional email) — sends magic-link and notification emails. <a href="https://resend.com/privacy" class="underline" target="_blank" rel="noopener">Resend Privacy Policy</a></p>
          <p><strong>Umami</strong> (analytics) — self-hosted, anonymised page-view analytics. No cookies, no cross-site tracking, no personal data transferred to third parties.</p>
          <p><strong>Hetzner</strong> (hosting) — servers located in Germany (EU). <a href="https://www.hetzner.com/legal/privacy-policy" class="underline" target="_blank" rel="noopener">Hetzner Privacy Policy</a></p>
        </div>
      </section>

      <section>
        <h2 class="text-xl mb-3">5. Cookies</h2>
        <p class="text-stone mb-2">We use only essential cookies:</p>
        <ul class="list-disc pl-5 space-y-1 text-sm text-stone">
          <li><strong>Session cookie</strong> — keeps you logged in; expires when your session ends or after 30 days</li>
          <li><strong>CSRF token</strong> — protects form submissions; session-scoped</li>
        </ul>
        <p class="text-stone mt-2">We do not use advertising, tracking, or third-party cookies. Umami Analytics is cookieless.</p>
      </section>

      <section>
        <h2 class="text-xl mb-3">6. Data Retention</h2>
        <ul class="list-disc pl-5 space-y-1 text-sm text-stone">
          <li>Account data — retained while your account is active; deleted within 30 days of account deletion</li>
          <li>Invoicing records — retained for 10 years as required by German tax law (§147 AO)</li>
          <li>Security logs — retained for 30 days</li>
          <li>Anonymised analytics — retained indefinitely (no personal data)</li>
        </ul>
      </section>

      <section>
        <h2 class="text-xl mb-3">7. International Transfers</h2>
        <p class="text-stone">All servers are located in Germany (EU). Paddle and Resend may process data outside the EU; both maintain EU Standard Contractual Clauses (SCCs) to ensure adequate protection.</p>
      </section>

      <section>
        <h2 class="text-xl mb-3">8. Your Rights (GDPR)</h2>
        <p class="text-stone mb-2">As an EU resident you have the right to:</p>
        <ul class="list-disc pl-5 space-y-1 text-sm text-stone">
          <li><strong>Access</strong> (Art. 15) — obtain a copy of your personal data</li>
          <li><strong>Rectification</strong> (Art. 16) — correct inaccurate data</li>
          <li><strong>Erasure</strong> (Art. 17) — delete your account and personal data</li>
          <li><strong>Restriction</strong> (Art. 18) — restrict how we process your data</li>
          <li><strong>Portability</strong> (Art. 20) — receive your data in a machine-readable format</li>
          <li><strong>Object</strong> (Art. 21) — object to processing based on legitimate interest</li>
        </ul>
        <p class="text-stone mt-3">To exercise any of these rights, email <a href="mailto:{{ config.EMAIL_FROM }}" class="underline">{{ config.EMAIL_FROM }}</a>. We respond within 30 days.</p>
        <p class="text-stone mt-2">You also have the right to lodge a complaint with your national data protection authority. In Germany: <a href="https://www.bfdi.bund.de" class="underline" target="_blank" rel="noopener">BfDI</a>.</p>
      </section>

      <section>
        <h2 class="text-xl mb-3">9. Changes</h2>
        <p class="text-stone">We may update this policy. For significant changes we will notify you by email at least 14 days in advance.</p>
      </section>

      <section>
        <h2 class="text-xl mb-3">10. Contact</h2>
        <p class="text-stone">Privacy enquiries: <a href="mailto:{{ config.EMAIL_FROM }}" class="underline">{{ config.EMAIL_FROM }}</a></p>
      </section>

    </div>
  </div>
</main>
{% endblock %}
