/* Блок видео с выбором площадки (шаг 3 ревизии галерей).
   Разметку даёт шаблон catalog/video.tmpl, поведение — /js/video_sources.js.
   Без JS виден серверный запасной вариант (.tt-video__fallback); модуль ставит
   блоку класс is-ready и показывает обложку с кнопкой запуска. */
.tt-video {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 18px 0;
    padding-top: 56.25%;
    overflow: hidden;
    background: #000;
    border-radius: 4px;
}
.tt-video__frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}
.tt-video__fallback { display: block; }
.tt-video__ext {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 7px 14px;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
}
.tt-video__ext:hover { background: #bc0000; color: #fff; }

.tt-video__cover {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: #111;
    cursor: pointer;
    z-index: 3;
}
.tt-video__cover-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.92;
}
.tt-video__play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 72px;
    margin: -36px 0 0 -36px;
    border-radius: 50%;
    background: rgba(188, 0, 0, 0.92);
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}
.tt-video__play:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -13px 0 0 -8px;
    border-style: solid;
    border-width: 13px 0 13px 22px;
    border-color: transparent transparent transparent #fff;
}
.tt-video__cover:hover .tt-video__play { background: #e00000; }

/* Модуль подключается — обложка вместо серверного плеера. */
.tt-video.is-ready .tt-video__cover { display: block; }
.tt-video.is-ready .tt-video__fallback { display: none; }

/* Панель источников (строит attachSourceBar с префиксом tt-video). */
.tt-video__sources {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 4;
    display: flex;
    gap: 6px;
}
.tt-video__source {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.62);
    cursor: pointer;
}
.tt-video__source svg { width: 20px; height: 20px; display: block; }
.tt-video__source.is-active { background: #bc0000; cursor: default; }
.tt-video__source:hover { background: rgba(0, 0, 0, 0.82); }

/* 22.11.2026 (Вик: «на паузе иконки в кашу»): в блоке видео из описания наша панель
   площадок лежала поверх нижней панели самого плеера (время, звук, кнопки Дзена/YouTube/
   TikTok). Пока ролик играет, кадр короче на 46 px, а панель стоит в этой чёрной полосе
   под ним. Оверлей галереи и лайтбокс не трогаем — у них своя геометрия. */
.tt-video.is-playing:not(.tt-video--overlay) .tt-video__frame {
    height: calc(100% - 46px);
}
.tt-video.is-playing:not(.tt-video--overlay) .tt-video__sources {
    bottom: 6px;
}

@media (max-width: 750px) {
    .tt-video { margin: 14px 0; }
    .tt-video__play { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
    .tt-video__play:before { margin: -10px 0 0 -6px; border-width: 10px 0 10px 17px; }
}

/* Оверлей видео поверх большого фото легаси-галереи (.au-rama-big).
   Модуль создаёт его по клику на видео-миниатюру (класс js-tt-video-btn) и убирает
   при клике по другой миниатюре или стрелке галереи. */
.tt-video--overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding-top: 0;
    /* выше иконки зума легаси-галереи (.au-rama-big__zoom, z-index: 11):
       иначе на мобиле крестик видео оказывается под ней и не нажимается */
    z-index: 12;
    background: #000;
}
.tt-video--overlay .tt-video__frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.tt-video--overlay .tt-video__sources {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
}

/* Значок площадки в миниатюре галереи, когда обложки нет (VK-клип, свой mp4). */
.tt-video-thumb_badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #1d1d1d;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* Кнопка закрытия оверлея в галерее (клик по другой миниатюре тоже закрывает). */
.tt-video__close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.tt-video__close:hover { background: rgba(0, 0, 0, 0.85); }


/* 28.10.2026, письмо Клода 23:28: миниатюра видео в ленте галереи — обложка YouTube 480x360
   с чёрными полосами. object-fit: cover срезает полосы; статусные фото это правило не трогает. */
.au-rama-thumbs__img_video {
    height: 88px;
    object-fit: cover;
}

/* короткий вариант ленты (карточка в списке): высота контейнера 50 px (slider.css:466) */
.au-rama-thumbs__item_short .au-rama-thumbs__img_video {
    height: 50px;
}

/* Кадр 4:3 (sddefault/hqdefault) приходит с чёрными полосами внутри пикселей. Модуль помечает
   такую картинку классом tt-video-cover--crop43 (ревью №22): растягиваем её на 16:9 и сдвигаем
   вверх — видимая часть = сам кадр без полос. Контейнер ленты уже overflow: hidden. */
/* В ленте высота контейнера фиксирована (slider.css: 88 px и 50 px для item_short), поэтому
   высоту картинки задаём в px: процент от .au-rama-thumbs__link (height: auto) дал бы 0.
   Абсолютная картинка выпадает из потока, и ссылка-таблица схлопывается в 0 — задаём высоту
   самой ссылке видео-миниатюры, иначе полоса галереи на стенде проседала (проверено 29.10). */
.au-rama-thumbs__link_other {
    height: 88px;
}
.au-rama-thumbs__item_short .au-rama-thumbs__link_other {
    height: 50px;
}

.au-rama-thumbs__img_video.tt-video-cover--crop43 {
    position: absolute;
    top: -14.67px;
    left: 0;
    width: 100% !important;
    height: 117.34px !important;
    object-fit: cover;
}
.au-rama-thumbs__item_short .au-rama-thumbs__img_video.tt-video-cover--crop43 {
    top: -8.33px;
    height: 66.67px !important;
}
/* В блоке [video=…] контейнер тянется по ширине, процент работает. */
.tt-video__cover-img.tt-video-cover--crop43 {
    position: absolute;
    top: -16.67%;
    left: 0;
    width: 100% !important;
    height: 133.34% !important;
    object-fit: cover;
}

/* Модуль прячет сломанную обложку атрибутом hidden; в ленте на её месте значок площадки. */
.tt-video__cover-img[hidden],
.au-rama-thumbs__img[hidden] {
    display: none !important;
}

/* Внешний ролик: встраивание запрещено, плеера нет — обложка-ссылка «Видео доступно на YouTube» */
.tt-video__cover_ext {
    display: block;
    position: relative;
    text-decoration: none;
}
.tt-video__ext-note {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 5;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 13px;
    line-height: 1.3;
}

/* Кнопка «Смотреть на YouTube» в блоке невстраиваемого ролика (пункт 1а): заметное действие,
   а не только подпись. Обложка остаётся ссылкой целиком. */
.tt-video__ext-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    display: inline-block;
    padding: 10px 18px;
    border-radius: 4px;
    background: #cc0000;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tt-video__cover_ext:hover .tt-video__ext-btn,
.tt-video__cover_ext:focus .tt-video__ext-btn {
    background: #a30000;
}

/* --- Вариант B (30.10.2026): лайтбокс для плеера галереи на широком экране.
   Ставится классом .tt-video--lightbox из www/js/video_sources.js при ширине >= 1000 px.
   !important нужен потому, что размеры оверлея в галерее задаются inline-стилями. */
.tt-video--overlay.tt-video--lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box;
    padding: 2vh 2vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .88);
    z-index: 9990 !important;
}
.tt-video--overlay.tt-video--lightbox .tt-video__frame {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    /* ширина ограничена и по высоте: на широком невысоком окне (1400×700) прежняя
       формула давала 1280×644 и ломала 16:9 — поэтому третье слагаемое 92vh·16/9 */
    width: min(1280px, 94vw, calc(92vh * 16 / 9)) !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    max-height: 92vh;
    border: 0;
}
/* Вертикальные ролики: шортс YouTube и клипы VK (решение владельца 30.10.2026).
   В 16:9-кадре у них по бокам остаются широкие чёрные полосы, поэтому кадр
   становится 9:16 — сначала внутри блока, а в лайтбоксе по высоте окна. */
