import type { Metadata } from 'next';

export const metadata: Metadata = {
  title: 'Terms of Service',
  description: 'VYNDR terms of service. Plain English. No tricks.',
};

// Session 2 (A1 board) — approval-pack draft. Entity details are placeholder
// tokens ([ENTITY NAME], [STATE OF FORMATION], [ARBITRATION VENUE],
// [CONTACT EMAIL]) for Kev to fill before this ships as the legal document.

const SECTIONS: { title: string; body: string[]; emphasized?: boolean }[] = [
  {
    title: 'What this is — and is not',
    body: [
      'VYNDR is a sports data intelligence platform. We publish statistical analysis, grades, and context on player props for informational and entertainment purposes only.',
      'VYNDR is not a sportsbook. We do not accept, place, facilitate, broker, or process wagers of any kind. We do not hold gambling funds, set odds for wagering, or pay out winnings. No money you send us is ever a bet.',
      'These terms are a contract between you and [ENTITY NAME], the company that operates VYNDR ("we," "us"). By creating an account or using the service you accept them.',
    ],
    emphasized: true,
  },
  {
    title: 'Who can use this',
    body: [
      'You must be 21 years of age or older to create an account. You must use VYNDR only where the use of sports analytics tools is legal in your jurisdiction, and you are responsible for knowing and following your local laws. We may close accounts that misrepresent age or location.',
    ],
  },
  {
    title: 'No guaranteed outcomes',
    body: [
      'A grade is a probabilistic assessment, not a prediction, promise, or guarantee. The model is wrong regularly — we publish the Ledger, misses included, so you can see exactly how often. When the model has no projection for a prop, it refuses to grade rather than guess. Past performance does not guarantee future results. Nothing on VYNDR is financial, investment, or gambling advice. Never bet money you cannot afford to lose.',
    ],
  },
  {
    title: 'Data sources and accuracy',
    body: [
      'Odds, lines, schedules, and statistics are sourced from third-party providers and public league data. They can be delayed, incomplete, or wrong, and lines move constantly. Always confirm the current line at the sportsbook before acting on anything you see here. Where our data is missing we show nothing rather than a fabricated value; absence of a number is deliberate.',
    ],
  },
  {
    title: 'Subscription terms',
    body: [
      'Paid tiers (Analyst, Desk) are billed monthly through Stripe, our payment processor. You may cancel at any time from your profile page; cancellation takes effect at the end of the current billing period. We do not refund partial months. If a payment fails, we honor a 48-hour grace period before reverting your account to the free tier.',
      'Founder pricing ($14.99/mo Analyst, $44.99/mo Desk) is locked for the lifetime of your continuous subscription. A lapsed subscription reverts to standard pricing ($24.99 Analyst, $49.99 Desk) on re-subscription. After the first 100 founder seats are taken, new subscribers pay standard pricing.',
      'We may change standard pricing with 30 days notice. Founder pricing is locked.',
    ],
  },
  {
    title: 'Acceptable use',
    body: [
      'Do not scrape, reverse engineer, or attempt to replicate the grading engine. Do not resell reads, share account credentials, or attempt to circumvent the read limit. Do not use the service to abuse, harass, or defraud others, and do not use it in connection with unlawful gambling.',
      'VYNDR does not offer API access at any tier. The grading engine is consumer-only — we do not provide programmatic access to grades, factor weights, model outputs, or any other engine surface, regardless of plan or pricing. Requests for API access will be declined.',
    ],
  },
  {
    title: 'Intellectual property',
    body: [
      'The grading engine, models, calibration data, factor weights, archetype system, and surrounding analysis are proprietary to [ENTITY NAME]. You are licensed to view grades for personal use. You are not licensed to redistribute, repackage, or sell VYNDR output.',
    ],
  },
  {
    title: 'Termination',
    body: [
      'You can delete your account at any time from Settings. We may suspend or terminate accounts that violate these terms, with notice where practical. On termination your license to use the service ends; provisions that should survive (intellectual property, liability limits, dispute terms) survive.',
    ],
  },
  {
    title: 'Limitation of liability',
    body: [
      'VYNDR is not responsible for any financial losses you incur from sports betting decisions, whether or not they were informed by our analytics. The service is provided "as is" and "as available," with no warranty of any kind. To the maximum extent permitted by law, our total liability is limited to the amount you paid us in the 12 months before the claim.',
    ],
  },
  {
    title: 'Governing law and disputes',
    body: [
      'These terms are governed by the laws of [STATE OF FORMATION]. Disputes will be resolved through binding arbitration in [ARBITRATION VENUE], except where the law gives you a non-waivable right to court.',
    ],
  },
  {
    title: 'Responsible gambling',
    body: [
      'Sports betting can become a problem. If it stops being fun, stop. The National Problem Gambling Helpline is available 24/7, free and confidential — call or text 1-800-GAMBLER (1-800-426-2537). Our Responsible Gambling page lists state resources, warning signs, and self-exclusion guidance.',
    ],
  },
  {
    title: 'Changes to these terms',
    body: [
      'If we make material changes, we will notify account holders by email at least 30 days before they take effect. Continued use after that date is acceptance of the new terms.',
    ],
  },
  {
    title: 'Contact',
    body: [
      '[ENTITY NAME]. Questions about these terms: [CONTACT EMAIL].',
    ],
  },
];

export default function TermsPage() {
  return (
    <LegalLayout
      title="Terms of Service"
      effective="Draft: July 2026"
      sections={SECTIONS}
    />
  );
}

function LegalLayout({ title, effective, sections }: { title: string; effective: string; sections: { title: string; body: string[]; emphasized?: boolean }[] }) {
  return (
    <section style={{ maxWidth: 720, margin: '0 auto', padding: '48px 16px 120px' }}>
      <header style={{ marginBottom: 32 }}>
        <h1 style={{ fontSize: 36, fontWeight: 700, letterSpacing: '-0.03em', marginBottom: 8 }}>{title}</h1>
        <p className="mono" style={{ fontSize: 12, color: 'var(--text-tertiary)', letterSpacing: '0.05em' }}>
          {effective.toUpperCase()}
        </p>
      </header>
      {sections.map((s) => (
        <section
          key={s.title}
          style={{
            marginBottom: 32,
            ...(s.emphasized
              ? {
                  borderLeft: '3px solid var(--grade-a)',
                  background: 'rgba(0, 212, 160, 0.04)',
                  borderRadius: 4,
                  padding: '12px 16px',
                }
              : {}),
          }}
        >
          <h2 style={{ fontSize: s.emphasized ? 20 : 18, fontWeight: 700, marginBottom: 12 }}>{s.title}</h2>
          {s.body.map((p, i) => (
            <p
              key={i}
              style={{
                color: s.emphasized ? 'var(--text-0)' : 'var(--text-secondary)',
                fontSize: s.emphasized ? 16 : 15,
                lineHeight: 1.7,
                marginBottom: 12,
              }}
            >
              {p}
            </p>
          ))}
        </section>
      ))}
    </section>
  );
}
