Here’s the CSS for stack.

The astro-island and astro-slot selectors help to alleviate styling frustrations when using Astro.

.stack {
position: relative;
display: grid;
grid-template-columns: minmax(0, 1fr);
padding: 0;
&::before,
&::after,
> *,
> *:where(.contents) > *,
> *:where(astro-island, astro-slot) > * {
position: relative;
z-index: 1;
grid-column: 1 / span 1;
grid-row: 1 / span 1;
}
> .background {
overflow: hidden;
position: absolute;
inset: 0;
}
> .foreground {
position: relative;
z-index: 10;
}
}