Fetch data from a public API endpoint, handle loading and error states, and render the results in a clean, responsive grid layout.
Implement render_api_grid(response, min_card_width) to represent the endpoint result in a testable form. The response contains status, plus items for success or message for errors; return an object containing the UI state and generated HTML.
response.status is one of loading, error, or success.id, title, and image_url.min_card_width is an integer from 160 through 320.def render_api_grid(response, min_card_width):