import { cn } from "cn";

type PageIntroProps = {
  id?: string;
  title: string;
  /** Each entry starts on its own line (Figma breaks the intro after the first sentence). */
  lines: string[];
  className?: string;
};

/**
 * Page title + short intro at the top of an inner page (Projects, Products…).
 * Figma (desktop): 48px title, 20px gap, 18px / 29.25px intro. Phone & tablet follow the Home section headings: 32px / 12px.
 */
export function PageIntro({ id, title, lines, className }: PageIntroProps) {
  return (
    <div className={cn("flex flex-col gap-5 pt-3", className)}>
      <h1 id={id} className="font-heading text-[32px] leading-10 font-black text-heading lg:text-5xl lg:leading-12">
        {title}
      </h1>
      <p className="text-xs leading-5 text-default lg:text-lg lg:leading-[29.25px]">
        {lines.map((line) => (
          <span key={line} className="block">
            {line}
          </span>
        ))}
      </p>
    </div>
  );
}
