```python
def soundex_code(word: str) -> str:
    if not isinstance(word, str):
        raise ValueError("Input must be a string")
    if not word.isalpha():
        raise ValueError("Input must contain only ASCII letters")

    code = {'b': '1', 'f': '1', 'p': '1', 'v': '1',
             'c': '2', 'g': '2', 'j': '2', 'k': '2', 'q': '2', 's': '2', 'x': '2', 'z': '2',
             'd': '3', 't': '3',
             'l': '4',
             'm': '5', 'n': '5',
             'r': '6'}

    word = word.lower()
    result = [word[0].upper()]

    for char in word[1:]:
        digit = code.get(char)
        if digit and (not result or digit != result[-1] or (char == 'h' or char == 'w') and len(result) > 1 and result[-2] not in 'aeiouy'):
            result.append(digit)

    return ''.join(result).ljust(4, '0')[:4]
```