// Terms of Use & Privacy Policy — real, formal legal content for the Institute.
function TermsPage({ onNav, lang }) {
  const T = lang === 'ZH';
  return (
    <LegalLayout title={T ? '使用条款' : 'Terms of Use'} kicker={T ? '法律声明' : 'Legal Notice'} updated="25 May 2026" onNav={onNav} lang={lang}>
      <LegalIntro>
        {T
          ? '本《使用条款》（下称「本条款」）规范您对GreenBridge Institute（GreenBridge Institute，下称「本研究院」「我们」）所运营的网站及相关在线资源（统称「本网站」）的访问与使用。当您访问或使用本网站时，即视为您已阅读、理解并同意接受本条款。如您不同意本条款的任何部分，请不要使用本网站。'
          : 'These Terms of Use (the “Terms”) govern your access to and use of the website and related online resources (collectively, the “Site”) operated by GreenBridge Institute (the “Institute,” “we,” “our,” or “us”). By accessing or using the Site, you acknowledge that you have read, understood, and agree to be bound by these Terms. If you do not agree to any part of these Terms, please do not use the Site.'}
      </LegalIntro>

      <LegalSection title={T ? '一、本研究院' : '1. About the Institute'}>
        {T
          ? 'GreenBridge Institute是依据中国香港特别行政区法律注册成立的非营利研究机构，注册办事处位于：中国香港中环皇后大道中 30 号娱乐行 29 楼。本研究院专注于全球气候人才、气候教育以及新兴市场绿色经济的研究、召集与项目工作。'
          : 'GreenBridge Institute is a non-profit research entity established under the laws of the Hong Kong Special Administrative Region. Its registered office is located at 29/F, Entertainment Building, 30 Queen’s Road Central, Hong Kong. The Institute conducts research, convening, and program work on global sustainability talent, sustainability education, and the green economies of emerging markets.'}
      </LegalSection>

      <LegalSection title={T ? '二、使用许可' : '2. Permitted Use'}>
        {T
          ? '在您遵守本条款的前提下，本研究院授予您一项有限、非独占、不可转让、可撤销的许可，仅供您出于个人非商业目的查阅本网站的内容。未经本研究院事先书面同意，您不得以任何形式复制、复述、再发布、修改、分发、出售或以其他方式商业使用本网站的任何内容。'
          : 'Subject to your compliance with these Terms, the Institute grants you a limited, non-exclusive, non-transferable, revocable license to access and view the Site for personal, non-commercial purposes. You may not reproduce, retransmit, republish, modify, distribute, sell, or otherwise commercially exploit any portion of the Site without the Institute’s prior written consent.'}
      </LegalSection>

      <LegalSection title={T ? '三、知识产权' : '3. Intellectual Property'}>
        {T
          ? '本网站上的所有内容，包括但不限于文字、图像、徽标、图标、研究材料、出版物、视频与代码（统称「内容」），均为本研究院或其内容许可方所有，并受国际与本地的版权、商标及其他相关法律保护。除本条款明确授予的有限许可外，未经本研究院事先书面授权，您不得使用本网站上的任何商标、徽标或其他专有标识。'
          : 'All content on the Site, including but not limited to text, images, logos, icons, research materials, publications, videos, and code (collectively, the “Content”), is the property of the Institute or its content licensors and is protected by international and local copyright, trademark, and other applicable laws. Except for the limited license expressly granted in these Terms, no use of any trademark, logo, or other proprietary mark on the Site is permitted without the Institute’s prior written authorisation.'}
      </LegalSection>

      <LegalSection title={T ? '四、第三方内容与链接' : '4. Third-Party Content and Links'}>
        {T
          ? '本网站可能包含指向第三方网站、服务或内容的链接，或嵌入由第三方提供的素材（如表单、视频与图像）。本研究院对该等第三方内容的准确性、合法性或可用性不作任何承诺，您访问或使用该等第三方资源所产生的一切风险由您自行承担。'
          : 'The Site may contain links to third-party websites, services, or content, and may embed materials provided by third parties (such as forms, videos, and images). The Institute makes no representations regarding the accuracy, legality, or availability of any such third-party content, and you access or use such third-party resources entirely at your own risk.'}
      </LegalSection>

      <LegalSection title={T ? '五、用户提交' : '5. User Submissions'}>
        {T
          ? '如您通过本网站、电子邮件或我们使用的合作伙伴登记表向本研究院提供任何信息（包括姓名、所属机构、邮件地址与合作意向），即视为您已同意：（1）所提供信息真实、准确、不侵犯第三方权利；（2）本研究院可在与表格目的相关的范围内，使用该等信息进行评估、回复与后续合作沟通。本研究院按其在线发布的隐私政策处理您的个人资料。'
          : 'If you submit information to the Institute through the Site, by email, or through the partner-registration form we use (including your name, affiliation, email address, and interest in collaboration), you represent and warrant that: (i) the information you provide is true, accurate, and does not infringe any third-party rights; and (ii) the Institute may use such information, in scope of the relevant purpose of the form, for evaluation, response, and follow-up engagement. The Institute processes your personal data in accordance with its published Privacy Policy.'}
      </LegalSection>

      <LegalSection title={T ? '六、免责声明' : '6. Disclaimer'}>
        {T
          ? '本网站及其内容按「现状」与「现有」基础提供，不附带任何明示或默示的保证，包括但不限于关于准确性、完整性、适销性、特定用途适用性或不侵权的任何保证。在法律允许的最大范围内，本研究院不就本网站的可用性、不间断性或无错误性作任何承诺。'
          : 'The Site and the Content are provided on an “as-is” and “as-available” basis, without warranties of any kind, whether express or implied, including without limitation any warranties of accuracy, completeness, merchantability, fitness for a particular purpose, or non-infringement. To the fullest extent permitted by law, the Institute makes no representation that the Site will be available, uninterrupted, or error-free.'}
      </LegalSection>

      <LegalSection title={T ? '七、责任限制' : '7. Limitation of Liability'}>
        {T
          ? '在法律允许的最大范围内，对于您使用或无法使用本网站而产生的任何直接、间接、附带、特殊、惩罚性或后果性损失（包括但不限于利润损失、商誉损失、数据损失或替代服务费用），本研究院、其董事、雇员、顾问与合作伙伴均不承担任何责任。'
          : 'To the fullest extent permitted by law, neither the Institute nor its directors, employees, advisors, or partners shall be liable for any direct, indirect, incidental, special, punitive, or consequential damages (including, without limitation, lost profits, lost goodwill, lost data, or cost of substitute services) arising out of or in connection with your use of, or inability to use, the Site.'}
      </LegalSection>

      <LegalSection title={T ? '八、适用法律与争议解决' : '8. Governing Law and Disputes'}>
        {T
          ? '本条款受中国香港特别行政区法律管辖并依其解释。因本条款或本网站所引起或与之相关的任何争议，应提交香港特别行政区法院专属管辖。'
          : 'These Terms shall be governed by and construed in accordance with the laws of the Hong Kong Special Administrative Region. Any disputes arising out of or in connection with these Terms or the Site shall be subject to the exclusive jurisdiction of the courts of the Hong Kong Special Administrative Region.'}
      </LegalSection>

      <LegalSection title={T ? '九、条款修改' : '9. Changes to These Terms'}>
        {T
          ? '本研究院可随时根据需要修订本条款。修订后的条款将在本网站发布后立即生效。您持续访问或使用本网站，即视为您接受经修订的条款。'
          : 'The Institute may revise these Terms from time to time at its discretion. Revised Terms will take effect immediately upon being posted on the Site. Your continued access to or use of the Site constitutes your acceptance of the revised Terms.'}
      </LegalSection>

      <LegalSection title={T ? '十、联系方式' : '10. Contact'}>
        {T
          ? '若您对本条款有任何问题，欢迎通过本网站「与我们合作」表格与本研究院联系。'
          : 'If you have any questions about these Terms, please contact the Institute via the “Partner With Us” form on this Site.'}
      </LegalSection>
    </LegalLayout>
  );
}

