/**
 * Плавающий виджет видеоэкскурсии по производству «Форма охраны».
 * Плитка в левом нижнем углу + модальный плеер.
 * Геометрия 9:16 — совпадает с форматом ролика (720x1280).
 */

.fo-vw {
    position: fixed;
    left: 15px;
    bottom: 15px;
    width: 140px;
    height: 249px;
    z-index: 99990; /* ниже куки-баннера (99999), чтобы тот оставался кликабельным */
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #1d2016;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
    border: 0;
    padding: 0;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .35s ease, transform .35s ease, bottom .3s ease;
    -webkit-tap-highlight-color: transparent;
}

.fo-vw--visible {
    opacity: 1;
    transform: translateY(0);
}

.fo-vw__frames {
    position: absolute;
    inset: 0;
}

.fo-vw__frame {
    position: absolute;
    inset: 0;
    display: block;
    opacity: 0;
    transition: opacity .4s ease;
}

.fo-vw__frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fo-vw__frame--on {
    opacity: 1;
}

/* затемнение снизу, чтобы подпись читалась на любом кадре */
.fo-vw__shade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46%;
    background: linear-gradient(to top, rgba(0, 0, 0, .8) 0%, rgba(0, 0, 0, .4) 50%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
}

.fo-vw__play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
    pointer-events: none;
    transition: transform .2s ease;
}

.fo-vw__play::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 52%;
    margin: -9px 0 0 -6px;
    border-style: solid;
    border-width: 9px 0 9px 14px;
    border-color: transparent transparent transparent #707c48;
}

.fo-vw:hover .fo-vw__play {
    transform: scale(1.08);
}

.fo-vw__caption {
    position: absolute;
    left: 9px;
    right: 9px;
    bottom: 9px;
    color: #fff;
    font: 600 12px/1.25 "Fira Sans", Arial, sans-serif;
    text-align: left;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .65);
    pointer-events: none;
}

.fo-vw__caption b {
    display: block;
    font-weight: 600;
}

.fo-vw__caption span {
    display: block;
    font-weight: 400;
    font-size: 11px;
    opacity: .88;
    margin-top: 2px;
}

.fo-vw__cap-sm {
    display: none;
}

.fo-vw__close {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font: 400 17px/26px Arial, sans-serif;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    transition: background .2s ease;
}

.fo-vw__close:hover {
    background: rgba(0, 0, 0, .72);
}

/* ---------- модальный плеер ---------- */

.fo-vwm {
    position: fixed;
    inset: 0;
    z-index: 1000001; /* выше куки-баннера и лайтбокса обратного звонка */
    display: flex;
    align-items: center;
    justify-content: center;
    /* не глухая заливка: сайт за попапом должен читаться */
    background: rgba(0, 0, 0, .66);
    opacity: 0;
    transition: opacity .25s ease;
}

.fo-vwm--visible {
    opacity: 1;
}

.fo-vwm__box {
    position: relative;
    height: 85vh;
    max-height: 85vh;
    aspect-ratio: 9 / 16;
    max-width: 94vw;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, .55);
}

/* запасной расчёт для браузеров без aspect-ratio */
@supports not (aspect-ratio: 9 / 16) {
    .fo-vwm__box {
        width: 47.8vh;
    }
}

.fo-vwm__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.fo-vwm__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font: 400 24px/38px Arial, sans-serif;
    cursor: pointer;
    z-index: 2;
}

.fo-vwm__close:hover {
    background: rgba(0, 0, 0, .8);
}

/* ---------- мобильные ---------- */

@media (max-width: 767px) {
    .fo-vw {
        left: 10px;
        bottom: 10px;
        width: 92px;
        height: 164px;
        border-radius: 10px;
    }

    .fo-vw__play {
        width: 34px;
        height: 34px;
        margin: -17px 0 0 -17px;
    }

    .fo-vw__play::after {
        margin: -7px 0 0 -5px;
        border-width: 7px 0 7px 11px;
    }

    .fo-vw__caption {
        left: 6px;
        right: 6px;
        bottom: 6px;
        font-size: 10px;
    }

    .fo-vw__caption span {
        font-size: 9px;
    }

    .fo-vw__cap-lg {
        display: none;
    }

    .fo-vw__cap-sm {
        display: block;
    }

    .fo-vw__close {
        width: 24px;
        height: 24px;
        font-size: 16px;
        line-height: 24px;
    }

    /* на телефоне — тоже окно, а не фулскрин: по краям должен быть виден
       затемнённый сайт, иначе попап читается как уход со страницы */
    .fo-vwm__box {
        height: 76vh;
        max-height: 76vh;
        max-width: 86vw;
        border-radius: 12px;
    }

    @supports not (aspect-ratio: 9 / 16) {
        .fo-vwm__box {
            width: 42.7vh;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .fo-vw,
    .fo-vw__frame,
    .fo-vw__play,
    .fo-vwm {
        transition: none;
    }
}
