// pages/privacy-terms.jsx — Privacy Policy and Terms of Service

function PrivacyPage() {
  useSEO("Privacy Policy — Vela", "Vela's privacy policy. How we handle your data.");
  return (
    <div style={{ paddingTop: '64px', minHeight: '100vh', background: 'var(--color-bg)' }}>
      <div style={{ padding: '5rem 0 3rem', textAlign: 'center' }} className="bg-hero-glow">
        <div className="container">
          <AnimEl>
            <h1 style={{ fontSize: 'clamp(2rem, 5vw, 3rem)', fontWeight: 800, letterSpacing: '-0.03em', marginBottom: '0.75rem' }}>Privacy Policy</h1>
            <p style={{ color: 'var(--color-muted)', fontSize: '1.0625rem' }}>Last updated: June 2026</p>
          </AnimEl>
        </div>
      </div>
      <div className="container" style={{ maxWidth: '720px', padding: '3rem 1.5rem 6rem' }}>
        <div className="prose">
          <h2>1. Overview</h2>
          <p>Vela ("we", "us", "our") is committed to protecting your privacy. This Privacy Policy explains how we collect, use, and share information when you use our website at vela-secure.vercel.app and our open-source execution runtime.</p>

          <h2>2. Information We Collect</h2>
          <p><strong>Account Information:</strong> When you sign in via Google OAuth, we receive your name, email address, and profile photo from Google. We do not store your Google password.</p>
          <p><strong>Usage Data:</strong> We collect anonymized analytics about page visits, feature usage, and performance metrics to improve the product.</p>
          <p><strong>Execution Data (Cloud Plans):</strong> If you use Vela Cloud, code submitted for execution is processed in-memory within isolated micro-VMs. Execution results are stored for the retention period specified in your plan and then permanently deleted.</p>

          <h2>3. How We Use Your Information</h2>
          <p>We use collected information to:</p>
          <ul style={{ color: 'var(--color-muted)', lineHeight: 1.8 }}>
            <li>Provide, maintain, and improve our services</li>
            <li>Communicate with you about updates and security notices</li>
            <li>Monitor and prevent abuse of the execution API</li>
            <li>Generate aggregated, non-identifying analytics</li>
          </ul>

          <h2>4. Data Sharing</h2>
          <p>We do not sell your personal information. We may share data with:</p>
          <ul style={{ color: 'var(--color-muted)', lineHeight: 1.8 }}>
            <li><strong>Service providers:</strong> Firebase (authentication), Vercel (hosting)</li>
            <li><strong>Legal requirements:</strong> When required by law or to protect our rights</li>
          </ul>

          <h2>5. Self-Hosted Deployments</h2>
          <p>If you self-host Vela, no data is sent to us. The open-source version does not include telemetry or phone-home functionality. All execution data stays on your infrastructure.</p>

          <h2>6. Data Security</h2>
          <p>We implement industry-standard security measures including encryption in transit (TLS 1.3), encryption at rest, and access controls. Execution environments are isolated using Firecracker micro-VMs with separate kernels.</p>

          <h2>7. Your Rights</h2>
          <p>You may request access to, correction of, or deletion of your personal data at any time by contacting us at <a href="mailto:team@getvela.io" style={{ color: 'var(--color-brand-400)' }}>team@getvela.io</a>.</p>

          <h2>8. Changes to This Policy</h2>
          <p>We may update this Privacy Policy from time to time. We will notify you of any material changes by posting the new Privacy Policy on this page and updating the "Last updated" date.</p>

          <h2>9. Contact Us</h2>
          <p>If you have questions about this Privacy Policy, contact us at <a href="mailto:team@getvela.io" style={{ color: 'var(--color-brand-400)' }}>team@getvela.io</a>.</p>
        </div>
      </div>
    </div>
  );
}

function TermsPage() {
  useSEO("Terms of Service — Vela", "Vela's terms of service for website and cloud platform usage.");
  return (
    <div style={{ paddingTop: '64px', minHeight: '100vh', background: 'var(--color-bg)' }}>
      <div style={{ padding: '5rem 0 3rem', textAlign: 'center' }} className="bg-hero-glow">
        <div className="container">
          <AnimEl>
            <h1 style={{ fontSize: 'clamp(2rem, 5vw, 3rem)', fontWeight: 800, letterSpacing: '-0.03em', marginBottom: '0.75rem' }}>Terms of Service</h1>
            <p style={{ color: 'var(--color-muted)', fontSize: '1.0625rem' }}>Last updated: June 2026</p>
          </AnimEl>
        </div>
      </div>
      <div className="container" style={{ maxWidth: '720px', padding: '3rem 1.5rem 6rem' }}>
        <div className="prose">
          <h2>1. Acceptance of Terms</h2>
          <p>By accessing or using the Vela website, cloud platform, or open-source software ("Services"), you agree to be bound by these Terms of Service. If you do not agree, do not use the Services.</p>

          <h2>2. Open-Source License</h2>
          <p>The Vela runtime engine and related tools are licensed under the MIT License. You may use, modify, and distribute the software in accordance with the license terms. The full license text is available in the <a href="https://github.com/karnati-praveen/VELA" target="_blank" rel="noopener noreferrer" style={{ color: 'var(--color-brand-400)' }}>GitHub repository</a>.</p>

          <h2>3. Cloud Platform Usage</h2>
          <p>If you use Vela Cloud (paid plans), the following additional terms apply:</p>
          <ul style={{ color: 'var(--color-muted)', lineHeight: 1.8 }}>
            <li>You must not use the service to execute malicious code, perform attacks, or violate any applicable laws</li>
            <li>You are responsible for the code submitted through your API keys</li>
            <li>We reserve the right to suspend accounts that violate these terms</li>
            <li>Uptime guarantees are specified in your plan's SLA</li>
          </ul>

          <h2>4. Acceptable Use</h2>
          <p>You agree not to use Vela to:</p>
          <ul style={{ color: 'var(--color-muted)', lineHeight: 1.8 }}>
            <li>Mine cryptocurrency or run compute-intensive workloads outside the intended use case</li>
            <li>Attempt to escape the sandbox or exploit the isolation layer</li>
            <li>Store or process regulated data (HIPAA, PCI-DSS) without an Enterprise plan</li>
            <li>Resell access to the Cloud API without prior written consent</li>
          </ul>

          <h2>5. Payment Terms</h2>
          <p>Cloud plans are billed monthly or annually as selected during signup. Overages are billed at the per-execution rate specified in your plan. All fees are non-refundable except as required by law.</p>

          <h2>6. Limitation of Liability</h2>
          <p>TO THE MAXIMUM EXTENT PERMITTED BY LAW, VELA SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS OR REVENUES, WHETHER INCURRED DIRECTLY OR INDIRECTLY.</p>

          <h2>7. Disclaimer</h2>
          <p>The Services are provided "AS IS" without warranty of any kind. While we strive for high availability and security, we do not guarantee that the service will be uninterrupted, error-free, or completely secure.</p>

          <h2>8. Termination</h2>
          <p>Either party may terminate these terms at any time. Upon termination of a Cloud plan, your execution history will be retained for 30 days before deletion.</p>

          <h2>9. Changes to Terms</h2>
          <p>We reserve the right to modify these terms at any time. Material changes will be communicated via the email associated with your account.</p>

          <h2>10. Contact</h2>
          <p>For questions about these Terms, contact us at <a href="mailto:team@getvela.io" style={{ color: 'var(--color-brand-400)' }}>team@getvela.io</a>.</p>
        </div>
      </div>
    </div>
  );
}

Object.assign(window, { PrivacyPage, TermsPage });
