const TERMS = [
  ['1. Services and Use', 'Model OS provides AI development, training, evaluation, deployment, knowledge management, and related services. Features may vary or change. You are responsible for your account and must use the Services lawfully, respect third-party rights, and not compromise platform security.'],
  ['2. Data and Ownership', 'You retain your rights to your content and data. Model OS may process them to provide and maintain the Services. Your content will not be used to train models for other customers without your authorization. Rights to customized models, training artifacts, and outputs depend on applicable laws and licenses. Model OS and third parties retain their respective intellectual property rights.'],
  ['4. Security and Deletion', 'We use reasonable security safeguards. Following account closure or a valid deletion request, applicable data will be deleted as soon as reasonably practicable, subject to legal, security, and technical requirements.'],
  ['5. Payments', 'Pricing, training fees, usage limits, and billing follow the applicable subscription terms. Renewals, cancellations, and refunds are subject to disclosed terms and applicable law.'],
  ['6. AI and Third-Party Services', 'Model OS may use third-party models and infrastructure subject to applicable licenses. AI outputs require appropriate review, and specific results are not guaranteed.'],
  ['7. Disclaimers and Liability', 'Services are provided “as is” and “as available.” To the maximum extent permitted by law, Model OS is not liable for indirect or consequential damages. Total liability is limited to the greater of $100 or fees paid in the preceding 12 months. Nothing limits rights or liabilities that cannot legally be excluded.'],
  ['8. General Terms', 'You may stop using the Services at any time. We may suspend access for misuse, nonpayment, or security reasons. Terms may be updated with notice where required. Delaware law governs these Terms, subject to mandatory legal protections. Disputes are subject to courts in Santa Clara County, California, unless otherwise required by law. Separate written agreements take precedence.'],
];

const PRIVACY = [
  ['3. Privacy', 'We collect account, contact, billing, submitted content, device, cookie, and usage information from you, your devices, and service providers. We use this information to operate, secure, improve, and support the Services, process payments, and meet legal obligations. Information may be shared with hosting, payment, analytics, AI, and other service providers, or as required by law. Processing may occur in the United States or other locations. Third-party tools may collect activity across websites. We honor legally required privacy signals; other browser Do Not Track settings do not affect our practices. We retain information as reasonably needed for service, security, billing, and legal purposes. Subject to applicable law, you may request access, correction, deletion, or other privacy rights, including applicable opt-outs, without discrimination. Verification and legal exceptions may apply. Material changes will be posted here, with additional notice where required.'],
];

const LegalPage = () => {
  const isPrivacy = location.pathname.endsWith('/privacy') || location.pathname.endsWith('privacy.html');
  const title = isPrivacy ? 'Privacy Notice' : 'Terms and Conditions';
  const sections = isPrivacy ? PRIVACY : TERMS;
  return <>
    <Nav />
    <main className="legal-page wrap">
      <div className="legal-eyebrow">/ MODEL OS LEGAL</div>
      <h1>{title}</h1>
      {!isPrivacy && <p className="legal-intro">By accessing or using Model OS, you agree to these Terms, effective from your first acceptance or use.</p>}
      {isPrivacy && <p className="legal-intro"><strong>Privacy Notice Effective Date: July 1, 2026</strong></p>}
      <div className="legal-content">
        {sections.map(([heading, body]) => <section key={heading}><h2>{heading}</h2><p>{body}</p></section>)}
        {isPrivacy && <section><h2>Contact</h2><p>Questions or requests may be sent to <a href="mailto:contact@modelos.technology">contact@modelos.technology</a>.</p></section>}
      </div>
      <div className="legal-contact">Model OS · <a href="https://modelos.technology">modelos.technology</a></div>
    </main>
    <Footer />
  </>;
};

ReactDOM.createRoot(document.getElementById('root')).render(<LegalPage />);
