/* Посты из Telegram: горизонтальная лента, сетка и плеер. */

.tgstrip,
.tgfeed {
    --c: var(--theme-base-color, #a855f7);
    --text: #f6f3fa;
    --muted: rgba(246, 243, 250, .55);
    --line: rgba(246, 243, 250, .12);

    color: var(--text);
    font-family: inherit;
    text-align: left;
}

.tgstrip li::before,
.tgfeed li::before { content: none !important; }

/* ---------- карточка ---------- */

.tgcard {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: inherit !important;
    font: inherit;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tgcard__media {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 9 / 16;
    border-radius: 18px;
    background: #0b0810;
}

/* размытый кадр вместо чёрных полей — как в Telegram */
.tgcard__media::before {
    content: '';
    position: absolute;
    inset: -10%;
    background: var(--poster) center / cover no-repeat;
    filter: blur(26px) brightness(.5);
}

.tgcard__media img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}

.tgcard:hover .tgcard__media img { transform: scale(1.03); }

.tgcard__play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23120a26'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") no-repeat 56% 50% / 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.tgcard:hover .tgcard__play { transform: scale(1.08); }

.tgcard__external {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 7px 10px;
    border: 1px solid rgba(246, 243, 250, .24);
    border-radius: 999px;
    background: rgba(11, 8, 16, .82);
    color: rgba(246, 243, 250, .9);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .02em;
    backdrop-filter: blur(8px);
}

/* карточка без медиа — текстом */
.tgcard__media--text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
    padding: clamp(18px, 2vw, 26px);
    background:
        radial-gradient(110% 100% at 100% 0%, rgba(168, 85, 247, .32) 0%, rgba(168, 85, 247, 0) 62%),
        #17121f;
}

.tgcard__media--text::before { content: none; }

.tgcard__text-label {
    padding: 6px 9px;
    border: 1px solid rgba(246, 243, 250, .18);
    border-radius: 999px;
    color: rgba(246, 243, 250, .68);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.tgcard__text-title {
    max-width: 15ch;
    color: #f8f5fb;
    font-size: clamp(20px, 2.2vw, 30px);
    font-weight: 850;
    line-height: 1.04;
    letter-spacing: -.035em;
}

.tgcard__text-stats {
    color: rgba(246, 243, 250, .6);
    font-size: 12px;
    line-height: 1.4;
}

.tgcard__text-open {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    margin-top: 4px;
    color: #f8f5fb;
    font-size: 13px;
    font-weight: 750;
}

.tgcard__text-open span { transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.tgcard:hover .tgcard__text-open span { transform: translateX(4px); }

.tgcard--grid.tgcard--text {
    grid-column: span 2;
}

.tgcard--grid.tgcard--text .tgcard__media {
    aspect-ratio: 16 / 9;
}

.tgcard__body { display: block; padding: 12px 4px 0; }

.tgcard__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.tgcard__date {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

/* ---------- горизонтальная лента ---------- */

.tgstrip {
    max-width: 1280px;
    margin: 0 auto 48px;
    padding: 0 16px;
}

.tgstrip__head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 18px;
}

.tgstrip__title {
    margin: 0;
    color: var(--text);
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 800;
    letter-spacing: -.02em;
    text-transform: uppercase;
}

.tgstrip__all {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 9px 18px;
    border: 1px solid var(--line);
    border-radius: 100px;
    color: var(--text) !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background-color .2s, border-color .2s;
}

.tgstrip__all:hover { border-color: var(--c); background: rgba(168, 85, 247, .14); }

.tgstrip__scroller {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 200px;
    gap: 16px;
    padding-bottom: 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    /* правый край растворяется — видно, что лента продолжается */
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 40px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 40px), transparent 100%);
}

.tgstrip__scroller::-webkit-scrollbar { display: none; }
.tgstrip__scroller > .tgcard { scroll-snap-align: start; }

/* ---------- страница со всеми постами ---------- */

.tgfeed {
    max-width: 1280px;
    margin: 0 auto 64px;
    padding: 0 16px;
}

.tgfeed__head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.tgfeed__channel {
    color: var(--muted) !important;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none !important;
}

.tgfeed__channel:hover { color: var(--c) !important; }

.tgfeed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px 16px;
}

.tgfeed-empty { color: var(--muted); }

.tgfeed-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 40px;
}

.tgfeed-nav a {
    min-width: 42px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 100px;
    color: var(--text) !important;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none !important;
}

