import Image from "next/image";

/**
 * Official Alterra logo (vector, from the brand file). "dark" = for dark backgrounds (cream logo),
 * "light" = for light backgrounds (green and gold logo).
 */
const logos = {
  horizontal: { dark: "/brand/logo-horizontal-dark.svg", light: "/brand/logo-horizontal-light.svg", ratio: 708.4 / 137.5 },
  stacked: { dark: "/brand/logo-stacked-dark.svg", light: "/brand/logo-stacked-light.svg", ratio: 541.5 / 335 },
  mark: { dark: "/brand/logo-mark-cream.svg", light: "/brand/logo-mark-green.svg", ratio: 255 / 163.5 },
} as const;

export const LOGO_ALT = "Alterra Real Estate Group";

export default function Logo({
  variant = "horizontal",
  tone = "dark",
  height = 44,
  className = "h-11",
  priority = false,
}: {
  variant?: keyof typeof logos;
  tone?: "dark" | "light";
  /** Intrinsic height used for the width/height attributes (no layout shift); size it with `className`. */
  height?: number;
  /** Tailwind height classes, e.g. "h-9 md:h-11". Width follows the logo's proportions. */
  className?: string;
  priority?: boolean;
}) {
  const logo = logos[variant];
  return (
    <Image
      src={logo[tone]}
      alt={LOGO_ALT}
      width={Math.round(height * logo.ratio)}
      height={height}
      priority={priority}
      unoptimized
      className={`w-auto ${className}`}
    />
  );
}
