/* Federica Gori — immagine con fallback al segnaposto on-brand.
Con `src` rende una (lazy, ratio fisso → zero CLS); se il file
manca o senza `src`, il blocco caldo segna dove andrà una foto vera. */
function Photo({ src, alt = "", label = "Foto", icon = "circleDot", height = "100%", ratio = null, rounded = "var(--radius-lg)", tone = "sand", style = {} }) {
const [broken, setBroken] = React.useState(false);
if (src && !broken) {
return (
setBroken(true)}
style={{ display: "block", width: "100%", height: ratio ? "auto" : height, aspectRatio: ratio || "auto",
objectFit: "cover", borderRadius: rounded, background: "#F1E9DA", ...style }} />
);
}
const tones = {
sand: { from: "#F1E9DA", to: "#DDD0BA", ink: "#6E665B" },
deep: { from: "#38332E", to: "#22201D", ink: "#B3A99B" },
clay: { from: "#EAD0BF", to: "#D2A187", ink: "#8C4530" },
olive: { from: "#E5E8D4", to: "#C2CBA0", ink: "#4C5631" },
};
const t = tones[tone] || tones.sand;
return (