/* Publication-scoped adaptation of the supplied chat viewer. */
.post-media-viewer {
    position: fixed; inset: 0; box-sizing: border-box; width: 100vw; height: 100vh; height: 100dvh;
    max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden;
    background: #000; color: #fff; opacity: 0; transition: opacity .18s ease;
    font-family: inherit; color-scheme: dark; overscroll-behavior: contain;
}
.post-media-viewer[open] { display: block; }
.post-media-viewer.is-visible { opacity: 1; }
.post-media-viewer::backdrop { background: #000; }
.post-media-viewer *, .post-media-viewer *::before, .post-media-viewer *::after { box-sizing: border-box; }
.post-media-viewer [hidden] { display: none !important; }
.post-media-viewer__stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.post-media-viewer__image { display: block; max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transform-origin: center; cursor: default; }
.post-media-viewer.is-image-zoomed .post-media-viewer__image { max-width: none; max-height: none; cursor: grab; }
.post-media-viewer.is-image-dragging .post-media-viewer__image { cursor: grabbing; }
.post-media-viewer__meta { position: absolute; top: max(20px, env(safe-area-inset-top)); left: max(24px, env(safe-area-inset-left)); z-index: 2; max-width: calc(100% - 150px); pointer-events: none; text-shadow: 0 1px 8px #000; }
.post-media-viewer__meta span { display: block; font-size: 12px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.post-media-viewer__meta [data-viewer-counter] { font-weight: 600; }
.post-media-viewer__meta [data-viewer-name] { margin-top: 4px; overflow: hidden; color: #ffffff99; white-space: nowrap; text-overflow: ellipsis; }
.post-media-viewer__top-actions { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 3; display: flex; gap: 4px; }
.post-media-viewer__button, .post-media-viewer__nav, .post-media-viewer__scale {
    display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 50%; background: #0004; color: #fff; cursor: pointer;
    text-decoration: none; box-shadow: none; transform: none; transition: background-color .16s ease, color .16s ease;
    -webkit-tap-highlight-color: transparent;
}
.post-media-viewer__button:hover, .post-media-viewer__nav:hover, .post-media-viewer__scale:hover { background: #ffffff14; color: #fff; transform: none; }
.post-media-viewer button:focus-visible, .post-media-viewer a:focus-visible, .post-media-viewer input:focus-visible, .post-media-viewer select:focus-visible { outline: 2px solid #fff9; outline-offset: 2px; }
.post-media-viewer svg, .post-media-expand svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.post-media-viewer__nav { position: absolute; top: 50%; z-index: 2; width: 48px; height: 64px; border-radius: 8px; color: #ffffffb3; transform: translateY(-50%); }
.post-media-viewer__nav:hover { transform: translateY(-50%); }
.post-media-viewer__nav:disabled { opacity: .2; cursor: default; pointer-events: none; }
.post-media-viewer__nav--previous { left: max(8px, env(safe-area-inset-left)); }
.post-media-viewer__nav--next { right: max(8px, env(safe-area-inset-right)); }
.post-media-viewer__zoom { position: absolute; z-index: 2; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; display: flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 30px; background: #101114dc; transform: translateX(-50%); }
.post-media-viewer__scale { min-width: 52px; width: auto; padding: 0 7px; border-radius: 8px; font-family: inherit; font-size: 12px; font-variant-numeric: tabular-nums; }
.post-media-viewer__status { position: absolute; z-index: 3; left: 50%; top: 50%; max-width: calc(100% - 40px); padding: 12px 16px; border-radius: 14px; background: #111c; color: #fff; font-size: 13px; text-align: center; transform: translate(-50%, -50%); }
.post-media-viewer__status button { display: block; margin: 10px auto 0; padding: 6px 12px; border: 0; border-radius: 7px; background: #ffffff1a; color: #fff; cursor: pointer; }
.post-media-viewer.is-loading [data-viewer-status-text]::before { content: ''; display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px; border: 1.5px solid #fff4; border-top-color: #fff; border-radius: 50%; animation: post-media-spin .8s linear infinite; }
.post-media-viewer__meta, .post-media-viewer__top-actions, .post-media-viewer__zoom { transition: opacity .16s ease; }
.post-media-viewer.is-controls-hidden .post-media-viewer__meta, .post-media-viewer.is-controls-hidden .post-media-viewer__zoom { opacity: 0; pointer-events: none; }
.post-media-viewer__video { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.post-media-viewer__video-controls { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; z-index: 2; width: min(800px, calc(100% - 32px)); padding: 12px 12px 4px; border-radius: 16px; background: #101114e8; transform: translateX(-50%); }
.post-media-viewer__video-row { display: flex; align-items: center; gap: 8px; }
.post-media-viewer__video-row [data-viewer-time] { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.post-media-viewer__spacer { flex: 1; }
.post-media-viewer input[type="range"] { accent-color: #fff; cursor: pointer; }
.post-media-viewer [data-viewer-progress] { display: block; width: 100%; height: 16px; margin: 0; }
.post-media-viewer [data-viewer-volume] { width: 74px; }
.post-media-viewer [data-viewer-speed] { height: 32px; padding: 0 5px; border: 0; border-radius: 6px; background: #25262a; color: #fff; font-size: 12px; }
.post-media-video, .feed-gallery__item--video { position: relative; }
.post-media-expand { position: absolute; top: 8px; right: 8px; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: #0009; color: #fff; cursor: pointer; }
@keyframes post-media-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
    .post-media-viewer__meta { left: max(16px, env(safe-area-inset-left)); }
    .post-media-viewer__nav { top: auto; bottom: max(24px, env(safe-area-inset-bottom)); height: 44px; width: 38px; transform: none; }
    .post-media-viewer__nav:hover { transform: none; }
    .post-media-viewer__zoom { bottom: max(22px, env(safe-area-inset-bottom)); gap: 0; padding: 0 5px; }
    .post-media-viewer__zoom .post-media-viewer__button { width: 38px; }
    .post-media-viewer__video-controls { width: calc(100% - 24px); bottom: max(76px, env(safe-area-inset-bottom)); padding: 8px 6px 2px; }
    .post-media-viewer__video-row { gap: 3px; }
    .post-media-viewer__video-row .post-media-viewer__button { width: 36px; }
    .post-media-viewer [data-viewer-volume] { display: none; }
}
@media (prefers-reduced-motion: reduce) { .post-media-viewer, .post-media-viewer * { transition: none !important; animation: none !important; } }
