import Image from "next/image";
import Link from "next/link";
import { ArrowUpRightIcon, BuildingIcon, ClockIcon, MapPinOutlineIcon } from "@/components/icons";
import { ctaBannerActionClass } from "@/components/shared/cta-banner";
import { PageHeroBackground } from "@/components/shared/page-hero-background";
import { HeroHeadline } from "@/components/shared/hero-headline";

type JobHeroSectionProps = {
  title: string;
  description: string;
  location: string;
  type: string;
  department: string;
  applyLabel: string;
  applyHref: string;
  image: string;
  imageAlt: string;
  backgroundAlt: string;
};

/**
 * Job page top (Figma "Career" job details, 1440): title, intro, place / type / department, "Apply Now",
 * and the team photo (321×384) on the end side. The photo is hidden on phones, like the Home hero card.
 */
export function JobHeroSection(props: JobHeroSectionProps) {
  const meta = [
    { icon: MapPinOutlineIcon, label: props.location },
    { icon: ClockIcon, label: props.type },
    { icon: BuildingIcon, label: props.department },
  ];

  return (
    <section className="relative isolate flex items-center overflow-hidden pt-[100px] pb-10 lg:min-h-[745px] lg:py-32">
      <PageHeroBackground alt={props.backgroundAlt} className="h-full" />
      <div className="container-site">
        <div className="flex items-center justify-between gap-10 lg:px-20">
          <div className="flex flex-col items-start gap-7">
            <HeroHeadline start={props.title} className="max-w-3xl" />
            <p className="max-w-lg font-heading text-xs leading-5 text-soft lg:text-lg lg:leading-[29.25px]">{props.description}</p>
            <ul className="flex flex-wrap gap-x-6 gap-y-2 font-heading text-sm leading-5 font-medium text-subtle">
              {meta.map(({ icon: Icon, label }) => (
                <li key={label} className="flex items-center gap-2">
                  <Icon className="size-[15px] shrink-0" />
                  {label}
                </li>
              ))}
            </ul>
            <Link href={props.applyHref} prefetch className={ctaBannerActionClass}>
              {props.applyLabel}
              <ArrowUpRightIcon data-icon="inline-end" className="rtl:-scale-x-100" />
            </Link>
          </div>
          <div className="relative hidden h-96 w-80 shrink-0 overflow-hidden rounded-3xl border border-white/50 md:block md:max-lg:[zoom:0.75625]">
            <Image src={props.image} alt={props.imageAlt} fill sizes="320px" className="object-cover" />
            <div aria-hidden className="absolute inset-0 bg-job-photo-overlay rtl:-scale-x-100" />
            <div aria-hidden className="absolute inset-x-0 bottom-0 h-28 bg-linear-to-t from-ink-blue/65 to-transparent" />
          </div>
        </div>
      </div>
    </section>
  );
}
