I'm trying to recreate a figure and caption effect from a journal. An example of it can be seen on PDF version of Figure 1 from this article:

It's basically a large grey bordered box that goes around the image and caption, and the bottom section, where the caption is filled in grey.
I'm currently using
\usepackage{xcolor}
\usepackage{mdframed}
\mdfdefinestyle{mystyle1}{
backgroundcolor=white!20
}
\mdfdefinestyle{mystyle2}{
backgroundcolor=lightgray!20
}
in the preamble, and
\begin{figure}[htb!]
\centering
\begin{mdframed}[style=mystyle1]
\includegraphics[width=1.0\textwidth]{foo.pdf}
\begin{mdframed}[style=mystyle2]
\caption[foo]{foo}
\end{mdframed}
\end{mdframed}
\label{fig:foo}
\end{figure}
This creates a box around the whole figure and caption, and then a subbox around the caption, but they don't lineup, and I can't figure out how to change the border colour.
Any help would be appreciated.

