import Link from "next/link";
import { cn } from "cn";
import type { Locale } from "@/i18n/config";
import type { Dictionary } from "@/i18n/get-dictionary";
import { routes, sectionIds } from "@/lib/routes";
import { ArrowUpRightIcon } from "@/components/icons";
import { HighlightedTitle } from "@/components/shared/highlighted-title";
import { buttonVariants } from "@/components/ui/button";

type HeroCopyProps = { locale: Locale; t: Dictionary["home"]["hero"] };

export function HeroCopy({ locale, t }: HeroCopyProps) {
  return (
    <div className="flex w-full max-w-lg flex-col items-start gap-5 md:flex-1 lg:flex-none lg:gap-7">
      <HighlightedTitle
        as="h1"
        start={t.titleStart}
        highlight={t.titleHighlight}
        end={t.titleEnd}
        className="text-[40px] leading-[50px] tracking-[-1.7px] lg:text-[68px] lg:leading-[71.4px]"
      />
      <p className="text-xs leading-5 text-default lg:text-lg lg:leading-[29.25px]">{t.description}</p>
      <Link href={routes.section(locale, sectionIds.services)} className={cn(
          buttonVariants({ variant: "white", size: "pill" }),
          // Phone & tablet (Figma 390 / 744): a smaller pill — 14px text, 38px tall; centred on phones.
          "max-lg:px-[18.7px] max-lg:py-[10.2px] max-lg:text-sm max-lg:[&_svg:not([class*='size-'])]:size-[15px] max-md:self-center",
        )}
      >
        {t.cta}
        <ArrowUpRightIcon data-icon="inline-end" className="rtl:-scale-x-100" />
      </Link>
    </div>
  );
}
