/* Legal pages: Privacy Policy, Terms of Service, Refund Policy + a cookie/tracking
   notice. Written to reflect THIS site's real data practices (Google Sign-In, Stripe,
   an anonymous analytics id). Templates - fill the LEGAL config below and have them
   reviewed by a lawyer before relying on them. */

// ── EDIT THIS: your business details (used across all three pages) ──────────────
const LEGAL = {
  brand: "beHired",
  entity: "Roman Hrytsyk, a sole proprietor based in Ontario, Canada",
  email: "contact@behired.dev",               // real support/contact email
  jurisdiction: "the Province of Ontario, Canada", // ← your governing jurisdiction
  updated: "June 2026",                           // ← bump when you change a policy
};

function LegalLayout({ title, intro, children }) {
  return (
    <main className="po-legal">
      <div className="wrap po-legal-wrap">
        <a className="po-legal-back" href="/"><Icon name="arrow" size={15} style={{ transform: "rotate(180deg)" }} /> Back to site</a>
        <span className="eyebrow"><Icon name="doc" size={15} /> Legal</span>
        <h1>{title}</h1>
        <p className="po-legal-updated mono">Last updated {LEGAL.updated}</p>
        {intro && <p className="po-legal-intro">{intro}</p>}
        <div className="po-legal-body">{children}</div>
      </div>
    </main>
  );
}

function PrivacyPolicy() {
  return (
    <LegalLayout title="Privacy Policy"
      intro={`This policy explains what ${LEGAL.brand} (“we”, “us”) collects, why, and your choices. We aim to collect as little as possible.`}>
      <section>
        <h2>Who we are</h2>
        <p>{LEGAL.brand} is an online course operated by {LEGAL.entity}. You can reach us any time at <a href={"mailto:" + LEGAL.email}>{LEGAL.email}</a>.</p>
      </section>
      <section>
        <h2>Information we collect</h2>
        <ul>
          <li><b>Account information</b> - if you create an account with <b>Sign in with Google</b>, we receive your name, email address, profile picture, and Google account ID. We never see your Google password.</li>
          <li><b>Purchase information</b> - payments are processed by <b>Stripe</b>. We receive your email, the amount, and whether the payment succeeded. We do <b>not</b> receive or store your full card number - Stripe handles card data directly.</li>
          <li><b>Usage &amp; analytics</b> - a random, non-identifying <b>visitor ID</b> stored in your browser to count unique visits and which modules readers engage with. For signed-in users we also record which modules you’ve completed, to show your progress and aggregate engagement. This analytics is <b>first-party and anonymous</b> - we do not use third-party analytics tools or advertising.</li>
          <li><b>Feedback &amp; survey responses</b> - if you rate a module, submit a refund reason, or answer the outcome survey, we store what you choose to send to improve the course and report results in aggregate. A testimonial or your name is only ever shown publicly if you tick the consent box, and we confirm with you first.</li>
          <li><b>Email updates</b> - if you give us your email (for example to get the rest of the roadmap), we use it to send course updates and job-search tips. Every email includes a one-click unsubscribe link, and you can opt out at any time.</li>
          <li><b>Technical data</b> - standard server logs (such as IP address and browser type) used for security and to keep the service running.</li>
        </ul>
      </section>
      <section>
        <h2>How we use your information</h2>
        <ul>
          <li>To give you access to the course and remember your progress.</li>
          <li>To process payments and provide receipts and support.</li>
          <li>To understand, in aggregate, how the product is used and improve it.</li>
          <li>To keep the service secure and prevent abuse.</li>
        </ul>
        <p>We process this data to perform our contract with you (providing the course), and with your consent where required (e.g. account creation, analytics storage).</p>
      </section>
      <section>
        <h2>Who we share it with</h2>
        <p>We do <b>not</b> sell your personal information. We share data only with the service providers that make the product work:</p>
        <ul>
          <li><b>Google</b> - authentication (Sign in with Google).</li>
          <li><b>Stripe</b> - payment processing.</li>
        </ul>
        <p>These providers process data under their own privacy policies. We may also disclose information if required by law.</p>
      </section>
      <section>
        <h2>Cookies &amp; local storage</h2>
        <p>We use your browser’s local storage for essentials (keeping you signed in, remembering your progress and preferences) and to hold the anonymous analytics ID described above. <b>We do not use cookies</b> - no analytics cookies, no advertising, and no cross-site tracking. You can clear this data any time in your browser settings; doing so will sign you out and reset the anonymous ID.</p>
      </section>
      <section>
        <h2>Data retention &amp; storage</h2>
        <p>We keep account and purchase data for as long as you have an account or as needed to meet legal and accounting obligations, then delete or anonymize it. We take reasonable technical and organizational measures to protect your data, but no method of storage or transmission is 100% secure.</p>
      </section>
      <section>
        <h2>Your rights</h2>
        <p>You can ask us to access, correct, export, or delete your personal information, or withdraw consent, by emailing <a href={"mailto:" + LEGAL.email}>{LEGAL.email}</a>. We’ll respond within a reasonable time and as required by applicable law (including Canada’s PIPEDA and, where it applies, the GDPR).</p>
      </section>
      <section>
        <h2>International transfers</h2>
        <p>Our providers (Google, Stripe) and hosting may process data outside your country, including in the United States. Where required, we rely on appropriate safeguards for such transfers.</p>
      </section>
      <section>
        <h2>Children</h2>
        <p>The service is intended for adults and is not directed to children under 16. We do not knowingly collect data from children.</p>
      </section>
      <section>
        <h2>Changes</h2>
        <p>We may update this policy; we’ll change the “last updated” date above and, for material changes, take reasonable steps to notify you.</p>
      </section>
    </LegalLayout>
  );
}

