/* eslint-disable */
// Process-photography component. Brand convention: warm-brown gradient + grain
// as a *placeholder*, but when `src` is given it renders the real photograph
// (object-fit: cover) over that same warm base, so loading/aspect stays on-brand.
// `tone` selects a gradient variant; `caption` adds a tiny bottom-left credit;
// `aspect` sets aspect-ratio. `src` resolves via window.__resources (for the
// bundled standalone) and falls back to the raw path in dev.

const Photo = ({
  tone = 'default',
  aspect,
  caption,
  src,
  alt = '',
  objectPosition = 'center',
  style,
  className = '',
  children,
  ...rest
}) => {
  const toneClass = tone === 'default' ? '' : `uc-photo--${tone}`;
  const resolved = src
    ? ((window.__resources && window.__resources[src]) || src)
    : null;
  return (
    <div
      className={`uc-photo ${toneClass} ${className}`.trim()}
      style={{ aspectRatio: aspect, ...style }}
      {...rest}
    >
      {resolved && (
        <img
          className="uc-photo__img"
          src={resolved}
          alt={alt}
          loading="lazy"
          style={{
            position: 'absolute', inset: 0, zIndex: 1,
            width: '100%', height: '100%',
            objectFit: 'cover', objectPosition,
            display: 'block',
          }}
        />
      )}
      {children}
      {caption && <div className="uc-photo__cap">{caption}</div>}
    </div>
  );
};

Object.assign(window, { Photo });
