import type { Metadata } from "next";
import Link from "next/link";
import styles from "../privacy/privacy.module.css";
import { DISCORD_INVITE_URL, SITE_NAME } from "@/lib/constants";

export const metadata: Metadata = {
  title: "Terms of Service & Rules | sinss.lol",
  description: "Terms of service, site rules, DMCA copyright policy, and digital goods terms for sinss.lol.",
  alternates: { canonical: "/terms" },
};

const sections = [
  ["accounts", "01 / Accounts & eligibility"],
  ["profiles", "02 / Content & conduct"],
  ["dmca", "03 / Copyright & DMCA policy"],
  ["purchases", "04 / Purchases & digital goods"],
  ["abuse", "05 / Platform integrity"],
  ["liability", "06 / Disclaimers & liability"],
  ["enforcement", "07 / Enforcement & legal contact"],
] as const;

export default function TermsPage() {
  return (
    <main className={styles.privacyPage}>
      <div className={styles.privacyShell}>
        <header className={styles.privacyTopbar}>
          <Link className={styles.privacyBrand} href="/" aria-label={`${SITE_NAME} home`}>
            {/* eslint-disable-next-line @next/next/no-img-element */}
            <img src="/addons/logo.svg" alt="" width={24} height={24} />
            <span>{SITE_NAME}</span>
          </Link>
          <Link className={styles.privacyHome} href="/">Back to home</Link>
        </header>

        <section className={styles.privacyHero} aria-labelledby="terms-title">
          <div className={styles.privacyEyebrow}>Legal & Compliance</div>
          <h1 id="terms-title">Terms of Service & Site Rules</h1>
          <p className={styles.privacyLead}>
            Please review these terms carefully before using {SITE_NAME}. By registering an account or accessing the platform, you agree to comply with all terms, site rules, and applicable laws.
          </p>
        </section>

        <div className={styles.privacyLayout}>
          <article className={styles.privacyArticle}>
            <section className={styles.privacySection} id="accounts">
              <p className={styles.privacySectionLabel}>01 / Eligibility</p>
              <h2>Accounts and eligibility</h2>
              <ul className={styles.privacyRules}>
                <li><strong>Age requirement:</strong> You must be at least 13 years old (or 16 in the European Economic Area and United Kingdom) to create an account or use {SITE_NAME}. If you are under this age, you are strictly prohibited from using the platform.</li>
                <li><strong>Identity:</strong> Do not impersonate another individual, creator, brand, or entity, or mislead visitors regarding your identity.</li>
                <li><strong>Security:</strong> You are responsible for safeguarding your login credentials. Do not access or attempt to access another person&apos;s account.</li>
                <li><strong>Account limits:</strong> Users are permitted up to 3 personal accounts (up to 5 for Lifetime Premium holders). Creating clusters or alts to bypass suspensions or restrictions will result in immediate termination.</li>
              </ul>
            </section>

            <section className={styles.privacySection} id="profiles">
              <p className={styles.privacySectionLabel}>02 / Conduct</p>
              <h2>User content and conduct</h2>
              <ul className={styles.privacyRules}>
                <li><strong>Zero tolerance:</strong> You may not upload, link, or display content that depicts child sexual abuse material (CSAM), non-consensual intimate imagery, terrorism, credible threats of violence, self-harm encouragement, or hate speech.</li>
                <li><strong>Safety and privacy:</strong> Doxxing, targeted harassment, stalking, and publishing another person&apos;s non-public private data are strictly forbidden.</li>
                <li><strong>Security threats:</strong> You may not host or link to phishing pages, credential stealers, malware, crypters, or illegal circumvention tools.</li>
                <li><strong>Public profiles:</strong> Content published to your public bio link is publicly accessible. Exercise caution regarding what personal details you make public.</li>
              </ul>
            </section>

            <section className={styles.privacySection} id="dmca">
              <p className={styles.privacySectionLabel}>03 / Intellectual Property</p>
              <h2>Copyright and DMCA policy</h2>
              <p>
                {SITE_NAME} respects intellectual property rights and adheres to the safe harbor provisions of the Digital Millennium Copyright Act (17 U.S.C. § 512).
              </p>
              <div className={styles.privacyCallout}>
                If you believe content hosted on {SITE_NAME} (such as audio, artwork, or video) infringes your copyright, please email our designated agent at{" "}
                <a href="mailto:legal@sinss.lol" style={{ color: "var(--privacy-mint)", textDecoration: "underline" }}>
                  legal@sinss.lol
                </a>{" "}
                with &quot;DMCA Takedown Request&quot; in the subject line.
              </div>
              <p style={{ marginTop: 16 }}>Your notice must include:</p>
              <ul className={styles.privacyRules}>
                <li>Identification of the copyrighted work claimed to have been infringed.</li>
                <li>The exact URL, handle, or path of the allegedly infringing material on {SITE_NAME}.</li>
                <li>Your contact details (full name, mailing address, telephone number, and email address).</li>
                <li>A statement that you have a good faith belief that the disputed use is not authorized by the copyright owner, its agent, or the law.</li>
                <li>A statement made under penalty of perjury that the information in the notification is accurate and that you are authorized to act on behalf of the copyright owner.</li>
                <li>An electronic or physical signature of the authorized copyright holder.</li>
              </ul>
              <p style={{ marginTop: 14 }}>
                <strong>Repeat infringer policy:</strong> In accordance with the DMCA and international copyright law, {SITE_NAME} will promptly terminate accounts of users determined to be repeat copyright infringers.
              </p>
            </section>

            <section className={styles.privacySection} id="purchases">
              <p className={styles.privacySectionLabel}>04 / Commerce</p>
              <h2>Purchases and digital goods</h2>
              <ul className={styles.privacyRules}>
                <li><strong>Direct software features:</strong> All store offerings (Lifetime Premium, creator supporter bundles, username rename tokens, audio slots, and verified badges) are digital software enhancements activated immediately on your profile.</li>
                <li><strong>Payment processing:</strong> Transactions are processed through verified merchant partners (Polar.sh / Stripe). {SITE_NAME} does not store raw credit card numbers.</li>
                <li><strong>Refund policy:</strong> Because digital software enhancements and premium features are delivered and unlocked instantly upon successful payment, all sales are final once fulfilled, except where required by applicable consumer protection laws. If you experience a verified technical billing error or duplicate charge, submit a ticket or contact <a href="mailto:legal@sinss.lol" style={{ color: "var(--privacy-mint)", textDecoration: "underline" }}>legal@sinss.lol</a> within 14 days of purchase.</li>
                <li><strong>Sinss Credits:</strong> Credits are non-monetary virtual units earned solely through site participation (daily streaks, tips, drops). Credits have no cash value, cannot be redeemed for fiat currency, and cannot be bought or sold for real money.</li>
              </ul>
            </section>

            <section className={styles.privacySection} id="abuse">
              <p className={styles.privacySectionLabel}>05 / Integrity</p>
              <h2>Platform integrity and anti-botting</h2>
              <ul className={styles.privacyRules}>
                <li><strong>Automated abuse:</strong> Automated scraping, self-botting, headless script execution, automated account creation, and rapid handle check flooding are strictly forbidden.</li>
                <li><strong>Metric manipulation:</strong> Artificially inflating views, likes, leaderboard rankings, or badges via proxies, VPN farms, or automation will result in immediate disqualification and account suspension.</li>
                <li><strong>Account trading:</strong> You may not buy, sell, barter, or broker usernames or accounts on {SITE_NAME}.</li>
                <li><strong>Exploitation:</strong> Any attempt to probe, exploit vulnerabilities, or disrupt platform infrastructure will lead to permanent network bans and appropriate legal remedies.</li>
              </ul>
            </section>

            <section className={styles.privacySection} id="liability">
              <p className={styles.privacySectionLabel}>06 / Legal Disclaimers</p>
              <h2>Disclaimers and limitation of liability</h2>
              <ul className={styles.privacyRules}>
                <li><strong>&quot;As is&quot; service:</strong> {SITE_NAME} is provided on an &quot;AS IS&quot; and &quot;AS AVAILABLE&quot; basis without warranties of any kind, whether express, implied, or statutory, including warranties of merchantability, fitness for a particular purpose, or uninterrupted uptime.</li>
                <li><strong>Limitation of liability:</strong> To the maximum extent permitted by law, {SITE_NAME}, its operators, affiliates, and developers shall not be liable for any indirect, incidental, punitive, or consequential damages resulting from your use of or inability to use the service. Our maximum aggregate liability shall not exceed the greater of the amount you paid to {SITE_NAME} in the preceding 12 months or $100 USD.</li>
                <li><strong>Indemnification:</strong> You agree to defend, indemnify, and hold harmless {SITE_NAME} and its operators from any claims, damages, liabilities, and expenses arising from content you upload or your violation of these terms.</li>
              </ul>
            </section>

            <section className={styles.privacySection} id="enforcement">
              <p className={styles.privacySectionLabel}>07 / Governance</p>
              <h2>Enforcement and contact</h2>
              <p>
                We reserve the right to remove content, limit feature access, suspend profiles, or permanently ban accounts that violate these terms.
              </p>
              <p style={{ marginTop: 14 }}>
                For legal notices, DMCA inquiries, or support questions, contact our legal team at{" "}
                <a href="mailto:legal@sinss.lol" style={{ color: "var(--privacy-mint)", textDecoration: "underline" }}>
                  legal@sinss.lol
                </a>{" "}
                or submit a ticket directly through our{" "}
                <a href={DISCORD_INVITE_URL} target="_blank" rel="noreferrer" style={{ color: "var(--privacy-mint)", textDecoration: "underline" }}>
                  Discord community
                </a>.
              </p>
            </section>
          </article>

          <aside className={styles.privacyContents} aria-label="On this page">
            <p className={styles.privacyContentsTitle}>On this page</p>
            <nav>
              {sections.map(([id, title]) => <a key={id} href={`#${id}`}>{title}</a>)}
            </nav>
          </aside>
        </div>

        <footer className={styles.privacyFooter}>
          <span>{SITE_NAME} · Terms of Service</span>
          <Link href="/privacy">Privacy Notice</Link>
        </footer>
      </div>
    </main>
  );
}
