.galinf-gallery { position: relative; width: 100%; }
.galinf-runway  { position: relative; width: 100%; }

/* Contrôle « trier par ». Couleurs HÉRITÉES du thème hôte (son texte
   contraste par définition avec son fond) : lisible en clair comme en
   sombre, sans couleur codée en dur. */
.galinf-controls {
    margin: 0 0 1rem;
    display: flex;
    justify-content: flex-end;
}
.galinf-sort-label {
    font-size: .9rem;
    color: inherit;
    opacity: .85;
}
.galinf-sort {
    margin-left: .4rem;
    padding: .25rem .5rem;
    font-size: .9rem;
    color: inherit;
    background: transparent;
    border: 1px solid rgba(127, 127, 127, .55);
    border-radius: 4px;
}
/* Fond de page sombre (classe posée par le JS après mesure de la luminance
   du fond effectif) : le menu DÉROULÉ natif passe en rendu sombre — sans
   color-scheme, la liste resterait blanche avec du texte clair illisible. */
.galinf-gallery.galinf-dark .galinf-sort { color-scheme: dark; }
.galinf-gallery.galinf-dark .galinf-sort option { background: #222; color: #eee; }

.galinf-tile {
    position: absolute;
    top: 0; left: 0;
    overflow: hidden;
    background: #ececec;
    will-change: transform;
    border-radius: 2px;
    cursor: pointer;
}
.galinf-tile img {
    width: 100%; height: 100%;
    display: block;
    /* margin explicite : la typographie du thème hôte (ex. Tailwind
       Typography, `.prose img { margin: 2em 0 }`) ne doit jamais décaler
       l'image dans sa tuile. */
    margin: 0;
    object-fit: cover;
    background: #ececec;
    opacity: 1;
    transition: opacity .25s ease;   /* nouvelle image : apparition en fondu */
}

/* Pendant le chargement (recyclage) : l'ancienne image est masquée
   INSTANTANÉMENT (transition: none) → on ne voit jamais une image déjà vue. */
.galinf-tile.galinf-loading img {
    opacity: 0;
    transition: none;
}

/* Spinner centré dans la case en cours de chargement. */
.galinf-tile.galinf-loading::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 22px; height: 22px;
    margin: -11px 0 0 -11px;
    border: 2px solid rgba(0, 0, 0, .15);
    border-top-color: rgba(0, 0, 0, .45);
    border-radius: 50%;
    animation: galinf-spin .7s linear infinite;
}
@keyframes galinf-spin { to { transform: rotate(360deg); } }

/* Badge nombre de commentaires (coin haut-droit de la vignette). */
.galinf-count {
    position: absolute;
    top: 5px; right: 5px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
    pointer-events: none;
}

/* Barre de progression du bas de page (indicateur « il reste des images »). */
.galinf-status .galinf-bar {
    display: block;
    width: min(320px, 60%);
    height: 4px;
    margin: .5rem auto 0;
    background: rgba(127, 127, 127, .18);
    border-radius: 2px;
    overflow: hidden;
}
.galinf-status .galinf-bar-fill {
    display: block;
    height: 100%;
    background: #8a8a8a;
    border-radius: 2px;
    transition: width .3s ease;
}
/* Variante indéterminée (si le total n'est pas encore connu). */
.galinf-bar-indet {
    width: 30%;
    animation: galinf-indet 1.1s linear infinite;
}
@keyframes galinf-indet {
    from { transform: translateX(-110%); }
    to   { transform: translateX(440%); }
}

/* Indicateur discret de chargement (en flux, sous la galerie). */
.galinf-status {
    margin: 0;
    padding: 1rem 0;
    min-height: 1.2rem;
    text-align: center;
    font-size: .85rem;
    color: var(--galinf-muted, #999);
}
