.instagram-section {
    background: var(--soft);
}

.instagram-grid {
    display: flex;
    gap: 18px;
    align-items: start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scroll-snap-type: inline proximity;
    scroll-padding-inline: 0;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
}

.instagram-grid::-webkit-scrollbar {
    display: none;
}

.instagram-card {
    --instagram-embed-height: 620px;
    --instagram-embed-crop: 86px;
    flex: 0 0 38%;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 14px 35px rgba(27, 65, 57, .07);
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.instagram-card-header {
    position: relative;
    z-index: 1;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.instagram-card-profile {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.instagram-card-avatar {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 3px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f9ce34, #ee2a7b 52%, #6228d7);
}

.instagram-card-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    border: 2px solid var(--surface);
    border-radius: 50%;
    object-fit: cover;
}

.instagram-card-profile > span:last-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.instagram-card-profile strong {
    overflow: hidden;
    font-size: .86rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.instagram-card-profile small {
    color: var(--text-muted);
    font-size: .68rem;
}

.instagram-card-profile-link {
    flex: 0 0 auto;
    color: var(--primary);
    font-size: .75rem;
    font-weight: 800;
}

.instagram-card-profile-link:hover {
    text-decoration: underline;
}

.instagram-embed-viewport {
    position: relative;
    height: var(--instagram-embed-height);
    overflow: hidden;
    background: var(--surface);
}

.instagram-post-drag-surface {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .instagram-grid.is-dragging {
        scroll-behavior: auto;
        scroll-snap-type: none;
        cursor: grabbing;
        user-select: none;
    }

    .instagram-post-drag-surface {
        position: absolute;
        z-index: 2;
        inset: 0;
        display: block;
        cursor: grab;
        -webkit-user-drag: none;
    }

    .instagram-grid.is-dragging .instagram-post-drag-surface {
        cursor: grabbing;
    }
}

.instagram-embed-viewport iframe {
    display: block;
    width: 100%;
    height: calc(var(--instagram-embed-height) + var(--instagram-embed-crop));
    border: 0;
    background: var(--surface);
    transform: translateY(calc(-1 * var(--instagram-embed-crop)));
}

.instagram-action {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.instagram-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.instagram-control {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary-dark);
    font-size: 1.15rem;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s, opacity .2s;
}

.instagram-control:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.instagram-control:disabled {
    opacity: .38;
    cursor: not-allowed;
}

.instagram-counter {
    min-width: 48px;
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 750;
    text-align: center;
}

@media (max-width: 960px) {
    .instagram-card {
        flex-basis: 58%;
    }
}

@media (max-width: 620px) {
    .instagram-grid {
        gap: 14px;
        scroll-snap-type: inline mandatory;
    }

    .instagram-card {
        --instagram-embed-height: 590px;
        flex: 0 0 86%;
    }

    .instagram-card-header {
        min-height: 66px;
        padding: 10px 12px;
    }

    .instagram-card-avatar {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .instagram-grid {
        scroll-behavior: auto;
    }
}
