/* global React */
// Privacy / POPIA notice page sections.
// Renders Privacy Notice v1.1 (30-Apr-26) verbatim from Sitesign\Legal\04_PrivacyNotice_v1.1.docx.
// DRAFT until Information Regulator activation + lawyer final stamp -- then remove the draft banner.

const PrivacyDraftBanner = () => (
  <div style={{
    background: 'linear-gradient(90deg, #E68A00 0%, #D17800 100%)',
    color: '#fff',
    padding: '14px 16px',
    textAlign: 'center',
    fontWeight: 600,
    fontSize: 14,
    letterSpacing: 0.3,
    borderBottom: '2px solid rgba(0,0,0,0.15)',
  }}>
    DRAFT v1.1 -- pending Information Regulator activation and lawyer final stamp. Not legally binding in this form.
  </div>
);

const PrivacyHero = () => (
  <>
    <PrivacyDraftBanner/>
    <section style={{ background: 'var(--ss-midnight-blue)', color: '#fff', padding: '64px 0 56px', borderBottom: '4px solid var(--ss-safety-yellow)' }}>
      <div className="container" style={{ maxWidth: 920 }}>
        <span className="t-eyebrow t-eyebrow--accent" style={{ color: 'rgba(255,255,255,0.7)' }}>Privacy Notice</span>
        <h1 className="t-display" style={{ color: '#fff', marginTop: 16, marginBottom: 18, fontSize: 'clamp(34px, 4.4vw, 50px)' }}>
          Privacy Notice
        </h1>
        <p className="t-lead" style={{ color: 'rgba(255,255,255,0.85)', maxWidth: 720 }}>
          sitesign.co.za &nbsp;|&nbsp; Version 1.1 &nbsp;|&nbsp; Last updated 30-Apr-26
        </p>
      </div>
    </section>
  </>
);

const Sec = ({ id, title, children }) => (
  <section id={id} style={{ marginBottom: 40 }}>
    <h2 style={{
      color: 'var(--ss-midnight-blue)',
      fontSize: 22,
      fontWeight: 700,
      marginTop: 0,
      marginBottom: 14,
      borderLeft: '3px solid var(--ss-safety-yellow)',
      paddingLeft: 12,
    }}>{title}</h2>
    <div style={{ color: 'var(--ss-dark-text, #4A4A4A)', lineHeight: 1.6, fontSize: 16 }}>
      {children}
    </div>
  </section>
);

const PrivacyTable = ({ rows, headers }) => (
  <div style={{ overflowX: 'auto', margin: '12px 0' }}>
    <table style={{ width: '100%', borderCollapse: 'collapse', fontSize: 14 }}>
      {headers && (
        <thead>
          <tr style={{ background: 'var(--ss-light-silver, #C8CFD7)' }}>
            {headers.map((h, i) => (
              <th key={i} style={{ padding: '8px 12px', textAlign: 'left', color: 'var(--ss-midnight-blue)', borderBottom: '2px solid #b0b8c0' }}>{h}</th>
            ))}
          </tr>
        </thead>
      )}
      <tbody>
        {rows.map((r, i) => (
          <tr key={i} style={{ borderBottom: '1px solid #e5e7eb' }}>
            {r.map((c, j) => (
              <td key={j} style={{ padding: '8px 12px', verticalAlign: 'top' }}>{c}</td>
            ))}
          </tr>
        ))}
      </tbody>
    </table>
  </div>
);

