In my personal experience, achieving this effect purely through HTML and CSS seems impossible. The only similar technique I've come across is the inset text-shadow trick mentioned in some comments. Online resources also seem to lack a definitive solution for this.
It appears that maintaining strict separation between HTML and CSS for SEO and accessibility reasons could be a possible explanation for the challenge. A potential workaround might involve using an img tag with an alt attribute as a simple solution, or utilizing SVG for selectable and scalable text, supplemented by appropriate fallbacks. Additionally, if you require flowing or wrapping text, SVG might offer the capability to handle that aspect as well. For further information, consider checking out this answer: Auto line-wrapping in SVG text