/* page-privacy.jsx — shared privacy notice */

function PrivacySection({ titleZh, titleEn, children }) {
  return (
    <section className="privacy-section">
      <h2><T zh={titleZh} en={titleEn} /></h2>
      {children}
    </section>
  );
}

function PrivacyList({ zh, en }) {
  const { lang } = useLang();
  const items = lang === 'zh' ? zh : en;
  return (
    <ul className="privacy-list">
      {items.map((item, i) => <li key={i}>{item}</li>)}
    </ul>
  );
}

function PagePrivacy() {
  const { lang } = useLang();
  return (
    <div className="page privacy-page">
      <header className="privacy-hero">
        <div className="label"><T zh="共享政策" en="Shared policy" /></div>
        <h1>
          <T zh="隐私通知" en="Privacy Notice" />
          <span>{lang === 'zh' ? 'Privacy Notice' : '隐私通知'}</span>
        </h1>
        <p>
          <T
            zh="本通知适用于缓约公开网站 slowcompact.com 与邀请制阅读应用 app.slowcompact.com。"
            en="This notice applies to the Slow Compact public website at slowcompact.com and the invite-only reading app at app.slowcompact.com." />
        </p>
        <p className="privacy-updated">
          <T zh="最后更新：2026 年 5 月 4 日" en="Last updated: May 4, 2026" />
        </p>
      </header>

      <PrivacySection titleZh="我们收集什么" titleEn="What We Collect">
        <PrivacyList
          zh={[
            '公开网站：浏览器和服务器自动产生的基本技术信息，例如 IP 地址、浏览器类型、访问时间和请求的页面。',
            '公开网站：语言偏好，保存在浏览器 localStorage 的 pop_lang 键中。',
            '阅读应用：登录和访问控制所需的邮箱地址、SpacetimeAuth OIDC profile/email 声明、会话令牌状态、允许名单匹配结果和受保护内容请求日志。',
            '阅读应用：语言和主题偏好，保存在浏览器 localStorage 的 pop_lang 与 sc_theme 键中。',
            '两个站点均不处理付款信息，也不提供公开注册入口。'
          ]}
          en={[
            'Public website: basic technical information generated by browsers and servers, such as IP address, browser type, request time, and pages requested.',
            'Public website: language preference stored in browser localStorage under the pop_lang key.',
            'Reading app: email address, SpacetimeAuth OIDC profile/email claims, session-token state, allowlist matching, and protected-content request logs needed for login and access control.',
            'Reading app: language and theme preferences stored in browser localStorage under the pop_lang and sc_theme keys.',
            'Neither surface processes payment information or offers public registration.'
          ]} />
      </PrivacySection>

      <PrivacySection titleZh="我们如何使用信息" titleEn="How We Use Information">
        <PrivacyList
          zh={[
            '提供公开网站、阅读应用和语言/主题偏好。',
            '确认阅读应用访问者是否使用了预先批准的邮箱。',
            '保护未公开草稿、互动组件和内容索引，防止未授权访问。',
            '排查登录、部署、安全和可用性问题。',
            '维护安全、滥用防护和基本运营记录。'
          ]}
          en={[
            'Provide the public website, reading app, and language/theme preferences.',
            'Confirm whether a reading-app visitor is using a pre-approved email address.',
            'Protect unpublished drafts, interactive components, and content indexes from unauthorized access.',
            'Debug login, deployment, security, and availability issues.',
            'Maintain security, abuse-prevention, and basic operational records.'
          ]} />
      </PrivacySection>

      <PrivacySection titleZh="服务提供商" titleEn="Service Providers">
        <p>
          <T
            zh="我们会使用托管、网络安全、认证、字体和脚本 CDN 提供商来运行这些站点。阅读应用当前使用 SpacetimeAuth 进行 OIDC 邮件魔法链接登录，并使用 Cloudflare Workers/Pages 进行托管和访问控制。页面还会从 Google Fonts 与 unpkg CDN 加载公开前端资源。这些提供商可能按其服务职能处理技术日志、认证数据和网络请求数据。"
            en="We use hosting, security, authentication, font, and script-CDN providers to operate these sites. The reading app currently uses SpacetimeAuth for OIDC email magic-link login and Cloudflare Workers/Pages for hosting and access control. Pages also load public frontend resources from Google Fonts and the unpkg CDN. These providers may process technical logs, authentication data, and network request data as part of their services." />
        </p>
      </PrivacySection>

      <PrivacySection titleZh="我们不会出售数据" titleEn="We Do Not Sell Data">
        <p>
          <T
            zh="我们不会出售个人信息，也不会为跨站行为广告共享个人信息。当前站点不使用广告网络、付款处理器或公开用户资料。"
            en="We do not sell personal information or share it for cross-context behavioral advertising. The current sites do not use ad networks, payment processors, or public user profiles." />
        </p>
      </PrivacySection>

      <PrivacySection titleZh="保留与删除" titleEn="Retention and Deletion">
        <PrivacyList
          zh={[
            '允许名单邮箱会保留到访问不再需要或被移除为止。',
            '浏览器偏好保留在你的设备中，直到你清除浏览器数据或应用重新写入。',
            '认证状态由 SpacetimeAuth/OIDC 客户端和浏览器存储管理；退出登录或清除本地会话会移除本地会话状态。',
            '托管、安全和访问日志按相关服务提供商的默认保留周期或运营需要保留。'
          ]}
          en={[
            'Allowlisted emails are kept until access is no longer needed or the email is removed.',
            'Browser preferences remain on your device until you clear browser data or the app overwrites them.',
            'Authentication state is managed by SpacetimeAuth/OIDC client storage and the browser; signing out or clearing the local session removes local session state.',
            "Hosting, security, and access logs are kept according to the relevant service providers' default retention periods or operational need."
          ]} />
      </PrivacySection>

      <PrivacySection titleZh="你的选择" titleEn="Your Choices">
        <PrivacyList
          zh={[
            '你可以清除浏览器 localStorage 来移除本地语言和主题偏好。',
            '你可以退出阅读应用并清除本地会话。',
            '你可以请求移除阅读应用允许名单中的邮箱；移除后将无法访问会员内容。',
            '如果你所在地区提供访问、删除、更正或反对处理等隐私权利，可通过页脚列出的 Slow Compact 公开联系渠道提出请求。'
          ]}
          en={[
            'You can clear browser localStorage to remove local language and theme preferences.',
            'You can sign out of the reading app and clear the local session.',
            'You can request removal of an email from the reading-app allowlist; removal will end access to member content.',
            'If your region provides privacy rights such as access, deletion, correction, or objection, use the public Slow Compact contact channel linked in the footer to make a request.'
          ]} />
      </PrivacySection>

      <PrivacySection titleZh="儿童" titleEn="Children">
        <p>
          <T
            zh="这些站点面向一般成人与青少年读者，不面向 13 岁以下儿童。阅读应用仅向预先批准的邮箱开放。如果你认为 13 岁以下儿童向我们提供了个人信息，请通过页脚联系渠道告知。"
            en="These sites are intended for a general adult and teen audience, not for children under 13. The reading app is limited to pre-approved email addresses. If you believe a child under 13 has provided personal information, use the footer contact channel to let us know." />
        </p>
      </PrivacySection>

      <PrivacySection titleZh="变更" titleEn="Changes">
        <p>
          <T
            zh="如果数据收集、认证、分析、付款、公开注册或用户提交功能发生变化，我们会更新本通知并调整页面上的更新日期。"
            en="If data collection, authentication, analytics, payments, public registration, or user-submission features change, we will update this notice and adjust the update date on this page." />
        </p>
      </PrivacySection>
    </div>
  );
}

Object.assign(window, { PagePrivacy });
