I'd like to have footnote indented like the ones from 1 to 9 in the image:
But if I have more than 9 notes the number of the note goes out of the left border.
How can I correctly set \footnotemargin in order to avoid it? That is have something like \setlength{\footnotemargin}{.4em} when there are less then 10 footnotes and increase it when there are more?
Any other way to reach the same result is welcome.
\documentclass[11pt,openright]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{showframe}
\usepackage[english]{babel}
% page layout
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3.5cm,lmargin=4cm,rmargin=3cm,marginparwidth=70pt}
\usepackage[marginal]{footmisc}
\setlength{\footnotemargin}{.4em}
\setlength{\footnotesep}{10pt}
\begin{document}
I'd like to have this alignment for footnotes\footnote{A long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long footnote} write\footnote{A footnote} something.
Just\footnote{A footnote} to\footnote{A footnote} write\footnote{A footnote} something.
Just\footnote{A footnote} to\footnote{A footnote} write\footnote{A footnote} something.
Just\footnote{A footnote} to\footnote{A footnote} write\footnote{A footnote} something.
\end{document}

