const DL = window.DuologueDesignSystem_a613c9;

/* Shared legal-page layout: header band + single prose column with numbered
   sections. `sections` = [{ h, p:[ string | [list items] ] }]. Exposed globally
   so screen-privacy.jsx can reuse it. */
function LegalPage({ eyebrow = "Legal", title, updated, intro, sections }) {
  return <>
    <section style={{ position: "relative", overflow: "hidden", background: "var(--surface-page)", borderBottom: "var(--border-hairline)" }}>
      <span aria-hidden="true" style={{
        position: "absolute", inset: 0, pointerEvents: "none",
        backgroundImage: "linear-gradient(to right, rgba(9,72,182,.06) 1px, transparent 1px), linear-gradient(to bottom, rgba(9,72,182,.06) 1px, transparent 1px)",
        backgroundSize: "46px 46px",
        WebkitMaskImage: "radial-gradient(120% 100% at 30% 0%, #000 20%, transparent 78%)",
        maskImage: "radial-gradient(120% 100% at 30% 0%, #000 20%, transparent 78%)"
      }} />
      <div className="du-container" style={{ position: "relative", paddingBlock: "clamp(52px,7vw,104px)" }}>
        <div style={{ maxWidth: 820 }}>
          <div style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".14em", textTransform: "uppercase", color: "var(--text-brand)", marginBottom: 18, display: "flex", gap: 10, alignItems: "center" }}>
            <span style={{ width: 6, height: 6, background: "var(--text-brand)" }} />{eyebrow}
          </div>
          <h1 style={{ fontFamily: "var(--font-display)", fontWeight: 500, fontSize: "var(--text-display-3)", lineHeight: 1.05, letterSpacing: "var(--tracking-display)", margin: 0 }}>{title}</h1>
          <p style={{ marginTop: 18, fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".08em", textTransform: "uppercase", color: "var(--text-muted)" }}>Last updated {updated}</p>
        </div>
      </div>
    </section>

    <section className="du-container" style={{ paddingBlock: "clamp(48px,6vw,88px)" }}>
      <div style={{ maxWidth: 760 }}>
        {intro && <p style={{ fontSize: 18, lineHeight: 1.7, color: "var(--text-body)", marginBottom: 44 }}>{intro}</p>}
        {sections.map((s, i) => (
          <section key={i} style={{ marginBottom: 40 }}>
            <h2 style={{ fontSize: "var(--text-h3)", fontWeight: 700, color: "var(--text-strong)", letterSpacing: "-0.012em", lineHeight: 1.25, marginBottom: 16 }}>{i + 1}. {s.h}</h2>
            {s.p.map((para, j) => Array.isArray(para)
              ? <ul key={j} style={{ margin: "0 0 16px", paddingLeft: 22 }}>{para.map((li, k) => <li key={k} style={{ fontSize: 16.5, lineHeight: 1.7, color: "var(--text-body)", marginBottom: 8 }}>{li}</li>)}</ul>
              : <p key={j} style={{ fontSize: 16.5, lineHeight: 1.72, color: "var(--text-body)", marginBottom: 14 }}>{para}</p>
            )}
          </section>
        ))}
      </div>
    </section>
  </>;
}
window.LegalPage = LegalPage;

const DUOLOGUE_OFFICE = "Dubai Founders HQ, 25 Hours, One Central, Dubai, United Arab Emirates";