const PrivacyBody = () => (
  <section style={{ background: '#fff', padding: '48px 0 64px' }}>
    <div className="container" style={{ maxWidth: 920 }}>

      <Sec id="who-we-are" title="1. Who we are">
        <p>SiteSign is a tablet-kiosk time-and-attendance product for South African industrial sites. The product is operated by Gridstone Holdings (Pty) Ltd, a private company registered in South Africa (registration number 2024/721587/07). When we say "SiteSign", "we", "our" or "us" in this notice, we mean Gridstone Holdings (Pty) Ltd.</p>
        <p><strong>Registered address:</strong> 22 Wrenrose Avenue, Birdhaven, 2196, Johannesburg, South Africa</p>
        <p><strong>Email:</strong> privacy@sitesign.co.za</p>
        <p><strong>Information Officer:</strong> Leon Kohrs, registered with the Information Regulator under POPIA section 56.</p>
      </Sec>

      <Sec id="what-covers" title="2. What this notice covers">
        <p>This notice describes how we collect, use, store, share and protect personal information when:</p>
        <ul style={{ paddingLeft: 22 }}>
          <li>you visit sitesign.co.za, sitesign.org, sitesign.site or sitesign.store ("the Website");</li>
          <li>you contact us by email, demo-booking form, or other channel; or</li>
          <li>you receive cold outreach from us via email or LinkedIn.</li>
        </ul>
        <p>If you are a Worker whose attendance is recorded through the SiteSign product at a worksite, the privacy notice that applies to you is the Worker Privacy Notice provided by your employer at the kiosk. The notice on your employer's kiosk explains the collection and use of your face descriptor, selfie, GPS data, and clock-in / clock-out timestamps. SiteSign processes that data only on your employer's instructions, in our role as Operator under POPIA.</p>
      </Sec>

      <Sec id="what-we-collect" title="3. What information we collect about you (Website visitors and prospects)">
        <p><strong>3.1 Information you give us.</strong> When you book a demo, request information, or correspond with us, we collect your name, work email, company name, role, team size, country, and the content of your message.</p>
        <p><strong>3.2 Information we collect automatically.</strong> When you visit the Website, we collect a limited set of technical information that does not identify you personally, including: page URLs visited, referrer URL, browser type and version, screen size, country (derived from your IP address but not stored), and timestamp.</p>
        <p><strong>3.3 Cookies.</strong> We use a small number of cookies. Strictly necessary cookies (for example, the cookie that records your cookie-consent choice) are set by default. Non-essential cookies (analytics) are OFF by default and are set only if you explicitly opt in. We do not use marketing or advertising cookies. We do not use Google Analytics. Our analytics provider is Plausible (privacy-first, IP-anonymising, no cross-site tracking, cookieless by default).</p>
        <p><strong>3.4 Outreach.</strong> If you receive a cold email or LinkedIn message from us, we obtained your work contact details from publicly available business sources (for example, your company website, LinkedIn, or business intelligence tools such as Apollo). We process your data on the legal basis of legitimate interest in growing SiteSign. You can opt out at any time by replying "unsubscribe" or by emailing unsubscribe@sitesign.co.za.</p>
      </Sec>

      <Sec id="why" title="4. Why we collect your information">
        <p><strong>4.1 Demo and sales conversations.</strong> To respond to your enquiry, schedule a demo, share a proposal, and (if you sign a Pilot Agreement) onboard your team. Legal basis: performance of a contract or steps taken at your request prior to entering a contract.</p>
        <p><strong>4.2 Product communications.</strong> To send you product release notes, scheduled-maintenance notices, and security advisories if you are an existing customer. Legal basis: performance of contract.</p>
        <p><strong>4.3 Direct marketing.</strong> To send you occasional marketing emails about new SiteSign features. We rely on your consent (for new prospects) or on the soft-opt-in for existing customers in respect of products similar to those you have already taken from us. You can opt out at any time.</p>
        <p><strong>4.4 Improving the Website and the Service.</strong> To understand which Website pages and Service features are useful, fix bugs, and prioritise the roadmap. Legal basis: legitimate interest. Our analytics is privacy-first and aggregated; we do not profile individual users.</p>
        <p><strong>4.5 Compliance.</strong> To comply with our legal obligations, including under POPIA, the Companies Act 71 of 2008, the Income Tax Act 58 of 1962, and the Electronic Communications and Transactions Act 25 of 2002.</p>
      </Sec>

      <Sec id="special" title="5. Special personal information">
        <p>If you fill out a Website form or send us an email, please do not include sensitive personal information about yourself or others (for example, race, religion, health information). We do not need it for sales conversations, and SiteSign processes biometric information only on behalf of customers who have signed our Data Processing Agreement and obtained explicit Worker consent.</p>
      </Sec>

      <Sec id="retention" title="6. How long we keep your information">
        <p><strong>6.1 Demo and prospect data.</strong> We keep prospect data for as long as it is reasonably useful for sales conversations, and for at least three (3) years after our last interaction. After that, we delete or anonymise it.</p>
        <p><strong>6.2 Customer data (you, the buyer).</strong> We keep customer-account information for as long as the contract is in force and for seven (7) years after termination, to comply with section 24 of the Companies Act 71 of 2008 and the Income Tax Act 58 of 1962.</p>
        <p><strong>6.3 Worker data processed on the kiosk.</strong> Retention of Worker face descriptors, selfies, GPS data and timestamps is governed by our Data Processing Agreement with each customer. The default rules are: face descriptors and selfies deleted within seven (7) business days of the customer marking the Worker as terminated; selfies in any event auto-deleted twelve (12) months from capture; attendance records (timestamps + GPS as numeric values + corrections) retained for three (3) years from the last entry to comply with section 31 of the Basic Conditions of Employment Act, 1997.</p>
        <p><strong>6.4 Cookies.</strong> Strictly necessary cookies expire at the end of your browser session or when you next change your cookie-consent preference. Optional analytics cookies, if you opt in, expire after six (6) months.</p>
      </Sec>

      <Sec id="share" title="7. Who we share your information with">
        <p><strong>7.1 Service providers (Operators).</strong> We share your information with carefully chosen service providers who help us operate SiteSign. They process your data only on our written instructions, under contracts that bind them to data-protection obligations no less protective than those we owe you. Our service providers include:</p>
        <ul style={{ paddingLeft: 22 }}>
          <li>Vercel Inc. (United States) -- Website and Service hosting.</li>
          <li>Supabase Inc. (EU -- Frankfurt, eu-central-1) -- database and object storage.</li>
          <li>Google Workspace / Microsoft 365 (region depends on tenant) -- email and shared documents.</li>
          <li>Plausible (EU -- Estonia) -- privacy-first Website analytics, if you opt in.</li>
          <li>Domains.co.za (South Africa) -- DNS and domain management.</li>
        </ul>
        <p><strong>7.2 We do NOT.</strong> We do not sell or rent your information. We do not share your information with third-party advertisers. We do not provide it to data brokers.</p>
        <p><strong>7.3 Legal disclosure.</strong> We may disclose your information where we are required to do so by law, court order, regulator (including the Information Regulator and the South African Revenue Service), or stock exchange. Where lawful, we will give you reasonable prior notice.</p>
        <p><strong>7.4 Business transfers.</strong> If SiteSign is sold, merged, or restructured (including a transfer from Gridstone Holdings (Pty) Ltd to SiteSign (Pty) Ltd), we may transfer your information to the buyer or successor, on the same terms as this notice.</p>
      </Sec>

      <Sec id="cross-border" title="8. Cross-border transfer">
        <p>Some of the service providers in clause 7.1 are based outside South Africa. Where this is the case, we transfer your personal information in reliance on one or more of the safeguards in section 72 of POPIA, including (a) your consent, (b) the necessity of the transfer for the performance of a contract with you, and (c) written contract terms with the recipient that bind it to data-protection obligations no less protective than those we owe you. By using the Website or sending us your information, you consent to this cross-border transfer.</p>
      </Sec>

      <Sec id="security" title="9. How we secure your information">
        <p>We use a combination of technical and organisational measures to protect your information, designed against section 19 of POPIA. These include encryption in transit (TLS) and at rest, access controls and multi-factor authentication for our staff, audit logging, regular software updates, and regular review of security risks. No internet-facing system is ever perfectly secure; if we become aware of a breach affecting your personal information, we will tell you in writing without undue delay and in any event within seventy-two (72) hours of becoming aware, and we will notify the Information Regulator as required by section 22 of POPIA.</p>
      </Sec>

      <Sec id="rights" title="10. Your rights">
        <p>Under POPIA, you have the right to:</p>
        <ul style={{ paddingLeft: 22 }}>
          <li>Know what personal information we hold about you, and to be told about it (access).</li>
          <li>Have your personal information corrected if it is inaccurate, irrelevant, excessive, out of date, incomplete, misleading, or obtained unlawfully (correction).</li>
          <li>Have your personal information deleted (deletion / destruction), where we no longer have a lawful basis to hold it.</li>
          <li>Object to the processing of your personal information for direct marketing or on grounds relating to your particular situation (objection).</li>
          <li>Withdraw consent that you previously gave for processing that relies on consent (withdrawal of consent).</li>
          <li>Lodge a complaint with the Information Regulator at <a href="https://inforegulator.org.za" style={{ color: 'var(--ss-midnight-blue)' }}>https://inforegulator.org.za</a>, including by email to complaints.IR@inforegulator.org.za.</li>
        </ul>
        <p>To exercise your rights, contact our Information Officer at <a href="mailto:privacy@sitesign.co.za" style={{ color: 'var(--ss-midnight-blue)' }}>privacy@sitesign.co.za</a>. We respond to requests within thirty (30) calendar days, unless the request is complex or large, in which case we will tell you why we need more time.</p>
      </Sec>

      <Sec id="cookies" title="11. Cookie policy">
        <p><strong>11.1 What are cookies.</strong> Cookies are small text files placed on your device by websites you visit. They serve various purposes, including making the website work, remembering your preferences, and helping the website owner understand how the site is used.</p>
        <p><strong>11.2 What cookies we set.</strong> We use only the following cookies:</p>
        <PrivacyTable
          headers={['Cookie', 'Purpose', 'Type', 'Default']}
          rows={[
            ['consent',   'Records your cookie-consent choice',                                  'Strictly necessary',  'Set on first visit'],
            ['session',   'Maintains your form session if you start filling out a contact form', 'Strictly necessary',  'Session-only'],
            ['plausible', 'Aggregated visit counts (no personal identification)',                'Analytics, optional', 'OFF by default -- opt-in only'],
          ]}
        />
        <p><strong>11.3 No third-party advertising cookies.</strong> We do not set, and we do not allow third parties to set, advertising or tracking cookies on the Website.</p>
        <p><strong>11.4 How to control cookies.</strong> You can change your cookie-consent choice at any time by clicking the "Cookie preferences" link in the footer of the Website. You can also delete or block cookies through your browser settings. If you block strictly necessary cookies, parts of the Website may not work.</p>
      </Sec>

      <Sec id="children" title="12. Children">
        <p>The Website and the SiteSign Service are not directed at children under the age of 18. We do not knowingly collect personal information from anyone under 18. If we discover that we have done so, we will delete it. If you believe we have done so, please contact us at <a href="mailto:privacy@sitesign.co.za" style={{ color: 'var(--ss-midnight-blue)' }}>privacy@sitesign.co.za</a>.</p>
      </Sec>

      <Sec id="changes" title="13. Changes to this notice">
        <p>We review this notice at least annually, and update it when our practices change. The version number and last-updated date at the top of this notice show when we last did so. Material changes will be highlighted on the Website and, for active customers, communicated by email. Continued use of the Website after a change takes effect indicates your acceptance of the updated notice.</p>
      </Sec>

      <Sec id="contact" title="14. Contact us">
        <p><strong>Information Officer:</strong> Leon Kohrs, <a href="mailto:privacy@sitesign.co.za" style={{ color: 'var(--ss-midnight-blue)' }}>privacy@sitesign.co.za</a></p>
        <p><strong>Postal address:</strong> Gridstone Holdings (Pty) Ltd, 22 Wrenrose Avenue, Birdhaven, 2196, Johannesburg, South Africa</p>
        <p><strong>Information Regulator (your right to complain):</strong> <a href="https://inforegulator.org.za" style={{ color: 'var(--ss-midnight-blue)' }}>https://inforegulator.org.za</a>, complaints.IR@inforegulator.org.za, +27 12 406 4818</p>
      </Sec>

      <p style={{ color: 'var(--ss-dark-text, #4A4A4A)', fontSize: 13, marginTop: 32, opacity: 0.7, textAlign: 'center' }}>
        End of Privacy Notice v1.1
      </p>

    </div>
  </section>
);
