/* ============================================================
   Instagram Reels Feed  v4.3.0
   ============================================================ */

:root {
    --irf-play-bg:    rgba(0,0,0,0.45);
    --irf-play-icon:  #ffffff;
    --irf-lm-bg:      #111111;
    --irf-lm-text:    #ffffff;
    --irf-lm-border:  #333333;
    --irf-visit-bg:   linear-gradient(135deg,#f09433,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888);
    --irf-visit-text: #ffffff;
}

/* ── Wrapper ──────────────────────────────────────────────────
   display:flow-root creates a new BFC so the grid's height is
   always included in the wrapper — no overflow, no collapse.
   This is what keeps the footer pushed below on mobile.       */
.irf-wrapper {
    display: flow-root;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

/* ── Grid ─────────────────────────────────────────────────── */
.irf-grid {
    display: grid;
    grid-template-columns: repeat( var(--irf-cols, 3), 1fr );
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 767px) {
    .irf-grid {
        grid-template-columns: repeat( var(--irf-mcols, 2), 1fr );
        gap: 6px;
    }
}

/* ── Card ─────────────────────────────────────────────────── */
.irf-card {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.irf-card:hover        { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.22); }
.irf-card.irf-playing  { cursor: default; transform: none; box-shadow: none; }

/* ── Thumbnail ────────────────────────────────────────────── */
.irf-thumb-wrap {
    position: absolute;
    inset: 0;
    transition: opacity .22s ease;
}
.irf-card.irf-playing .irf-thumb-wrap { opacity: 0; pointer-events: none; }

.irf-thumb        { width: 100%; height: 100%; object-fit: cover; display: block; }
.irf-thumb-empty  { width: 100%; height: 100%; background: linear-gradient(135deg,#1a1a2e,#16213e); }

/* ── Play overlay ─────────────────────────────────────────── */
.irf-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.irf-play-overlay svg            { transition: transform .15s; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.irf-card:hover .irf-play-overlay svg { transform: scale(1.1); }

/* ── Reel badge ───────────────────────────────────────────── */
.irf-reel-badge {
    position: absolute; top: 7px; right: 8px;
    opacity: .9; pointer-events: none; line-height: 0;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
}

/* ── Inline video ─────────────────────────────────────────── */
.irf-video-wrap {
    position: absolute; inset: 0;
    background: #000; z-index: 10;
    display: none; animation: irf-fade .2s ease;
}
.irf-card.irf-playing .irf-video-wrap { display: block; }
.irf-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }

@keyframes irf-fade { from { opacity:0 } to { opacity:1 } }

/* ── Close button ─────────────────────────────────────────── */
.irf-close {
    position: absolute; top: 8px; right: 8px; z-index: 20;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(0,0,0,.55); border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0;
    transition: background .2s, transform .15s;
    -webkit-appearance: none;
}
.irf-close:hover { background: rgba(0,0,0,.82); transform: scale(1.1); }

/* ── Footer ───────────────────────────────────────────────────
   Sits in normal block flow AFTER the grid.
   No position, no z-index, no float — nothing that could make
   it overlap content above it on mobile.                       */
.irf-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

/* ── Load More ────────────────────────────────────────────── */
.irf-load-more {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 24px;
    background: var(--irf-lm-bg); color: var(--irf-lm-text);
    border: 1.5px solid var(--irf-lm-border); border-radius: 50px;
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: filter .2s, transform .15s;
    -webkit-appearance: none; white-space: nowrap;
}
.irf-load-more:hover   { filter: brightness(1.25); transform: translateY(-1px); }
.irf-load-more:active  { transform: translateY(0); }
.irf-load-more:disabled{ opacity: .45; cursor: default; transform: none; }

/* ── Visit Instagram ──────────────────────────────────────── */
.irf-visit {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 22px;
    background: var(--irf-visit-bg); color: var(--irf-visit-text);
    text-decoration: none; border-radius: 50px;
    font-size: 14px; font-weight: 500;
    transition: opacity .2s, transform .15s; white-space: nowrap;
}
.irf-visit:hover  { opacity: .88; transform: translateY(-1px); }
.irf-visit:active { transform: translateY(0); }

/* ── No reels ─────────────────────────────────────────────── */
.irf-no-reels { color: #888; font-style: italic; }
