"""Converts a duration in minutes into a human-readable format.

This function takes a total duration in minutes and formats it into a string that is more
readable, such as "1 hour 30 minutes", "45 minutes", or "2 hours". It handles edge cases
like zero minutes, invalid inputs, and durations that span multiple hours and minutes.

Args:
    total_minutes: The total duration in minutes. Must be a non-negative integer or None.
        If None, the function returns "N/A".

Returns:
    A string representing the formatted duration. Examples include "1 hour", "30 minutes",
    "1 hour and 30 minutes", or "N/A" if the input is None.

Raises:
    ValueError: If `total_minutes` is not a non-negative integer.
"""
You should write code starting with:
from typing import Optional

def format_media_duration(total_minutes: Optional[int]) -> str:
    pass

