import Image from "next/image";
import Link from "next/link";
import type { Locale } from "@/i18n/config";
import type { Dictionary } from "@/i18n/get-dictionary";
import { routes } from "@/lib/routes";
import { ArrowUpRightIcon } from "@/components/icons";
import { ctaBannerActionClass } from "@/components/shared/cta-banner";
import { HeroHeadline } from "@/components/shared/hero-headline";
import { PageHeroBackground } from "@/components/shared/page-hero-background";

type NotFoundSectionProps = { locale: Locale; t: Dictionary["notFound"]; backgroundAlt: string };

/**
 * "Page Not Found" (Figma "Not Found", desktop only): 942px tall over the Riyadh-at-night background,
 * the two-line headline, a short text, "Go Home", and the 404 illustration on the end side.
 * Below 1280px (where the header is the phone menu too) it stacks: the illustration first, then the text
 * (owner's request; no Figma frame for these sizes).
 */
export function NotFoundSection({ locale, t, backgroundAlt }: NotFoundSectionProps) {
  return (
    <section className="relative isolate flex items-center overflow-hidden pt-[100px] pb-10 lg:min-h-[942px] lg:py-32">
      <PageHeroBackground alt={backgroundAlt} className="h-full" />
      <div className="container-site">
        <div className="flex flex-col items-center gap-10 xl:flex-row xl:justify-between xl:px-20">
          <div className="flex flex-col items-start gap-7">
            <HeroHeadline start={t.titleStart} highlight={t.titleHighlight} />
            <p className="max-w-lg font-heading text-xs leading-5 text-soft lg:text-lg lg:leading-[29.25px]">{t.description}</p>
            <Link href={routes.home(locale)} className={ctaBannerActionClass}>
              {t.home}
              <ArrowUpRightIcon data-icon="inline-end" className="rtl:-scale-x-100" />
            </Link>
          </div>
          <Image src="/images/not-found/illustration.svg" alt={t.imageAlt} width={519} height={421} priority className="order-first h-auto w-full max-w-[519px] xl:order-none" />
        </div>
      </div>
    </section>
  );
}