.tt-video--overlay.tt-video--portrait .tt-video__frame {
    aspect-ratio: 9 / 16;
    max-height: 80vh;
}
.tt-video--overlay.tt-video--lightbox.tt-video--portrait .tt-video__frame {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: min(94vw, calc(92vh * 9 / 16)) !important;
    height: auto !important;
    aspect-ratio: 9 / 16;
    max-height: 92vh;
    border: 0;
}
/* Вертикальный ролик в описании: кадр 9:16, ширина ограничена высотой окна
   (80vh), по центру колонки. Так и на телефоне, и на десктопе он не растягивается
   на 900 px в высоту. */
.tt-video.tt-video--portrait:not(.tt-video--overlay) {
    /* padding-top в процентах считается от ШИРИНЫ РОДИТЕЛЯ, а не от ширины блока,
       поэтому при ограничении ширины он давал гигантскую высоту (ревью 30.10.2026, блокер 1):
       настоящую пропорцию задаём aspect-ratio, а старый механизм выключаем. */
    width: min(100%, calc(80vh * 9 / 16));
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-top: 0;
    aspect-ratio: 9 / 16;
}
.tt-video--overlay.tt-video--lightbox.tt-video--portrait .tt-video__close {
    top: 12px;
    right: 12px;
    z-index: 3;
}
.tt-video--overlay.tt-video--lightbox .tt-video__close {
    top: 12px;
    right: 12px;
    z-index: 3;
}
