import { Link } from 'react-router-dom';
import { GitBranch } from 'lucide-react';

import { Separator } from '@/components/ui/separator';
import { PIG_URL, REPO_URL, repoFile } from '@/components/site/links';
import { Wordmark } from '@/components/site/Wordmark';

export function SiteFooter() {
  return (
    <footer className="mt-16 border-t border-border bg-surface">
      <div className="mx-auto max-w-canvas px-4 pb-[max(2rem,var(--safe-bottom))] pl-[max(1rem,var(--safe-left))] pr-[max(1rem,var(--safe-right))] pt-8">
        <div className="flex flex-col gap-6 sm:flex-row sm:items-start sm:justify-between">
          <div className="flex flex-col gap-2">
            <Wordmark className="text-base" />
            <p className="max-w-sm text-sm text-muted">
              An environment is an eval you can take the gradient of.
            </p>
          </div>

          <nav aria-label="Footer" className="flex flex-col gap-1 text-sm">
            <a
              className="tap inline-flex items-center gap-2 py-1 text-fg underline-offset-4 hover:text-accent-fg hover:underline"
              href={REPO_URL}
              target="_blank"
              rel="noreferrer noopener"
            >
              <GitBranch aria-hidden="true" className="size-4" />
              Source on Gitea
            </a>
            <Link
              className="tap inline-flex items-center py-1 text-fg underline-offset-4 hover:text-accent-fg hover:underline"
              to="/honesty"
            >
              What we are not claiming
            </Link>
            <a
              className="tap inline-flex items-center py-1 text-fg underline-offset-4 hover:text-accent-fg hover:underline"
              href={PIG_URL}
              target="_blank"
              rel="noreferrer noopener"
            >
              primeintellectgrowth.com
            </a>
          </nav>
        </div>

        <Separator className="my-6" />

        <div className="flex flex-col gap-2 text-xs leading-relaxed text-muted">
          <p>
            Every number on this site is reproducible from the repository: the environments, the
            recorded rollouts and the command that produced them all ship with the source.
          </p>
          <p>
            Licensed{' '}
            <a
              className="underline underline-offset-2 hover:text-accent-fg"
              href={repoFile('LICENSE')}
              target="_blank"
              rel="noreferrer noopener"
            >
              Apache-2.0
            </a>
            .
          </p>
          {/*
            Stated plainly and kept in the footer of every page. The word game
            demo is an independent implementation of a public game mechanic; the
            trademark belongs to someone else and this site must never read as
            if it were theirs.
          */}
          <p>
            Not affiliated with, endorsed by, or connected to The New York Times Company. Wordle is
            their trademark.
          </p>
        </div>
      </div>
    </footer>
  );
}
