/* Telegram media reuse the BuddyBoss type and icon system. */
.dtf-tg-gallery{--tg-accent:var(--bb-primary-color,#315cf4);--tg-border:var(--bb-content-border-color,#dce3ee);--tg-text:var(--bb-body-text-color,#203047);position:relative;max-width:100%;margin:14px 0 10px;color:var(--tg-text)}
.dtf-tg-gallery *, .dtf-tg-gallery-lightbox *{box-sizing:border-box}.dtf-tg-gallery [hidden],.dtf-tg-gallery-lightbox [hidden]{display:none!important}
/* The source-order list becomes the selected compact portrait mosaic. */
.dtf-tg-gallery-strip{display:grid;grid-template-columns:1fr 1.03fr .94fr;grid-template-rows:1.18fr 1fr;gap:8px;width:100%;max-width:100%;aspect-ratio:5/3;overflow:visible;padding:0}
.dtf-tg-gallery-item{position:relative;display:block;min-width:0;min-height:0;width:100%;height:100%;margin:0!important;padding:0!important;border:0!important;overflow:hidden;border-radius:8px;background:#edf1f6;text-decoration:none!important;isolation:isolate;container:dtf-tg-tile / inline-size}
.dtf-tg-gallery-item[data-slot="0"]{grid-column:1;grid-row:1/3}.dtf-tg-gallery-item[data-slot="1"]{grid-column:2/4;grid-row:1}.dtf-tg-gallery-item[data-slot="2"]{grid-column:2;grid-row:2}.dtf-tg-gallery-item[data-slot="3"]{grid-column:3;grid-row:2}
.dtf-tg-gallery.is-enhanced .dtf-tg-gallery-item[data-tgf-overflow]{display:none!important}
.dtf-tg-gallery:not(.is-enhanced) .dtf-tg-gallery-strip{grid-auto-rows:180px}.dtf-tg-gallery:not(.is-enhanced) .dtf-tg-gallery-item:nth-child(n+5){aspect-ratio:1.5}
.dtf-tg-gallery-item img,.dtf-tg-gallery-item video{display:block!important;width:100%!important;height:100%!important;max-width:100%;max-height:100%;margin:0!important;padding:0!important;border:0!important;border-radius:inherit;object-fit:cover!important;object-position:center}
.dtf-tg-gallery-item video{background:#15202e;cursor:zoom-in}.dtf-tg-gallery-item video::-webkit-media-controls-overlay-play-button{display:none!important}
.dtf-tg-gallery[data-count="2"] .dtf-tg-gallery-strip{grid-template-columns:1fr 1fr;grid-template-rows:1fr;aspect-ratio:1.5}.dtf-tg-gallery[data-count="2"] .dtf-tg-gallery-item[data-slot="0"]{grid-column:1;grid-row:1}.dtf-tg-gallery[data-count="2"] .dtf-tg-gallery-item[data-slot="1"]{grid-column:2;grid-row:1}
.dtf-tg-gallery[data-count="3"] .dtf-tg-gallery-strip{grid-template-columns:1fr 1.5fr}.dtf-tg-gallery[data-count="3"] .dtf-tg-gallery-item[data-slot="1"]{grid-column:2;grid-row:1}.dtf-tg-gallery[data-count="3"] .dtf-tg-gallery-item[data-slot="2"]{grid-column:2;grid-row:2}
.dtf-tg-gallery[data-count="1"] .dtf-tg-gallery-strip{display:block;aspect-ratio:auto}
.dtf-tg-gallery[data-count="1"] .dtf-tg-gallery-item{width:min(100%,var(--tg-single-width,540px),calc(var(--tg-single-height,440px) * (var(--tg-ratio,1))));height:auto;max-height:440px;aspect-ratio:var(--tg-ratio,auto)}
.dtf-tg-gallery[data-count="1"] .dtf-tg-gallery-item img,.dtf-tg-gallery[data-count="1"] .dtf-tg-gallery-item video{object-fit:contain!important}
.dtf-tg-gallery[data-count="1"] .dtf-tg-gallery-item:not([style]) img{width:auto!important;height:auto!important;max-height:440px}
.dtf-tg-gallery-icon{display:inline-block;flex:0 0 auto;width:22px;height:22px;background:currentColor;-webkit-mask:var(--tg-icon) center/contain no-repeat;mask:var(--tg-icon) center/contain no-repeat}
.dtf-tg-gallery-icon-photo{--tg-icon:url('../icons/gallery/photo.svg')}.dtf-tg-gallery-icon-play{--tg-icon:url('../icons/gallery/player-play-filled.svg')}.dtf-tg-gallery-icon-pause{--tg-icon:url('../icons/gallery/player-pause-filled.svg')}.dtf-tg-gallery-icon-volume{--tg-icon:url('../icons/gallery/volume.svg')}.dtf-tg-gallery-icon-muted{--tg-icon:url('../icons/gallery/volume-off.svg')}.dtf-tg-gallery-icon-maximize{--tg-icon:url('../icons/gallery/maximize.svg')}.dtf-tg-gallery-icon-times{--tg-icon:url('../icons/gallery/x.svg')}.dtf-tg-gallery-icon-angle-left{--tg-icon:url('../icons/gallery/chevron-left.svg')}.dtf-tg-gallery-icon-angle-right{--tg-icon:url('../icons/gallery/chevron-right.svg')}
/* Compact by default: a narrow tile must never paint its clock over a button. */
.dtf-tg-gallery-controls{position:absolute;left:0;right:0;bottom:0;z-index:2;display:grid;grid-template-columns:repeat(3,minmax(28px,1fr));grid-template-areas:"clock clock clock" "play volume expand" "progress progress progress";align-items:center;gap:4px 7px;padding:9px 11px 10px;background:#0009;color:#fff;line-height:1;opacity:1}
.dtf-tg-gallery-controls [data-tgf-video-play]{grid-area:play;justify-self:start}.dtf-tg-gallery-controls [data-tgf-video-volume]{grid-area:volume;justify-self:center}.dtf-tg-gallery-controls [data-tgf-video-expand]{grid-area:expand;justify-self:end}
.dtf-tg-gallery .dtf-tg-gallery-control{appearance:none;display:grid;place-items:center;width:28px;height:28px;min-width:28px;min-height:28px;margin:0!important;padding:0!important;border:0!important;border-radius:4px!important;background:transparent!important;box-shadow:none!important;color:#fff!important;cursor:pointer;line-height:1!important}
.dtf-tg-gallery .dtf-tg-gallery-control:hover{background:#ffffff25!important}.dtf-tg-gallery-control .dtf-tg-gallery-icon{width:21px;height:21px}.dtf-tg-gallery-clock{grid-area:clock;min-width:0;color:#fff;font-size:13px;font-weight:400;line-height:1.2;white-space:normal;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.dtf-tg-gallery .dtf-tg-gallery-progress{grid-area:progress;display:block;appearance:auto;width:100%;min-width:0;height:13px;min-height:13px;margin:0!important;padding:0!important;border:0!important;border-radius:0;background:transparent;accent-color:#fff;cursor:pointer;touch-action:pan-x}
.dtf-tg-gallery-item:not([data-slot="0"]):not(.is-playing):not(:focus-within):not(:hover) .dtf-tg-gallery-controls{grid-template-columns:28px minmax(0,1fr);grid-template-areas:"play clock";gap:5px;padding:8px 10px}.dtf-tg-gallery-item:not([data-slot="0"]):not(.is-playing):not(:focus-within):not(:hover) .dtf-tg-gallery-controls [data-tgf-video-volume],.dtf-tg-gallery-item:not([data-slot="0"]):not(.is-playing):not(:focus-within):not(:hover) .dtf-tg-gallery-controls [data-tgf-video-expand],.dtf-tg-gallery-item:not([data-slot="0"]):not(.is-playing):not(:focus-within):not(:hover) .dtf-tg-gallery-progress{display:none}
/* Width belongs to the media tile, including narrow desktop mosaics. */
@container dtf-tg-tile (max-width:140px){.dtf-tg-gallery-controls{grid-template-columns:repeat(3,minmax(0,1fr));column-gap:2px;padding:6px 4px}.dtf-tg-gallery .dtf-tg-gallery-control{width:25px;min-width:25px;height:25px;min-height:25px}.dtf-tg-gallery-clock{font-size:11px}}
@container dtf-tg-tile (min-width:280px){.dtf-tg-gallery-controls{grid-template-columns:28px minmax(0,1fr) 28px 28px;grid-template-areas:"play clock volume expand" "progress progress progress progress";gap:7px}.dtf-tg-gallery-clock{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}
.dtf-tg-gallery-preview-status{position:absolute;inset:0;z-index:1;display:grid;place-items:center;padding:22px 14px 70px;background:#edf1f6;color:#63728a;font-size:12px;text-align:center;pointer-events:none}.dtf-tg-gallery-preview-status:empty{display:none}
.dtf-tg-gallery .dtf-tg-gallery-more{position:absolute;inset:0;z-index:3;display:grid;place-content:center;gap:4px;margin:0!important;padding:12px!important;border:0!important;border-radius:inherit!important;background:#0a14216b!important;color:#fff!important;text-align:center;font-size:24px;font-weight:600;line-height:1.2;cursor:pointer}.dtf-tg-gallery-more small{font-size:12px;font-weight:400}
.dtf-tg-gallery-footer{display:flex;align-items:center;gap:12px;margin-top:11px;font-size:13px;line-height:1.5;color:#8a96a9}.dtf-tg-gallery-footer>span{display:flex;align-items:center;gap:7px}.dtf-tg-gallery-footer .dtf-tg-gallery-icon{width:18px;height:18px}
/* Cached old markup is upgraded on arrival, without the old top-right icon. */
.dtf-tg-gallery-expand,.dtf-tg-gallery-scroll,.dtf-tg-gallery-video-label,.dtf-tg-gallery .dtf-tg-player-caption,.dtf-tg-gallery .dtf-tg-gallery-footer [data-tgf-gallery-open]{display:none!important}
.dtf-tg-gallery-label,.dtf-tg-gallery-sr{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}
.dtf-tg-gallery-item:fullscreen{width:100vw!important;height:100vh!important;max-height:none!important;border-radius:0;background:#000}.dtf-tg-gallery-item:fullscreen video{object-fit:contain!important}.dtf-tg-gallery-item:fullscreen .dtf-tg-gallery-controls{padding:16px;grid-template-columns:32px minmax(0,1fr) 32px 32px;grid-template-areas:"play clock volume expand" "progress progress progress progress"}
.dtf-tg-gallery-lightbox{--tg-accent:var(--bb-primary-color,#315cf4);--tg-border:var(--bb-content-border-color,#dce3ee);--tg-text:var(--bb-body-text-color,#203047);box-sizing:border-box;position:fixed;inset:0;z-index:2147483000;width:min(1300px,calc(100vw - 48px));max-width:none;max-height:calc(100dvh - 48px);margin:auto;padding:22px 24px 24px;border:1px solid #e4e9f1;border-radius:13px;background:var(--bb-content-background-color,#fff);color:var(--tg-text);box-shadow:0 15px 70px #111d3830;overflow:auto;font-family:inherit;line-height:1.5}
.dtf-tg-gallery-lightbox:not([open]){display:none}.dtf-tg-gallery-lightbox::backdrop{background:#122340ba}.dtf-tg-gallery-lightbox-head{display:flex;align-items:start;justify-content:space-between;gap:20px;margin-bottom:18px}.dtf-tg-gallery-lightbox-head h2{margin:0;padding:0;color:var(--tg-text);font-size:20px;line-height:1.5;font-weight:600}
.dtf-tg-gallery-lightbox .dtf-tg-gallery-close{appearance:none;flex:0 0 40px;display:grid;place-items:center;width:40px!important;height:40px!important;min-width:40px;min-height:40px;max-width:40px;max-height:40px;margin:-4px -4px 0 0!important;padding:0!important;border:0!important;border-radius:8px!important;background:transparent!important;box-shadow:none!important;color:#6b7c94!important;line-height:1!important;cursor:pointer;text-shadow:none}
.dtf-tg-gallery-lightbox .dtf-tg-gallery-close:hover{background:#edf1f7!important;color:var(--tg-text)!important}.dtf-tg-gallery-close>i{display:block;font-size:26px;line-height:1}.dtf-tg-gallery-close small{display:none}
.dtf-tg-gallery-lightbox-layout{display:grid;grid-template-columns:minmax(0,1fr) 292px;gap:20px;align-items:stretch}.dtf-tg-gallery-visual{min-width:0}.dtf-tg-gallery-stage{position:relative;border-radius:8px;overflow:hidden;background:#eff2f7}.dtf-tg-gallery-lightbox-media{position:relative;height:min(57vh,550px);min-height:260px;overflow:hidden}.dtf-tg-gallery-lightbox .dtf-tg-gallery-lightbox-media>img,.dtf-tg-gallery-lightbox .dtf-tg-gallery-lightbox-media>video{position:absolute;inset:0;display:block;width:100%!important;height:100%!important;min-width:0;min-height:0;max-width:100%;max-height:100%;object-fit:contain;object-position:center;margin:0;padding:0;border:0;border-radius:0;background:transparent}
.dtf-tg-gallery-lightbox-media>video::-webkit-media-controls-overlay-play-button{display:none!important}.dtf-tg-gallery-media-error{position:absolute;inset:auto 20px 20px;margin:0;padding:12px;border-radius:8px;background:#fff;color:#4c5e77;font-size:13px;line-height:1.5}
.dtf-tg-gallery-arrow{display:grid;place-items:center;position:absolute;top:calc(50% - 23px);z-index:2;width:46px;height:46px;min-height:0;margin:0!important;padding:0!important;border:0!important;border-radius:50%!important;background:#ffffffe8!important;color:var(--tg-accent)!important;box-shadow:0 2px 12px #1123401c;cursor:pointer;font-size:27px!important}.dtf-tg-gallery-prev{left:14px}.dtf-tg-gallery-next{right:14px}.dtf-tg-gallery-arrow:disabled{opacity:.3;cursor:default}
.dtf-tg-gallery-thumbs{display:flex;gap:10px;overflow-x:auto;max-width:100%;margin-top:14px;padding:2px 2px 3px;scrollbar-width:thin;overscroll-behavior-inline:contain}.dtf-tg-gallery-thumb{position:relative;flex:1 0 105px;max-width:170px;height:90px;min-height:0;margin:0!important;padding:0!important;border:2px solid transparent!important;border-radius:7px!important;background:#eef2f8!important;color:#52647e!important;overflow:hidden;cursor:pointer;font:inherit}.dtf-tg-gallery-thumb[aria-current="true"]{border-color:var(--tg-accent)!important;box-shadow:0 0 0 1px var(--tg-accent)}.dtf-tg-gallery-thumb img{display:block;width:100%;height:100%;object-fit:cover}.dtf-tg-gallery-thumb-video{position:absolute;left:5px;bottom:5px;display:flex;gap:4px;align-items:center;background:#16253bd9;color:#fff;border-radius:5px;padding:2px 5px;font-size:11px}
.dtf-tg-gallery-details{display:flex;flex-direction:column;gap:24px;border-left:1px solid var(--tg-border);padding-left:20px;min-width:0}.dtf-tg-gallery-author{display:flex;align-items:center;gap:12px;margin-top:10px}.dtf-tg-gallery-avatar{display:grid;place-items:center;flex:0 0 56px;width:56px;height:56px;border-radius:50%;overflow:hidden;background:#e3e9ff;color:#315cf4;text-decoration:none!important;font-size:25px;font-weight:500}.dtf-tg-gallery-avatar img{display:block;width:100%;height:100%;object-fit:cover;margin:0;border:0}.dtf-tg-gallery-author>div{display:grid;gap:3px;min-width:0}.dtf-tg-gallery-author-name{font-size:15px;font-weight:600;line-height:1.5;color:var(--tg-text)!important;text-decoration:none!important;overflow-wrap:anywhere}.dtf-tg-gallery-community,.dtf-tg-gallery-date{font-size:12px;color:#73829b;line-height:1.5}.dtf-tg-gallery-caption{margin:0;font-size:15px;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--tg-text)}
.dtf-tg-gallery-detail-footer{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px;margin-top:auto;padding-top:18px;border-top:1px solid var(--tg-border);font-size:12px}.dtf-tg-gallery-detail-footer a{display:flex;align-items:center;gap:4px;color:var(--tg-accent);text-decoration:none}.dtf-tg-gallery-position{color:#73829b}
.dtf-tg-gallery :is(button,a):focus-visible,.dtf-tg-gallery-lightbox :is(button,a,video):focus-visible{outline:2px solid var(--tg-accent);outline-offset:3px}
@media(max-width:900px){.dtf-tg-gallery-lightbox{padding:18px;width:calc(100vw - 32px);max-height:calc(100dvh - 32px)}.dtf-tg-gallery-lightbox-layout{grid-template-columns:minmax(0,1fr) 240px;gap:15px}.dtf-tg-gallery-details{padding-left:15px}.dtf-tg-gallery-thumb{height:72px;flex-basis:84px}.dtf-tg-gallery-author{align-items:flex-start;gap:9px}.dtf-tg-gallery-avatar{flex-basis:44px;width:44px;height:44px}}
@media(max-width:680px){.dtf-tg-gallery-strip{gap:6px}.dtf-tg-gallery-controls{gap:3px;padding:5px 6px 7px}.dtf-tg-gallery .dtf-tg-gallery-control{width:25px;min-width:25px;height:25px;min-height:25px}.dtf-tg-gallery-control .dtf-tg-gallery-icon{width:18px;height:18px}.dtf-tg-gallery-clock{font-size:11px}.dtf-tg-gallery[data-count="1"] .dtf-tg-gallery-item,.dtf-tg-gallery[data-count="1"] .dtf-tg-gallery-item img,.dtf-tg-gallery[data-count="1"] .dtf-tg-gallery-item video{max-height:360px}.dtf-tg-gallery-lightbox{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:14px;border-radius:10px}.dtf-tg-gallery-lightbox-head{margin-bottom:12px}.dtf-tg-gallery-lightbox-head h2{font-size:17px}.dtf-tg-gallery-lightbox-layout{grid-template-columns:minmax(0,1fr);gap:16px}.dtf-tg-gallery-lightbox-media{height:min(46vh,380px);min-height:170px}.dtf-tg-gallery-details{gap:14px;border-left:0;border-top:1px solid var(--tg-border);padding:14px 0 0}.dtf-tg-gallery-author{margin:0;align-items:center}.dtf-tg-gallery-caption{font-size:14px}.dtf-tg-gallery-detail-footer{padding-top:12px}.dtf-tg-gallery-thumbs{gap:7px;margin-top:10px}.dtf-tg-gallery-thumb{flex:0 0 76px;height:54px}.dtf-tg-gallery-arrow{width:36px;height:36px;top:calc(50% - 18px);font-size:23px!important}.dtf-tg-gallery-prev{left:8px}.dtf-tg-gallery-next{right:8px}.dtf-tg-gallery-footer{font-size:12px}}
/* Keep portrait media width in step with the smaller mobile height cap. */
@media(max-width:680px){.dtf-tg-gallery{--tg-single-height:360px}}
@media(prefers-reduced-motion:reduce){.dtf-tg-gallery-strip,.dtf-tg-gallery-thumbs{scroll-behavior:auto}}

@media(max-width:440px){.dtf-tg-gallery-strip{grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr 1fr;aspect-ratio:1}.dtf-tg-gallery-item[data-slot="0"]{grid-column:1;grid-row:1/4}.dtf-tg-gallery-item[data-slot="1"]{grid-column:2;grid-row:1}.dtf-tg-gallery-item[data-slot="2"]{grid-column:2;grid-row:2}.dtf-tg-gallery-item[data-slot="3"]{grid-column:2;grid-row:3}.dtf-tg-gallery[data-count="3"] .dtf-tg-gallery-strip{grid-template-rows:1fr 1fr;aspect-ratio:1.2}.dtf-tg-gallery[data-count="3"] .dtf-tg-gallery-item[data-slot="0"]{grid-row:1/3}.dtf-tg-gallery[data-count="2"] .dtf-tg-gallery-strip{aspect-ratio:1.1}.dtf-tg-gallery[data-count="2"] .dtf-tg-gallery-item[data-slot="0"]{grid-row:1}}
