.page-with-background {
    --page-motif-tint: 247 241 230;
    --page-motif-tint-start: 12%;
    --page-motif-tint-end: 26%;
    position: relative;
    isolation: isolate;
    background-color: #f7f1e6;
    background-image: url('../images/backgrounds/sand-paper.webp');
    background-blend-mode: normal;
    background-repeat: repeat;
}

.alt-theme .page-with-background {
    --page-motif-tint: 33 30 26;
    --page-motif-tint-start: 30%;
    --page-motif-tint-end: 55%;
    background-color: #211e1a;
    background-blend-mode: multiply;
}

.alt-theme .page-with-background > [data-page-content] {
    background-color: var(--color-content-bg);
    border-radius: 1rem;
    padding-block: 1rem;
}

.page-with-background::before {
    position: absolute;
    z-index: -1;
    inset: 0 0 auto;
    height: min(100%, clamp(29rem, 62vw, 52rem));
    background-image:
        linear-gradient(180deg, rgb(var(--page-motif-tint) / var(--page-motif-tint-start)), rgb(var(--page-motif-tint) / var(--page-motif-tint-end))),
        var(--page-background-image);
    mask-image: linear-gradient(#000 38%, transparent);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    content: '';
    pointer-events: none;
}

@media (max-width: 40rem) {
    .page-with-background {
        --page-motif-tint-start: 22%;
        --page-motif-tint-end: 38%;
    }
}