.tgfeed-nav a.is-active { background: var(--c); border-color: transparent; color: #fff !important; }

/* ---------- плеер ---------- */

.tgplayer {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    padding: 24px;
    background: rgba(8, 5, 14, .92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: #f6f3fa;
    font-family: inherit;
}

.tgplayer.is-open { display: grid; place-items: center; }

.tgplayer__stage {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    width: min(100%, 520px);
    max-height: 100%;
}

.tgplayer.is-text-only .tgplayer__stage {
    width: min(100%, 820px);
}

.tgplayer__media {
    width: 100%;
    line-height: 0;
}

.tgplayer__media[hidden] { display: none; }

.tgplayer__video,
.tgplayer__image {
    display: block;
    width: 100%;
    max-height: 74vh;
    object-fit: contain;
    border-radius: 20px;
    background: #000;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9);
}

.tgplayer__video[hidden],
.tgplayer__image[hidden] { display: none; }

/* кнопка перехода в Telegram — заметная, а не мелкая ссылка */
.tgplayer__meta a.tgplayer__tg {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 9px 18px;
    border-radius: 100px;
    background: var(--theme-base-color, #a855f7);
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: filter .2s;
}

.tgplayer__meta a.tgplayer__tg { color: #fff !important; }
.tgplayer__tg:hover { filter: brightness(1.12); }
.tgplayer__tg[hidden] { display: none; }

.tgplayer__info { width: 100%; }

.tgplayer.is-text-only .tgplayer__info {
    max-height: min(82vh, 900px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(24px, 5vw, 56px);
    border: 1px solid rgba(246, 243, 250, .12);
    border-radius: 24px;
    background:
        radial-gradient(80% 55% at 100% 0%, rgba(168, 85, 247, .18), transparent 70%),
        #15101c;
}

.tgplayer__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}

.tgplayer.is-text-only .tgplayer__title {
    max-width: 18ch;
    margin-bottom: 30px;
    font-size: clamp(30px, 5vw, 54px);
    font-weight: 850;
    line-height: .98;
    letter-spacing: -.045em;
}

.tgplayer__text {
    max-height: 22vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0 0 8px;
    color: rgba(246, 243, 250, .8);
    font-size: 15px;
    line-height: 1.55;
}

.tgplayer__text p,
.tgplayer__text h4,
.tgplayer__text ul { margin: 0; }

.tgplayer__text p + p,
.tgplayer__text ul + p { margin-top: 12px; }

.tgplayer__text h4 {
    margin-top: 24px;
    margin-bottom: 10px;
    color: #f8f5fb;
    font-size: 16px;
    font-weight: 780;
    line-height: 1.35;
}

.tgplayer__text h4:first-child { margin-top: 0; }

.tgplayer__text ul {
    display: grid;
    gap: 8px;
    max-width: 68ch;
    padding: 0;
    list-style: none;
}

.tgplayer__text li {
    position: relative;
    padding-left: 18px;
}

.tgplayer__text li::before {
    content: '•' !important;
    position: absolute;
    left: 0;
    top: 0;
    color: var(--theme-base-color, #a855f7);
}

.tgplayer.is-text-only .tgplayer__text {
    max-height: none;
    overflow: visible;
    color: rgba(246, 243, 250, .84);
    font-size: clamp(15px, 1.8vw, 17px);
    line-height: 1.65;
}

.tgplayer__notice {
    display: grid;
    gap: 3px;
    margin: 10px 0 14px;
    padding: 13px 15px;
    border: 1px solid rgba(246, 243, 250, .12);
    border-radius: 14px;
    background: rgba(246, 243, 250, .06);
}

.tgplayer__notice[hidden] { display: none; }
.tgplayer__notice strong { color: #f8f5fb; font-size: 14px; }
.tgplayer__notice span { color: rgba(246, 243, 250, .62); font-size: 13px; line-height: 1.45; }

.tgplayer__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: center;
    color: rgba(246, 243, 250, .55);
    font-size: 14px;
}

.tgplayer__meta a {
    color: var(--theme-base-color, #a855f7) !important;
    font-weight: 600;
    text-decoration: none !important;
}

.tgplayer__btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .2s, transform .2s;
}

.tgplayer__btn:hover { background: rgba(255, 255, 255, .2); transform: scale(1.06); }
.tgplayer__btn[hidden] { display: none; }

.tgplayer__close { top: 20px; right: 20px; }
.tgplayer__prev { left: 20px; top: 50%; margin-top: -24px; }
.tgplayer__next { right: 20px; top: 50%; margin-top: -24px; }

/* ---------- адаптив ---------- */

@media (max-width: 900px) {
    .tgstrip__scroller { grid-auto-columns: 168px; }
}

@media (max-width: 560px) {
    .tgstrip, .tgfeed { padding: 0 12px; }
    .tgstrip__scroller { grid-auto-columns: 146px; gap: 12px; }
    .tgfeed-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 12px; }
    .tgcard__media { border-radius: 14px; }
    .tgcard__title { font-size: 14px; }
    .tgcard__play { width: 46px; height: 46px; margin: -23px 0 0 -23px; background-size: 20px; }
    .tgcard--grid.tgcard--text { grid-column: 1 / -1; }
    .tgcard--grid.tgcard--text .tgcard__media { aspect-ratio: 4 / 3; }
    .tgcard__text-title { font-size: 22px; }

    .tgplayer { padding: 0; }
    .tgplayer__stage { gap: 0; width: 100%; height: 100%; justify-content: center; }
    .tgplayer__video, .tgplayer__image { max-height: 62vh; border-radius: 0; }
    .tgplayer__info {
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
        background: rgba(8, 5, 14, .6);
    }
    .tgplayer.is-text-only .tgplayer__stage { justify-content: flex-start; overflow-y: auto; }
    .tgplayer.is-text-only .tgplayer__info {
        max-height: none;
        min-height: 100%;
        overflow: visible;
        padding: 72px 20px calc(30px + env(safe-area-inset-bottom));
        border: 0;
        border-radius: 0;
    }
    .tgplayer.is-text-only .tgplayer__title { margin-bottom: 24px; font-size: 38px; }
    .tgplayer__prev, .tgplayer__next { display: none; } /* на телефоне листаем свайпом */
    .tgplayer__close { top: 12px; right: 12px; }
}
