/* Publicações do Instagram: faixa da home, aba da Galeria e janela em tela cheia */

.ig-grade {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .5rem;
    max-width: 1100px;
    margin: 0 auto;
}
.ig-grade-faixa { grid-template-columns: repeat(6, 1fr); }

.ig-item {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    background: #1c1c1c;
}
.ig-item[hidden] { display: none; }
.ig-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s, opacity .3s;
}
.ig-item:hover img { transform: scale(1.06); opacity: .88; }
/* Ao passar o mouse: coração com o número de curtidas, como no Instagram */
.ig-hover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    background: rgba(0,0,0,.35);
    color: #fff;
    font-weight: 600;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}
.ig-hover svg { width: 22px; height: 22px; fill: #fff; }
.ig-item:hover .ig-hover { opacity: 1; }
@media (hover: none) { .ig-hover { display: none; } }
.ig-item:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.ig-selo {
    position: absolute;
    top: .5rem; right: .5rem;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: var(--white);
    font-size: .85rem;
}

/* Faixa da home */
.ig-acoes {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 1.75rem;
}
.ig-perfil {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--dark);
    font-weight: 500;
    text-decoration: none;
}
.ig-perfil:hover { text-decoration: underline; }

/* Galeria */
.ig-pagina { background: var(--dark); padding-bottom: 5rem; }
.ig-pagina .ig-grade { padding: 0 1.5rem; }
.ig-filtros {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    padding: 1.5rem 1rem;
}
.ig-filtros button {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: .25rem .1rem;
    color: rgba(255,255,255,.55);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
}
.ig-filtros button:hover { color: var(--white); }
.ig-filtros button.ativo { color: var(--primary); border-bottom-color: var(--primary); }

/* Janela em tela cheia */
.ig-janela {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 4.5rem;
    background: rgba(0,0,0,.88);
}
.ig-janela[hidden] { display: none; }
.ig-caixa {
    display: flex;
    width: 100%;
    max-width: 1000px;
    max-height: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: #161616;
}
.ig-midia {
    position: relative;
    flex: 1 1 62%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
    touch-action: pan-y pinch-zoom;   /* o deslizar lateral fica com o instagram.js */
}
/* Fotos do carrossel lado a lado; o instagram.js desloca a trilha. */
.ig-trilho {
    display: flex;
    width: 100%;
    height: 100%;
    will-change: transform;
}
.ig-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ig-midia img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 3rem);
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}
.ig-pontos {
    position: absolute;
    left: 0; right: 0; bottom: .75rem;
    display: flex;
    justify-content: center;
    gap: 4px;
    pointer-events: none;
}
.ig-pontos[hidden] { display: none; }
.ig-pontos span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.4);
    box-shadow: 0 0 2px rgba(0,0,0,.4);
    transition: background .2s;
}
.ig-pontos span.ativo { background: #fff; }
.ig-entrando { animation: ig-entrar .25s ease-out; }
@keyframes ig-entrar { from { opacity: .3; } to { opacity: 1; } }
.ig-contador {
    position: absolute;
    top: .7rem; left: .7rem;
    padding: .15rem .6rem;
    border-radius: 999px;
    background: rgba(0,0,0,.65);
    color: var(--white);
    font-size: .75rem;
}
.ig-contador[hidden] { display: none; }
.ig-texto {
    flex: 1 1 38%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1.4rem;
    overflow-y: auto;
}
.ig-data { color: var(--primary); font-size: .78rem; font-weight: 500; margin-bottom: .7rem; }
.ig-legenda {
    flex: 1;
    color: rgba(255,255,255,.85);
    font-size: .92rem;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.ig-abrir {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--primary);
    font-family: inherit;
    font-size: .88rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}
.ig-acoes {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1.4rem;
    margin-top: 1.2rem;
}
.ig-abrir:hover { text-decoration: underline; }
.ig-curtidas {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin: 1rem 0 0 -.55rem;
}
.ig-curtidas-texto { color: var(--white); font-size: .9rem; font-weight: 600; }
.ig-seta, .ig-fechar {
    position: absolute;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: var(--white);
    font-size: 1.15rem;
    cursor: pointer;
    z-index: 1;
}
.ig-seta:hover, .ig-fechar:hover { background: rgba(255,255,255,.24); }
.ig-seta[hidden] { display: none; }
.ig-fechar { top: 1rem; right: 1rem; }
.ig-anterior { left: 1rem; top: 50%; transform: translateY(-50%); }
.ig-proxima { right: 1rem; top: 50%; transform: translateY(-50%); }

@media (max-width: 860px) {
    .ig-grade, .ig-grade-faixa { grid-template-columns: repeat(3, 1fr); gap: .3rem; }
    .ig-pagina .ig-grade { padding: 0 .3rem; }
    .ig-item { border-radius: 5px; }
    .ig-selo { width: 22px; height: 22px; font-size: .7rem; top: .3rem; right: .3rem; }

    .ig-janela { padding: 0; }
    .ig-caixa {
        flex-direction: column;
        height: 100%;
        max-height: none;
        border-radius: 0;
        overflow-y: auto;
    }
    .ig-midia { flex: 0 0 auto; }
    .ig-midia img { height: auto; max-height: 62vh; }
    .ig-texto { flex: 1 0 auto; overflow: visible; }
    /* Como no app do Instagram: coração logo abaixo da foto, curtidas embaixo dele */
    .ig-texto { padding-top: .35rem; }
    .ig-curtidas { order: -1; flex-wrap: wrap; row-gap: .1rem; margin: 0 0 .6rem -.55rem; }
    .ig-curtidas-texto { flex-basis: 100%; padding-left: .55rem; }
    .ig-anterior, .ig-proxima { top: 31vh; }
    .ig-anterior { left: .4rem; }
    .ig-proxima { right: .4rem; }
    .ig-fechar { top: .5rem; right: .5rem; }
}