function TermsOfService() {
  return (
    <LegalLayout title="Terms of Service"
      intro={`These terms govern your use of ${LEGAL.brand}. By using the site or buying the course, you agree to them.`}>
      <section className="po-legal-callout">
        <p><b>Important:</b> {LEGAL.brand} is <b>educational</b>. We do <b>not</b> guarantee that you will get a job, interviews, or any particular result, and nothing here is legal, immigration, or financial advice.</p>
      </section>
      <section>
        <h2>The service</h2>
        <p>{LEGAL.brand} is a self-paced online course. Module 1 is free to read. Modules 2-6 require a one-time payment (shown in CAD at checkout). After purchase you get access to the paid content for the lifetime of the product, subject to these terms.</p>
      </section>
      <section>
        <h2>Your account</h2>
        <p>You may create an account using Sign in with Google. You’re responsible for activity under your account and for keeping access to your Google account secure. Accounts and purchases are for one person and may not be shared.</p>
      </section>
      <section>
        <h2>License &amp; intellectual property</h2>
        <p>The course content is owned by us and protected by copyright. On purchase, we grant you a personal, non-exclusive, non-transferable license to access and use the content for your own learning. You may not copy, redistribute, resell, publish, share your login, or use the content to build a competing product.</p>
      </section>
      <section>
        <h2>Payment</h2>
        <p>Prices are in Canadian dollars and are charged once at checkout via Stripe. You authorize us (through Stripe) to charge the amount shown. You’re responsible for any taxes that apply to your purchase.</p>
      </section>
      <section>
        <h2>Refunds</h2>
        <p>Purchases are covered by our <a href="/refund">Refund Policy</a> (a 30-day money-back guarantee).</p>
      </section>
      <section>
        <h2>Acceptable use</h2>
        <p>Don’t misuse the service: no scraping, automated harvesting, attempting to bypass the paywall, reverse engineering, or using the service unlawfully or to infringe others’ rights.</p>
      </section>
      <section>
        <h2>No guarantee of results</h2>
        <p>The content reflects opinions and experience and is provided for general educational purposes. Outcomes depend on many factors outside our control. We make no warranty that following the course will result in employment, interviews, or any specific outcome, and any examples are illustrative, not promises.</p>
      </section>
      <section>
        <h2>Disclaimers &amp; limitation of liability</h2>
        <p>The service is provided “as is” and “as available,” without warranties of any kind to the extent permitted by law. To the maximum extent permitted by law, our total liability for any claim relating to the service is limited to the amount you paid us in the 12 months before the claim, and we are not liable for indirect, incidental, or consequential damages. Nothing in these terms limits liability that cannot be limited by law.</p>
      </section>
      <section>
        <h2>Termination</h2>
        <p>You may stop using the service at any time. We may suspend or terminate access if you breach these terms.</p>
      </section>
      <section>
        <h2>Governing law</h2>
        <p>These terms are governed by the laws of {LEGAL.jurisdiction}, and you agree to the exclusive jurisdiction of its courts, without regard to conflict-of-laws rules and without affecting any mandatory consumer-protection rights you have where you live.</p>
      </section>
      <section>
        <h2>Changes</h2>
        <p>We may update these terms; continued use after a change means you accept the updated terms.</p>
      </section>
    </LegalLayout>
  );
}

function RefundPolicy() {
  return (
    <LegalLayout title="Refund Policy"
      intro="We want you to be glad you bought the course. If you’re not, we’ll refund you.">
      <section>
        <h2>30-day money-back guarantee</h2>
        <p>If you’re not satisfied with the course, email us within <b>30 days</b> of your purchase and we’ll refund your payment in full - no hard feelings.</p>
      </section>
      <section>
        <h2>How to request a refund</h2>
        <p>Send a note to <a href={"mailto:" + LEGAL.email}>{LEGAL.email}</a> from (or mentioning) the email you used at checkout, and we’ll take care of it. You don’t need to explain why.</p>
      </section>
      <section>
        <h2>How refunds are processed</h2>
        <p>Approved refunds are returned to your original payment method via Stripe, typically within 5-10 business days depending on your bank or card provider.</p>
      </section>
      <section>
        <h2>After 30 days</h2>
        <p>Because this is a digital product with immediate access, we generally don’t offer refunds after 30 days, except where required by applicable consumer-protection law.</p>
      </section>
      <section>
        <h2>Free content</h2>
        <p>Module 1 is free - there’s nothing to refund for it.</p>
      </section>
    </LegalLayout>
  );
}

Object.assign(window, { PrivacyPolicy, TermsOfService, RefundPolicy });
