/* ========== Instagram Feed Layout ========== */

.djm_instagram-feed-wrapper {
    max-width: 1200px;
    margin: auto;
}

.djm_instagram-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.djm_instagram-profile-icon {
    border-radius: 50%;
    width: 80px;
    height: 80px;
    margin-right: 15px;
}

.djm_instagram-stats span {
    margin-right: 10px;
}

.djm_instagram-grid {
    display: grid;
    gap: 10px;
}

.djm_instagram-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.djm_instagram-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.djm_instagram-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.djm_instagram-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1; /* Square grid layout */
    background: #000;    /* fallback background */
}

/* Background thumb (image or video) */
.djm_thumb-bg {
    position: absolute;
    inset: 0;
    display: block;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    transition: transform .4s ease;
    z-index: 1;
}

/* Hover zoom applies to background only */
.djm_instagram-item:hover .djm_thumb-bg {
    transform: scale(1.05);
}

.djm_multi-icon {
    font-size: 20px;
}

/* Multi-icon stays top-right */
.djm_multi-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #fff;
    padding: 4px;
    border-radius: 3px;
    z-index: 3;
}

/* Play icon */
.djm_video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;

    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    font-size: 24px;
    color: #fff;
    padding: 12px;

    z-index: 3;
    pointer-events: none;
}

.djm_video-icon > i {
    padding-left: 4px;
}

.djm_instagram-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* Hidden gallery anchors for Fancybox */
.djm_hidden-gallery a {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
}

/* Overlay covers the whole thumb */
.djm_overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;

    display: flex;
    justify-content: center;
    align-items: center;

    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;

    z-index: 2;
    pointer-events: none; /* let clicks pass through */
}

.djm_instagram-item:hover .djm_overlay {
    opacity: 1;
}

.djm_overlay_content {
    color: #fff;
    font-size: 16px;
    display: flex;
    gap: 15px;
    align-items: center;
}
/* Shift likes/comments lower ONLY for video posts */
.djm_video-thumb .djm_overlay_content {
    position: absolute;
    top: 75%;                   /* 75% down from top */
    left: 50%;
    transform: translateX(-50%); /* center horizontally */
    z-index: 3;
}
.djm_overlay_content i {
    margin-right: 5px;
}

/* ========== Base Modal Styles (Shared) ========== */

.djm_modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;                /* prevent page scroll under modal */
    background-color: rgba(0, 0, 0, 0.8);
}

/* ========== Video Modal (ID-specific) ========== */

/* Backdrop modal */
#djm_video_modal.is-open {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Keep the backdrop from creating page scrollbars */
#djm_video_modal {
    overflow: hidden;
}

/* Black content box: constrain by both width & height */
#djm_video_modal .djm_modal-content {
    margin: 0 !important;
    box-sizing: border-box;
    background: #000;
    border-radius: 10px;
    padding: 16px;

    display: flex;
    flex-direction: column;

    width: auto;
    max-width: 80vw;        /* <= 80% of viewport width */
    max-height: 80vh;       /* <= 80% of viewport height */

    overflow: hidden;       /* parent does NOT scroll; children manage their own scroll */
    min-height: 0;          /* allows shrinking under 80vh */
    text-align: center;
}

/* Close button */
#djm_video_modal .djm_close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
    z-index: 2;
}

/* Video scales within content box */
#djm_video_player {
    flex: 1 1 auto;
    min-height: 0;          /* allows shrinking under the 80vh cap */
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

/* Caption below video, scrolls if long */
#djm_video_caption {
    flex: 0 0 auto;
    max-height: 40%;        /* safety cap so caption can't push video out */
    overflow: auto;         /* caption scrolls independently */
    color: #fff;
    margin-top: 8px;
    padding: 0 2px;
}

/* ========== Utility/Minor Tweaks ========== */

html, body {
    height: 100%;
    margin: 0;
}
