/* ─── Post content caption ─────────────────────────────────────────── */

.ig-caption {
    /* line breaks are stored as <br> tags — no pre-line needed here */
}

/* ─── Instagram Feed Grid ──────────────────────────────────────────── */

.igsync-grid {
    display: grid;
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
}

.igsync-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #fafafa;
}

.igsync-item:focus {
    outline: 2px solid #0095f6;
    outline-offset: -2px;
}

.igsync-thumb {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Square aspect ratio */
    overflow: hidden;
}

.igsync-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.igsync-item:hover .igsync-thumb img {
    transform: scale(1.03);
}

/* ─── Grid overlay icons (video / carousel) ───────────────────────── */

.igsync-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 2;
    pointer-events: none;
}

.igsync-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    line-height: 1;
}

.igsync-icon-carousel {
    font-size: 13px;
}

/* ─── Hover overlay ───────────────────────────────────────────────── */

.igsync-hover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1;
    padding: 12px;
}

.igsync-item:hover .igsync-hover,
.igsync-item:focus .igsync-hover {
    opacity: 1;
}

.igsync-hover-caption {
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ─── Lightbox ────────────────────────────────────────────────────── */

.igsync-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.igsync-lightbox[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.igsync-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.igsync-lb-container {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 4px;
    max-width: 1100px;
    max-height: 90vh;
    width: 95vw;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.igsync-lb-close {
    position: absolute;
    top: -36px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
    padding: 4px 8px;
}

.igsync-lb-close:hover {
    opacity: 0.8;
}

/* ─── Lightbox body: media + info side-by-side ────────────────────── */

.igsync-lb-body {
    display: flex;
    flex-direction: row;
    min-height: 0;
    height: 80vh;
    max-height: 80vh;
}

/* Media panel */
.igsync-lb-media {
    position: relative;
    flex: 1 1 60%;
    min-width: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.igsync-lb-media-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.igsync-lb-media-inner img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.igsync-lb-media-inner video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Carousel arrows */
.igsync-lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    color: #262626;
}

.igsync-lb-arrow:hover {
    background: #fff;
}

.igsync-lb-prev { left: 12px; }
.igsync-lb-next { right: 12px; }

.igsync-lb-arrow.active {
    display: flex;
}

/* Carousel dots */
.igsync-lb-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 4px;
    z-index: 3;
}

.igsync-lb-dots.active {
    display: flex;
}

.igsync-lb-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: background 0.2s ease;
}

.igsync-lb-dot.current {
    background: #0095f6;
}

/* Info panel */
.igsync-lb-info {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #efefef;
    overflow-y: auto;
}

.igsync-lb-header {
    padding: 14px 16px;
    border-bottom: 1px solid #efefef;
    font-size: 14px;
    color: #262626;
}

.igsync-lb-account {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.igsync-lb-account:hover {
    text-decoration: underline;
}

.igsync-lb-caption {
    flex: 1;
    padding: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #262626;
    white-space: pre-line;
    overflow-y: auto;
}

.igsync-lb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #efefef;
    font-size: 12px;
    color: #8e8e8e;
}

.igsync-lb-iglink {
    color: #0095f6;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}

.igsync-lb-iglink:hover {
    text-decoration: underline;
}

/* ─── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .igsync-lb-body {
        flex-direction: column;
        height: auto;
        max-height: 90vh;
    }

    .igsync-lb-media {
        flex: 0 0 auto;
        aspect-ratio: 1 / 1;
        max-height: 55vh;
    }

    .igsync-lb-info {
        flex: 1 1 auto;
        border-left: none;
        border-top: 1px solid #efefef;
        max-height: 35vh;
    }

    .igsync-lb-container {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .igsync-lb-close {
        top: 8px;
        right: 8px;
        color: #fff;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 32px;
        height: 32px;
        font-size: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
}

/* ─── Empty state ─────────────────────────────────────────────────── */

.igsync-empty {
    text-align: center;
    color: #8e8e8e;
    font-size: 14px;
    padding: 40px 20px;
}

/* ─── Body scroll lock when lightbox open ─────────────────────────── */

body.igsync-lb-open {
    overflow: hidden;
}
