/* skeleton-loading.css - Efeito de carregamento para imagens da Home */

/* Animação shimmer */
@keyframes skeleton-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.skeleton-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            rgba(240, 240, 245, 0) 0%,
            rgba(240, 240, 245, 0.5) 45%,
            rgba(255, 255, 255, 0.8) 50%,
            rgba(240, 240, 245, 0.5) 55%,
            rgba(240, 240, 245, 0) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    pointer-events: none;
    border-radius: inherit;
}

/* Cor de fundo estática enquanto carrega */
.card-image-wrapper.image-loading,
.highlight-image-wrapper.image-loading,
.card-news-image-wrapper.image-loading {
    background: #e8eaed;
}

/* Wrapper da imagem: esconde a imagem até carregar */
.image-loading img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-loading.loaded img,
.image-loading img.loaded {
    opacity: 1;
}

.image-loading.loaded .skeleton-shimmer,
.image-loading .skeleton-shimmer.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Esconde o skeleton quando só .loaded está presente (após remover .image-loading no JS) */
.card-image-wrapper.loaded .skeleton-shimmer,
.highlight-image-wrapper.loaded .skeleton-shimmer,
.card-news-image-wrapper.loaded .skeleton-shimmer {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Wrappers ocupam o espaço da imagem */
.card-image-wrapper,
.highlight-image-wrapper,
.card-news-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: inherit;
}

#dynamic-carousel .card-image-wrapper {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.highlight-image .highlight-image-wrapper {
    width: 100%;
    height: 373px;
    display: block;
    border-radius: 8px;
}

.highlight-image .highlight-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.news-cards .card-news-image-wrapper {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.news-cards .card-news-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Placeholders iniciais (antes do JS preencher) */
.hero-skeleton {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 370px;
    padding: 0 20px;
}

.hero-skeleton .skeleton-card {
    width: 324px;
    height: 370px;
    border-radius: 10px;
    background: #e8eaed;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.hero-skeleton .skeleton-card .skeleton-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.highlight-skeleton {
    width: 100%;
    height: 373px;
    border-radius: 8px;
    background: #e8eaed;
    position: relative;
    overflow: hidden;
}

.highlight-cards-skeleton {
    display: flex;
    gap: 15px;
    margin-top: 1rem;
    justify-content: space-between;
}

.highlight-cards-skeleton .skeleton-card {
    width: 290px;
    height: 350px;
    border-radius: 10px;
    background: #e8eaed;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.highlight-cards-skeleton .skeleton-card .skeleton-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

@media (max-width: 991px) {
    .highlight-cards-skeleton {
        flex-wrap: wrap;
    }

    .highlight-cards-skeleton .skeleton-card {
        flex: 1 1 200px;
        min-width: 180px;
    }
}