function PrivacyPage({ onNav, lang }) {
  const T = lang === 'ZH';
  return (
    <LegalLayout title={T ? '隐私政策' : 'Privacy Policy'} kicker={T ? '法律声明' : 'Legal Notice'} updated="25 May 2026" onNav={onNav} lang={lang}>
      <LegalIntro>
        {T
          ? 'GreenBridge Institute（下称「本研究院」）致力于保护您的个人资料。本《隐私政策》说明本研究院在您访问或使用本网站、向本研究院提交咨询或合作意向时，如何收集、使用、披露与保护您的个人资料。本政策依据《个人资料（私隐）条例》（香港法例第 486 章）的原则编写。'
          : 'GreenBridge Institute (the “Institute”) is committed to protecting your personal data. This Privacy Policy explains how the Institute collects, uses, discloses, and safeguards your personal data when you visit or use the Site or submit an inquiry or partnership request to us. This policy has been prepared with reference to the principles of the Personal Data (Privacy) Ordinance (Cap. 486 of the Laws of Hong Kong).'}
      </LegalIntro>

      <LegalSection title={T ? '一、本政策涵盖的资料' : '1. Personal Data We Collect'}>
        {T
          ? '本研究院在以下情形下可能收集您的个人资料：（一）您通过本网站的合作伙伴登记表提交的姓名、所属机构、电邮地址及合作意向；（二）您通过电子邮件或其他渠道主动与本研究院联络时提供的信息；（三）您访问本网站时，浏览器自动传送的技术性信息，例如 IP 地址、浏览器类型、访问时间与所访问页面。'
          : 'The Institute may collect your personal data in the following circumstances: (i) information you provide through our partner registration form on the Site, including your name, affiliation, email address, and partnership interest; (ii) information you provide when you contact the Institute by email or other channels; and (iii) technical information transmitted automatically by your browser when you visit the Site, such as IP address, browser type, time of access, and pages viewed.'}
      </LegalSection>

      <LegalSection title={T ? '二、资料使用目的' : '2. How We Use Personal Data'}>
        {T
          ? '本研究院仅在以下与履行其使命相关的目的范围内使用您的个人资料：（一）评估与回复合作、媒体咨询、研究合作及其他业务请求；（二）就本研究院的项目、活动、研究成果及公开发布与您沟通；（三）改进本网站及本研究院的服务；（四）满足适用法律或监管要求。'
          : 'The Institute uses your personal data only for purposes related to its mission, including: (i) evaluating and responding to partnership, media, research, and other business inquiries; (ii) communicating with you about the Institute’s programs, events, research outputs, and public announcements; (iii) improving the Site and the Institute’s services; and (iv) complying with applicable legal or regulatory obligations.'}
      </LegalSection>

      <LegalSection title={T ? '三、资料分享' : '3. Sharing of Personal Data'}>
        {T
          ? '本研究院不会出售您的个人资料。本研究院仅在以下情形下与第三方分享您的个人资料：（一）经您同意；（二）与本研究院的服务提供方（如表格托管平台、电子邮件平台、网站托管服务）分享，且仅限于其为本研究院提供服务所必需的范围；（三）法律法规要求披露的情形。'
          : 'The Institute does not sell your personal data. The Institute will share your personal data with third parties only in the following circumstances: (i) with your consent; (ii) with the Institute’s service providers (such as form-hosting platforms, email platforms, and website-hosting providers), and only to the extent necessary for them to provide services to the Institute; or (iii) where disclosure is required by applicable laws or regulations.'}
      </LegalSection>

      <LegalSection title={T ? '四、跨境数据传输' : '4. Cross-Border Data Transfers'}>
        {T
          ? '本研究院的部分服务提供方位于中国香港以外的司法管辖区。在我们将您的个人资料传输至该等司法管辖区时，本研究院将采取合理措施确保该等传输受到与本政策相当的保护。'
          : 'Certain of the Institute’s service providers are located in jurisdictions outside the Hong Kong Special Administrative Region. Where personal data is transferred to such jurisdictions, the Institute takes reasonable steps to ensure that any such transfer is protected to a standard consistent with this Privacy Policy.'}
      </LegalSection>

      <LegalSection title={T ? '五、数据安全与保留' : '5. Data Security and Retention'}>
        {T
          ? '本研究院将采取合理的技术与组织措施，保护您的个人资料免受未经授权的访问、披露、变更或销毁。本研究院仅在与原始收集目的相关的合理期限内保留您的个人资料，期满后将按照内部规程予以销毁或匿名化处理。'
          : 'The Institute applies reasonable technical and organisational measures to protect your personal data against unauthorised access, disclosure, alteration, or destruction. The Institute retains personal data only for as long as is reasonably necessary for the purpose for which it was originally collected, after which the data is securely destroyed or anonymised in accordance with internal procedures.'}
      </LegalSection>

      <LegalSection title={T ? '六、您的权利' : '6. Your Rights'}>
        {T
          ? '根据适用法律，您有权要求查阅本研究院持有的关于您的个人资料，要求更正不准确的资料，或要求本研究院停止以营销目的使用您的资料。如希望行使上述权利，请通过本网站「与我们合作」表格联系本研究院。'
          : 'Subject to applicable law, you have the right to request access to the personal data the Institute holds about you, to request correction of inaccurate data, and to request that the Institute cease using your data for marketing purposes. To exercise any of these rights, please contact the Institute through the “Partner With Us” form on this Site.'}
      </LegalSection>

      <LegalSection title={T ? '七、Cookie 与同类技术' : '7. Cookies and Similar Technologies'}>
        {T
          ? '本网站可能使用最低限度的浏览器存储（例如 localStorage）以记住您的语言偏好与浏览状态。本网站不使用第三方广告 Cookie，亦不在未经您知情的情况下跨站追踪您的浏览行为。'
          : 'The Site may use minimal browser storage (such as localStorage) to remember your language preference and navigation state. The Site does not use third-party advertising cookies, nor does it track your browsing behaviour across other sites without your knowledge.'}
      </LegalSection>

      <LegalSection title={T ? '八、政策更新' : '8. Updates to This Policy'}>
        {T
          ? '本研究院可不时更新本政策。更新后的政策将在本网站发布后即时生效，并以「更新日期」为准。'
          : 'The Institute may update this Privacy Policy from time to time. The updated policy will take effect immediately upon being posted on the Site, identified by the “Updated” date above.'}
      </LegalSection>

      <LegalSection title={T ? '九、联系方式' : '9. Contact'}>
        {T
          ? '如您对本政策或本研究院的资料处理方式有任何问题，欢迎通过本网站「与我们合作」表格联系本研究院。'
          : 'If you have any questions about this Privacy Policy or about the Institute’s data practices, please contact the Institute via the “Partner With Us” form on this Site.'}
      </LegalSection>
    </LegalLayout>
  );
}

