/* Optimized Interlace CSS for Anymag */

[data-interlace] {
    position: relative;
    overflow: hidden;
}

[data-interlace] img {
    display: block;
    top: 0;
    width: 100%;
    height: 100%;
    /* Гарантирует, что картинка не растянется, а заполнит блок */
    object-fit: cover; 
}

[data-interlace] img:first-of-type {
    z-index: 1;
}

[data-interlace="loaded"] img:first-of-type {
    position: absolute;
}

[data-interlace] img + img {
    position: absolute;
    opacity: 0;
    /* Оптимизация анимации для GPU */
    will-change: opacity;
    transition: opacity 500ms ease;
}

[data-interlace="loaded"] img + img {
    position: absolute;
    opacity: 1;
    z-index: 1;
}

/* Спиннер загрузки */
[data-interlace="loading"]::after {
    position: absolute;
    display: block;
    content: '';
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    top: 50%;
    left: 50%;
    border-radius: 50%; /* Идеальный круг */
    box-shadow: 0 1px 0 0 rgba(200, 200, 200, 0.8);
    animation: interlace-load-anim 600ms linear infinite;
}

@keyframes interlace-load-anim {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}