/* ============================================================
   Calques d'un Fond (at_background, lot B1). L'hôte s'isole (contexte d'empilement) et le calque passe DERRIÈRE son
   contenu (z-index -1) : aucun enfant de l'hôte n'est touché (pas de `> *`), le placement ne voit rien. La couleur de
   fond reste sur l'hôte, sous les calques.
   ============================================================ */

:where(.atgf-bg-host) {
    position: relative; /* bas de spécificité : un `position: sticky` (at_sticky) l'emporte et sert aussi de repère */
    isolation: isolate;
}

/* Le calque est un ENFANT de l'hôte : toute règle `& > *` (rythme des blocs `.atb-column > *`, CSS perso
   `& > * { width: min(1150px, 100%); margin-inline: auto }`, placement, grilles…) le viserait. Sa géométrie est donc
   imposée (`!important`) : il couvre toujours la boîte de l'hôte, hors du flux, derrière le contenu — comme l'ancien
   `::before`, qu'aucune de ces règles n'atteignait. */
.atgf-bg {
    position: absolute !important;
    inset: 0 !important;
    z-index: -1 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    transform: none !important;
    translate: none !important;
    grid-area: auto !important;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
}

.atgf-bg__l {
    position: absolute;
    inset: 0;
    display: block;
    margin: 0;
    transition: opacity .35s ease, scale .6s ease, filter .35s ease, background-color .35s ease;
}

.atgf-bg__l img {
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    object-fit: var(--atgf-bg-fit, cover);
    object-position: var(--atgf-bg-pos, 50% 50%);
}

.atgf-bg__l--repeat {
    background-position: var(--atgf-bg-pos, 0 0);
    background-repeat: repeat;
}

/* Voile par défaut : `--atgf-veil` (le site ou un fournisseur — le builder y branche le voile de ses thèmes) ; repli =
   dégradé neutre vers le bas. */
.atgf-bg__l--veil-theme {
    background: var(--atgf-veil, linear-gradient(0deg, var(--atgf-neutral, #1d2327) 0%, color-mix(in oklab, var(--atgf-neutral, #1d2327) 56%, transparent) 50%, transparent 100%));
}

/* Vidéo : le calque de Video_Options occupe tout le calque. */
.atgf-bg__l--video > .atgf-bg-video {
    position: absolute;
    inset: 0;
}

@media (prefers-reduced-motion: reduce) {
    .atgf-bg__l {
        transition: none;
        scale: none !important;
    }
}
