.ife-instagram-wrapper {
    margin: 0 auto; /* Centraliza o conteúdo */
    max-width: 100%; /* Limita ao container pai */
    width: 100%; /* Ocupa a largura disponível */
    padding: 0 0px; /* Margens simétricas internas */
    box-sizing: border-box;
}

.ife-instagram-grid {
    display: grid;
    gap: 10px;
    width: 100%;
    align-content: stretch; /* Alinha o conteúdo para estender a altura */
    position: relative !important;
    z-index: 1 !important;
}

.ife-posts-per-row-2 {
    grid-template-columns: repeat(2, 1fr); /* Divide igualmente em 2 colunas */
}

.ife-posts-per-row-3 {
    grid-template-columns: repeat(3, 1fr); /* Divide igualmente em 3 colunas */
}

.ife-posts-per-row-4 {
    grid-template-columns: repeat(4, 1fr); /* Divide igualmente em 4 colunas */
}

.ife-posts-per-row-5 {
    grid-template-columns: repeat(5, 1fr); /* Divide igualmente em 5 colunas */
}

.ife-instagram-item {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch; /* Garante que os itens internos se alinhem */
}

.ife-image-container {
    position: relative;
    aspect-ratio: 1 / 1; /* Mantém a proporção 1:1 */
    width: 100%;
    height: auto; /* Ajusta a altura automaticamente */
    overflow: hidden;
}

.ife-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.ife-caption {
    position: relative;
    padding: 10px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    background: rgba(0, 0, 0, 0.05); /* Fundo cinza mantido */
    word-break: break-word;
    overflow-wrap: break-word;
    z-index: 1;
    flex-grow: 1; /* Expande para igualar a altura da legenda mais longa */
    display: flex;
    align-items: center; /* Centraliza verticalmente o texto */
    min-height: 40px; /* Espaço mínimo para a legenda */
}

@media (max-width: 1200px) {
    .ife-posts-per-row-5 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 960px) {
    .ife-posts-per-row-4,
    .ife-posts-per-row-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 720px) {
    .ife-posts-per-row-2,
    .ife-posts-per-row-3,
    .ife-posts-per-row-4,
    .ife-posts-per-row-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .ife-posts-per-row-2,
    .ife-posts-per-row-3,
    .ife-posts-per-row-4,
    .ife-posts-per-row-5 {
        grid-template-columns: repeat(1, 1fr);
    }
}