// frost.js

export function detectFrost(tempC, dewPointC) {
  if (typeof tempC !== 'number' || typeof dewPointC !== 'number') return null;

  const tempDiff = tempC - dewPointC;
  const frostLikely = tempC <= 2 && tempDiff <= 2;

  return frostLikely ? {
    risk: true,
    message: "Frost Risk ❄️",
    icon: "❄️",
    severity: tempC <= 0 ? "hard" : "light"
  } : { risk: false };
}
