/// Maximum bytes for a single filename component (excluding extension).
/// macOS HFS+/APFS limit is 255 bytes per component; we reserve 15 for extension + safety.
pub const MAX_FILENAME_BYTES: usize = 240;
/// Truncate a string to at most `max_bytes` bytes while preserving UTF-8 validity.