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

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

export function meta() {
  return [{ title: `Terms of Service — ${SITE_NAME}` }]
}

export default function TermsOfService() {
  return (
    <PageLayout spacing="8">
      <h1 className="font-display text-2xl font-semibold text-stone-900 dark:text-white">Terms of Service</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. Binding Agreement</h2>
          <p>
            By clicking "I Agree", "Sign in", or otherwise accessing or using the Service, you agree to be bound by these Terms of Service ("Terms") and our{' '}
            <Link to="/privacy" className="underline">Privacy Policy</Link>.
            If you do not agree, do not use the Service.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">2. Eligibility</h2>
          <ul>
            <li>You must be at least <strong>13 years old</strong> to use the Service, except where applicable law requires a minimum age of <strong>16</strong>.</li>
            <li>By using the Service, you represent that you meet the applicable age threshold and have the legal capacity to enter into these Terms.</li>
          </ul>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">3. User Content &amp; License</h2>
          <p><strong>Your promises.</strong> You represent and warrant that all content you post, upload, or otherwise make available through the Service ("User Content"):</p>
          <ul>
            <li><strong>Complies with all applicable laws of the United States</strong> (including intellectual property, privacy, publicity, export, and sanctions laws);</li>
            <li>Does not infringe or misappropriate any third party rights;</li>
            <li>Does not show or promote violence against humans or animals;</li>
            <li>Is not AI-generated text and was written by you;</li>
            <li>Is not graphic adult entertainment of a sexual nature;</li>
            <li>Is not unlawful, harmful, abusive, defamatory, obscene, hateful, harassing, deceptive, or otherwise objectionable; and</li>
            <li>Does not contain malware, spyware, or other malicious code.</li>
          </ul>
          <p><strong>License to Company.</strong> You retain ownership of User Content. You grant Company a worldwide, non-exclusive, royalty-free, transferable and sublicensable license to host, store, cache, reproduce, process, adapt, publish, transmit, display, perform, distribute, and otherwise use User Content for the purpose of operating, providing, improving, and promoting the Service.</p>
          <p><strong>Moderation.</strong> We may (but are not obligated to) review, remove, or restrict access to User Content at our sole discretion for any reason, including violations of these Terms or legal requests.</p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">4. Payments via Stripe</h2>
          <ul>
            <li>Certain features may require fees or subscriptions. Prices and taxes may change from time to time.</li>
            <li>Payments are processed by <strong>Stripe</strong>. By submitting payment information, you authorize Company and Stripe to charge your selected payment method for all applicable fees, taxes, and any recurring charges.</li>
            <li>We do not store full credit card numbers. Refunds are provided only where required by law or as specifically stated for a given product or plan.</li>
            <li>You agree to Stripe's terms and policies as applicable to you.</li>
          </ul>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">5. Prohibited Conduct</h2>
          <p>You will not:</p>
          <ul>
            <li>Use the Service for any unlawful purpose or in violation of any U.S. law;</li>
            <li>Upload spam, phishing content, or deceptive schemes;</li>
            <li>Access or search the Service by means other than our publicly supported interfaces; scrape, crawl, or spider without permission;</li>
            <li>Interfere with or disrupt the Service, including by introducing malware or attempting to circumvent security or rate limits;</li>
            <li>Reverse engineer or decompile the Service except to the extent permitted by law;</li>
            <li>Impersonate any person or entity or misrepresent your affiliation.</li>
          </ul>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">6. Intellectual Property</h2>
          <p>
            Excluding User Content, the Service and all related materials (including software, design, text, graphics, logos, trademarks, and compilations) are owned by Company or its licensors and are protected by intellectual property laws. Subject to these Terms, we grant you a limited, revocable, non-exclusive, non-transferable license to use the Service as intended.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">7. Copyright/DMCA</h2>
          <p>
            If you believe content infringes your copyright, send a notice to our designated agent with: (a) your signature; (b) identification of the work and the infringing material; (c) contact information; (d) a statement of good-faith belief; and (e) a statement that the information is accurate and you are authorized to act. We may remove content and terminate repeat infringers as appropriate.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">8. Disclaimers of Warranties</h2>
          <p>
            THE SERVICE IS PROVIDED "AS IS" AND "AS AVAILABLE." TO THE MAXIMUM EXTENT PERMITTED BY LAW, COMPANY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT. WE DO NOT WARRANT THAT THE SERVICE WILL BE UNINTERRUPTED, SECURE, OR ERROR-FREE.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">9. Limitation of Liability</h2>
          <p>
            TO THE MAXIMUM EXTENT PERMITTED BY LAW, COMPANY WILL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS, REVENUE, DATA, OR GOODWILL, ARISING OUT OF OR RELATED TO YOUR USE OF THE SERVICE, EVEN IF ADVISED OF THE POSSIBILITY. COMPANY'S TOTAL LIABILITY FOR ANY CLAIM WILL NOT EXCEED THE GREATER OF <strong>$100</strong> OR THE AMOUNTS YOU PAID TO COMPANY FOR THE SERVICE IN THE TWELVE (12) MONTHS PRECEDING THE EVENT GIVING RISE TO THE CLAIM.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">10. Indemnification</h2>
          <p>
            You agree to indemnify, defend, and hold harmless Company and its officers, directors, employees, and affiliates from and against any claims, liabilities, damages, losses, and expenses (including reasonable attorneys' fees) arising out of or related to your User Content, your use of the Service, or your violation of these Terms or applicable law.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">11. Dispute Resolution &amp; Arbitration; Class-Action Waiver</h2>
          <p><strong>Mandatory Arbitration.</strong> Any dispute, claim, or controversy arising out of or relating to these Terms or the Service will be resolved by binding arbitration administered by the American Arbitration Association ("AAA") under its Commercial Arbitration Rules. The Federal Arbitration Act and Delaware law govern the interpretation and enforcement of this Section.</p>
          <p><strong>Location &amp; Procedures.</strong> Arbitration will take place in <strong>Chicago, IL</strong>, before a single arbitrator. The language will be English. Judgment on the award may be entered in any court of competent jurisdiction.</p>
          <p><strong>Individual Actions Only.</strong> YOU AND COMPANY AGREE THAT EACH MAY BRING CLAIMS AGAINST THE OTHER ONLY IN YOUR OR ITS INDIVIDUAL CAPACITY AND NOT AS A PLAINTIFF OR CLASS MEMBER IN ANY PURPORTED CLASS OR REPRESENTATIVE PROCEEDING.</p>
          <p>If this Section is found unenforceable, the "Governing Law; Venue" clause below applies.</p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">12. Suspension &amp; Termination</h2>
          <p>
            We may suspend or terminate your access to the Service, remove content, or block access to any part of the Service at any time, with or without notice, for any reason, including violations of these Terms or legal requests.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">13. Changes to the Terms</h2>
          <p>
            We may modify these Terms from time to time. We will post the updated Terms with a new effective date. For material changes, we may also provide additional notice (e.g., via the Service or email). Your continued use after the effective date constitutes acceptance.
          </p>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">14. Miscellaneous</h2>
          <ul>
            <li><strong>Governing Law; Venue.</strong> These Terms are governed by the laws of the State of Delaware, without regard to conflict-of-laws rules. Subject to the arbitration clause, the exclusive venue for disputes will be state or federal courts located in <strong>Chicago, IL</strong>, and you consent to jurisdiction there.</li>
            <li><strong>Entire Agreement.</strong> These Terms, together with the Privacy Policy, constitute the entire agreement between you and Company.</li>
            <li><strong>Severability.</strong> If any provision is held unenforceable, it will be replaced with an enforceable provision that most closely reflects the original intent, and the remainder will remain in effect.</li>
            <li><strong>Assignment.</strong> You may not assign your rights; we may assign ours without restriction.</li>
            <li><strong>No Waiver.</strong> Failure to enforce a provision is not a waiver.</li>
            <li><strong>Export &amp; Sanctions.</strong> You agree to comply with U.S. export controls and sanctions.</li>
          </ul>
        </section>

        <section className="space-y-2">
          <h2 className="font-display text-lg font-semibold text-stone-900 dark:text-white">15. 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>
  )
}
