const ROMAN_PAIRS: [number, string][] = [
  [1000, 'M'], [900, 'CM'], [500, 'D'], [400, 'CD'],
  [100, 'C'], [90, 'XC'], [50, 'L'], [40, 'XL'],
  [10, 'X'], [9, 'IX'], [5, 'V'], [4, 'IV'], [1, 'I'],
]

function toRoman(n: number): string {
  let result = ''
  for (const [value, symbol] of ROMAN_PAIRS) {
    while (n >= value) {
      result += symbol
      n -= value
    }
  }
  return result
}

/** Slim end-of-page byline — sits below every section's content as a
 *  quiet attribution line. */
export function Footer() {
  return (
    <div className="px-2 pt-1 text-right text-[9px] font-serif italic text-text-faint">
      Built with hubris · {toRoman(new Date().getFullYear())}
    </div>
  )
}
