/* Feed media fit, fullscreen fill and media protection. JS: public/js/media-guard.js */

/* Box = media's own shape (4:5 … 1.91:1), media covers it → no black bars above/beside. */
html body .ig2-media.ig2-fit { aspect-ratio: var(--ig-ratio) !important; height: auto !important; max-height: none !important; }
html body .ig2-media.ig2-fit > img.post-media,
html body .ig2-media.ig2-fit > video.post-media,
html body .ig2-media.ig2-fit > .sv-video-player,
html body .ig2-media.ig2-fit > .sv-video-player > video.post-media {
    width: 100% !important; height: 100% !important; max-height: none !important; object-fit: cover !important;
}
html body .ig2-media.ig2-fit > .sv-video-player { position: absolute !important; inset: 0 !important; }

/* Fullscreen: fill the whole screen, show the whole frame (phone rotates to landscape for wide videos). */
html body video:fullscreen, html body video:-webkit-full-screen,
html body .ig2-media video[data-ig-video]:fullscreen, html body .ig2-media video[data-ig-video]:-webkit-full-screen,
html body :fullscreen video, html body :-webkit-full-screen video,
html body .ig2-media.ig2-fit .sv-video-player > video.post-media:fullscreen,
html body .ig2-media.ig2-fit > video.post-media:fullscreen,
html body .ig2-media.ig2-fit .sv-video-player:fullscreen > video.post-media {
    width: 100vw !important; height: 100vh !important; max-width: none !important; max-height: none !important;
    object-fit: contain !important; background: #000 !important; border-radius: 0 !important; aspect-ratio: auto !important;
}
html body .sv-video-player:fullscreen, html body .ig2-media:fullscreen, html body .ig-reel-media:fullscreen,
html body .ig2-media.ig2-fit > .sv-video-player:fullscreen {
    position: static !important;
    width: 100vw !important; height: 100vh !important; max-height: none !important; aspect-ratio: auto !important; border-radius: 0 !important; background: #000 !important;
}

/* Protection: no long-press save menu on phones, no selecting/dragging media. */
.ig2-media img, .ig2-media video, .sv-video-player video, .ig-reel-media video, .ig-reel-media img,
.lib-thumb img, .lib-thumb video, .lib-player img, .lib-player video, .sv-reco-reel-card video,
img.post-media, video.post-media {
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
/* Chat photo/video viewer: no download button (documents keep theirs). */
[data-lightbox-download] { display: none !important; }
/* Brief shield after PrintScreen. */
html.sv-shield img, html.sv-shield video { filter: blur(24px) !important; }
