// Global helper: serve AVIF to modern browsers, fall back to the original
// jpg/png. <picture> uses display:contents so it's invisible to layout —
// the inner <img> keeps all the styles/classes it had as a plain <img>.
// Loaded before the section scripts; shared global scope (text/babel).
function Pic({ src, ...rest }) {
  const avif = src.replace(/\.(jpe?g|png)$/i, '.avif');
  return (
    <picture style={{ display: 'contents' }}>
      <source srcSet={avif} type="image/avif" />
      <img src={src} {...rest} />
    </picture>
  );
}
window.Pic = Pic; // explicit global — don't rely on implicit top-level binding (Babel scope differs per host)
