/**
 * Article default image, animated: project block (PPL Logistiikka).
 *
 * An article without its own featured image shows the site's default image
 * (applari-core, Oletuskuva): the logo in the middle of a pallet-slot grid.
 * includes/blocks/article-default-image.php draws the same picture as inline
 * SVG on top of that <img>, and here the pallets and parcels leave to the
 * right and new ones arrive from the left, one slot at a time.
 *
 *   figure.gb-block-image
 *     img                              the default image (stays, also the fallback)
 *     svg.article-default-anim         the same picture, aria-hidden
 *       g.adi-pallet[style="--i:N"]    one pallet, N = its place in the queue
 *         rect.adi-parcel              a parcel on the pallet (some)
 *
 * article-default-anim--always: the article header, runs all the time.
 * In lists (.post-item) the animation runs on hover and focus only.
 * Reduced motion: no movement, the picture equals the image.
 * Variables: --adi-cycle (length of one round), --adi-step (gap between two pallets).
 */

.article-default-anim {
    --adi-cycle: 9s;
    --adi-step: 0.55s;
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

figure:has(> .article-default-anim) {
    position: relative;
    overflow: hidden;
}

@keyframes adi-cycle {
    0%, 8% { transform: translateX(0); opacity: 1; }
    17% { transform: translateX(200px); opacity: 0; }
    18% { transform: translateX(-200px); opacity: 0; }
    30%, 100% { transform: translateX(0); opacity: 1; }
}

@keyframes adi-drop {
    0%, 8% { transform: translateY(0); opacity: 1; }
    17%, 30% { transform: translateY(-46px); opacity: 0; }
    38%, 100% { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
    .article-default-anim--always .adi-pallet,
    .post-item:hover .adi-pallet,
    .post-item:focus-within .adi-pallet {
        animation: adi-cycle var(--adi-cycle) cubic-bezier(0.3, 0.7, 0.3, 1) calc(var(--i) * var(--adi-step)) infinite;
    }

    .article-default-anim--always .adi-parcel,
    .post-item:hover .adi-parcel,
    .post-item:focus-within .adi-parcel {
        animation: adi-drop var(--adi-cycle) cubic-bezier(0.3, 0.7, 0.3, 1) calc(var(--i) * var(--adi-step)) infinite;
    }
}