// --- Layout helpers ---
function LegalLayout({ title, kicker, updated, children, onNav, lang }) {
  const T = lang === 'ZH';
  return (
    <div>
      <section style={{ padding: '80px var(--gb-gx) 64px', borderBottom: `1px solid ${GB_TOKENS.line2}` }}>
        <div className="gb-mono" style={{ color: GB_TOKENS.muted, marginBottom: 32 }}>{kicker}</div>
        <h1 className="gb-hero-h1">
          {title}
        </h1>
        <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 56, gap: 32, flexWrap: 'wrap' }}>
          <div className="gb-mono" style={{ color: GB_TOKENS.muted }}>
            {T ? '更新日期' : 'Updated'} &nbsp; {updated}
          </div>
          <div style={{ display: 'flex', gap: 32 }}>
            <a className="nav-link" onClick={() => onNav('terms')}>{T ? '使用条款' : 'Terms of Use'}</a>
            <a className="nav-link" onClick={() => onNav('privacy')}>{T ? '隐私政策' : 'Privacy Policy'}</a>
          </div>
        </div>
      </section>

      <section style={{ padding: '80px var(--gb-gx) 140px' }}>
        <div className="gb-split" style={{ maxWidth: 1400 }}>
          <aside className="gb-legal-aside" style={{ position: 'sticky', top: 100, alignSelf: 'start' }}>
            <div className="gb-mono" style={{ color: GB_TOKENS.muted, marginBottom: 18 }}>
              {T ? '关于本声明' : 'About this notice'}
            </div>
            <div style={{ fontSize: 14, lineHeight: 1.7, color: GB_TOKENS.ink2, maxWidth: 320 }}>
              {T
                ? '本页面构成本研究院在线声明的一部分。您持续访问或使用本网站，即视为您接受本声明的条款。'
                : 'This page forms part of the Institute’s public legal notices. By continuing to use the Site, you accept the terms set out herein.'}
            </div>
          </aside>
          <div>
            {children}
          </div>
        </div>
      </section>
    </div>
  );
}

function LegalIntro({ children }) {
  return (
    <div className="gb-serif" style={{ fontSize: 22, lineHeight: 1.55, color: GB_TOKENS.ink, paddingBottom: 36, borderBottom: `1px solid ${GB_TOKENS.line2}`, marginBottom: 36, maxWidth: 820 }}>
      {children}
    </div>
  );
}

function LegalSection({ title, children }) {
  return (
    <section style={{ marginBottom: 44, maxWidth: 820 }}>
      <h2 className="gb-serif" style={{ fontSize: 26, letterSpacing: '-0.01em', lineHeight: 1.2, margin: 0, marginBottom: 16 }}>{title}</h2>
      <div style={{ fontSize: 15.5, lineHeight: 1.8, color: GB_TOKENS.ink2 }}>{children}</div>
    </section>
  );
}

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