function TermsScreen() {
  return <LegalPage
    title="Terms & Conditions"
    updated="29 August 2026"
    intro={<>These Terms &amp; Conditions (the “Terms”) govern your access to and use of the Duologue platform, websites, applications, and related services (together, the “Service”), operated by Duologue (“Duologue”, “we”, “us”, or “our”). Our registered office is at {DUOLOGUE_OFFICE}. By accessing or using the Service, you agree to be bound by these Terms. Please read them carefully.</>}
    sections={[
      { h: "Interpretation and definitions", p: [
        "Capitalised terms have the meaning given below. “Account” means the account you create to access the Service. “Customer” or “you” means the individual or organisation using the Service. “Customer Data” means the data you connect, upload, or generate through the Service, including account signals, CRM records, contact details, and the content and metadata of messages you draft or send. “Order” means a subscription or order form referencing these Terms.",
        "Headings are for convenience only and do not affect interpretation. Words in the singular include the plural and vice versa."
      ]},
      { h: "Acknowledgement and eligibility", p: [
        "By using the Service you confirm that you are at least 18 years old and that, where you use the Service on behalf of an organisation, you have authority to bind that organisation to these Terms. Your use of the Service is also governed by our Privacy Policy, which is incorporated into these Terms by reference.",
        "If you do not agree to these Terms, you must not access or use the Service."
      ]},
      { h: "Accounts and access", p: [
        "You are responsible for maintaining the confidentiality of your account credentials and for all activity that occurs under your Account. You must notify us promptly of any unauthorised use. You are responsible for ensuring that each user of your Account complies with these Terms.",
        "We may offer administrative controls that allow you to manage users, connected data sources, and permissions. You are responsible for how those controls are configured."
      ]},
      { h: "Acceptable use", p: [
        "You agree to use the Service only for lawful purposes and in accordance with these Terms. You must not:",
        [
          "reverse engineer, decompile, or attempt to derive the source code of the Service, except to the extent permitted by law;",
          "copy, resell, sublicense, or build a competing product using the Service;",
          "access the Service to send unlawful, deceptive, or unsolicited communications, or to violate any applicable anti-spam, privacy, or electronic-communications laws;",
          "upload malicious code, interfere with the Service, or attempt to gain unauthorised access to any system or data; or",
          "use the Service in a way that infringes the rights of any third party."
        ],
        "You are solely responsible for the messages, sequences, and other outbound communications you create or send using the Service, and for obtaining any consents required to contact your recipients."
      ]},
      { h: "Customer Data and account signals", p: [
        "As between you and Duologue, you retain all rights to your Customer Data. You grant us a non-exclusive, worldwide licence to host, process, and use your Customer Data solely to provide, secure, and improve the Service for you, and as otherwise permitted in our Privacy Policy.",
        "The Service watches for changes at your accounts (“account signals”) and connects to sources such as your email, calendar, dialer, and CRM only where you authorise it to do so. You may disconnect a source at any time.",
        "We do not sell your Customer Data, and we do not use your Customer Data to train shared or third-party artificial-intelligence models."
      ]},
      { h: "Third-party services and integrations", p: [
        "The Service integrates with third-party products, including CRM systems, email providers, and dialers. Your use of those products is governed by the relevant third party’s terms and privacy practices. We are not responsible for third-party services, and their availability or behaviour is outside our control.",
        "Links to third-party websites are provided for convenience only and do not imply endorsement."
      ]},
      { h: "Fees and subscriptions", p: [
        "Paid plans are billed as set out in your Order, typically per seat. Fees are exclusive of taxes, which you are responsible for paying. Unless stated otherwise, fees are non-refundable except where required by law.",
        "We may change our fees on renewal by giving you reasonable prior notice. If you do not agree to a change, you may choose not to renew."
      ]},
      { h: "Intellectual property", p: [
        "The Service, including all software, design, and content provided by us (excluding Customer Data), is owned by Duologue or its licensors and is protected by intellectual-property laws. These Terms do not grant you any rights in the Service other than the limited right to use it in accordance with these Terms.",
        "If you provide feedback or suggestions, you grant us a perpetual, royalty-free licence to use them without restriction."
      ]},
      { h: "Confidentiality", p: [
        "Each party may receive confidential information from the other. Each party agrees to protect the other’s confidential information with reasonable care and to use it only as necessary to perform under these Terms, except where disclosure is required by law."
      ]},
      { h: "Term and termination", p: [
        "These Terms apply for as long as you use the Service. You may stop using the Service at any time. We may suspend or terminate your access if you breach these Terms, if required by law, or to protect the Service or other users.",
        "On termination, your right to use the Service ends. We will make your Customer Data available for export for a limited period, after which it may be deleted in accordance with our Privacy Policy."
      ]},
      { h: "Disclaimers", p: [
        "The Service is provided “as is” and “as available”, without warranties of any kind, whether express or implied, including any implied warranties of merchantability, fitness for a particular purpose, and non-infringement. We do not warrant that the Service will be uninterrupted, error-free, or that account signals or drafted content will be accurate or complete. You are responsible for reviewing any content before you send it."
      ]},
      { h: "Limitation of liability", p: [
        "To the maximum extent permitted by law, Duologue will not be liable for any indirect, incidental, special, consequential, or punitive damages, or for any loss of profits, revenue, data, or goodwill. Our total aggregate liability arising out of or relating to the Service will not exceed the greater of the amount you paid to us in the twelve months before the event giving rise to the liability, or USD 100."
      ]},
      { h: "Indemnification", p: [
        "You agree to indemnify and hold Duologue harmless from any claims, losses, or expenses arising out of your Customer Data, your use of the Service in breach of these Terms, or your violation of any law or third-party right."
      ]},
      { h: "Governing law", p: [
        "These Terms and any dispute or claim arising out of or in connection with them are governed by, and construed in accordance with, the laws of the Dubai International Financial Centre (DIFC), Dubai, United Arab Emirates, without regard to conflict-of-laws principles."
      ]},
      { h: "Dispute resolution", p: [
        "The courts of the DIFC, Dubai shall have exclusive jurisdiction to settle any dispute or claim arising out of or in connection with these Terms or the Service, and each party irrevocably submits to that jurisdiction."
      ]},
      { h: "Changes to these Terms", p: [
        "We may update these Terms from time to time. If we make material changes, we will take reasonable steps to notify you, for example by posting the updated Terms with a new “last updated” date. Your continued use of the Service after the changes take effect constitutes acceptance of the updated Terms."
      ]},
      { h: "Contact us", p: [
        <>If you have any questions about these Terms, contact us at <a href="mailto:legal@duologue.com">legal@duologue.com</a>, or write to us at {DUOLOGUE_OFFICE}.</>
      ]}
    ]} />;
}
window.TermsScreen = TermsScreen;
