/* ============================================================
 * Explainer video player (front-end/onlysecurity-explainer-video.php)
 * and the Trainer Knowledge Hub's phone rules, UX batch H.
 * ============================================================ */

/* Poster: a button carrying the poster image, a play mark and the time. */
.os-xv {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #161b26;
    cursor: pointer;
    line-height: 0;
}
.os-xv--square { aspect-ratio: 1 / 1; }
.os-xv--wide { aspect-ratio: 16 / 9; }
.os-xv__poster {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease;
}
.os-xv:hover .os-xv__poster { transform: scale(1.02); }
.os-xv:focus-visible { outline: 3px solid #2f62af; outline-offset: 3px; }
.os-xv__play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
    transition: transform .2s ease;
}
.os-xv__play::after {
    content: "";
    position: absolute;
    left: 22px;
    top: 17px;
    border: 11px solid transparent;
    border-left: 17px solid #161b26;
    border-right: 0;
}
.os-xv:hover .os-xv__play { transform: scale(1.08); }
.os-xv__dur {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font: 600 12px/1.4 Inter, system-ui, sans-serif;
}
@media (prefers-reduced-motion: reduce) {
    .os-xv__poster, .os-xv__play { transition: none; }
    .os-xv:hover .os-xv__poster, .os-xv:hover .os-xv__play { transform: none; }
}

/* Lightbox */
html.os-xv-open { overflow: hidden; }
.os-xv-dialog {
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #000;
    overflow: visible;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
}
.os-xv-dialog::backdrop { background: rgba(10, 14, 22, .86); }
/* Sized to fit the viewport on whichever side runs out first. */
.os-xv-dialog__video {
    display: block;
    width: min(calc(100vw - 32px), calc((100vh - 32px) * 9 / 16));
    width: min(calc(100vw - 32px), calc((100dvh - 32px) * 9 / 16));
    height: auto;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    background: #000;
}
.os-xv-dialog--wide .os-xv-dialog__video {
    width: min(calc(100vw - 32px), calc((100vh - 32px) * 16 / 9), 1280px);
    width: min(calc(100vw - 32px), calc((100dvh - 32px) * 16 / 9), 1280px);
    aspect-ratio: 16 / 9;
}
.os-xv-dialog__close {
    position: absolute;
    z-index: 1;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font: 400 28px/44px system-ui, sans-serif;
    text-align: center;
    cursor: pointer;
}
.os-xv-dialog__error {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 50%;
    margin: 0;
    color: #fff;
    font: 500 16px/1.4 Inter, system-ui, sans-serif;
    text-align: center;
}
.os-xv-dialog__close:hover { background: rgba(0, 0, 0, .8); }
.os-xv-dialog__close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* ------------------------------------------------------------
 * Trainer Knowledge Hub (body.os-hub-page, page 10870)
 * ------------------------------------------------------------ */

/* Start here: the two guides under the hero. */
.os-hub-start { max-width: 1200px; margin: 32px auto; padding: 0 16px; }
.os-hub-start > h2 { text-align: center; margin: 0 0 6px; }
.os-hub-start > p { text-align: center; margin: 0 0 18px; }
.os-hub-start .wp-block-columns { gap: 18px; margin-bottom: 0; }
.os-hub-start h3 { margin: 10px 0 4px; font-size: 17px; }
.os-hub-start h3 + p { margin: 0; font-size: 14px; }

/* Feature cards: the player sits where the screenshot was. */
.os-hub-card .os-xv { margin-bottom: 16px; }

/* Phones: four cards, then "Show all". */
.os-hub-more { display: none; }
@media (max-width: 767.98px) {
    .os-hub-features.is-collapsed .os-hub-card--extra,
    .os-hub-features.is-collapsed .os-hub-row--extra { display: none !important; }
    .os-hub-features.is-collapsed .os-hub-more {
        display: block;
        width: 100%;
        min-height: 44px;
        margin: 8px 0 16px;
        padding: 12px 22px;
        border: 1px solid #2f62af;
        border-radius: 8px;
        background: #fff;
        color: #2f62af;
        font-weight: 600;
        cursor: pointer;
    }
}

/* Rewards launcher: icon only on phones, as on profile pages (G6). The
 * label is hidden visually, not removed, so it keeps its accessible name. */
@media (max-width: 575.98px) {
    body.os-hub-page { padding-bottom: 96px; }
    body.os-hub-page #mycred-loyalty-widget-root > div > div:first-child p {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        clip: rect(0 0 0 0) !important;
        white-space: nowrap !important;
    }
}

/* Feature pages: the short above the text. */
.os-xv-feature { max-width: 420px; margin: 24px 0 32px; }

/* ------------------------------------------------------------
 * UX batch M: hero loop and the courses list row
 * ------------------------------------------------------------ */

/* Hero loop: the silent cut sits over the poster and shows only once it
 * is actually playing, so the poster holds the space and nothing shifts. */
.os-xv__loop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}
.os-xv.is-looping .os-xv__loop { opacity: 1; }
.os-xv.is-looping .os-xv__play { opacity: 0; }
/* The label promises sound over a moving picture, so it shows only while the
 * loop is actually playing (not for Save-Data, or a refused autoplay such as
 * iOS Low Power Mode, where the poster and play mark stay). */
.os-xv__sound { opacity: 0; transition: opacity .3s ease; }
.os-xv.is-looping .os-xv__sound { opacity: 1; }
.os-xv__sound {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 7px 12px 7px 32px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font: 600 13px/1.3 Inter, system-ui, sans-serif;
}
/* A speaker drawn in CSS: a small box and a cone. */
.os-xv__sound::before,
.os-xv__sound::after {
    content: "";
    position: absolute;
    top: 50%;
}
.os-xv__sound::before {
    left: 13px;
    width: 4px;
    height: 7px;
    margin-top: -3.5px;
    background: #fff;
}
.os-xv__sound::after {
    left: 15px;
    margin-top: -7px;
    border: 7px solid transparent;
    border-right: 7px solid #fff;
    border-left: 0;
}
@media (prefers-reduced-motion: reduce) {
    .os-xv__loop { display: none; }
    .os-xv--loop .os-xv__sound { display: none; }
}

/* Courses list row: a small poster beside two lines of text. */
.os-xv-row { margin: 0 0 16px; }
.os-xv-row[hidden] { display: none; }
.os-xv.os-xv--row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: auto;
    max-width: 100%;
    padding: 0;
    border-radius: 10px;
    background: transparent;
    line-height: 1.4;
    text-align: left;
    overflow: visible;
}
.os-xv--row .os-xv__thumb {
    position: relative;
    flex: none;
    width: 96px;
    height: 96px;
    border-radius: 10px;
    overflow: hidden;
    background: #161b26;
}
.os-xv--row .os-xv__play {
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
}
.os-xv--row .os-xv__play::after {
    left: 13px;
    top: 10px;
    border-width: 7px;
    border-left-width: 11px;
}
.os-xv--row .os-xv__text {
    font: 600 14px/1.4 Inter, system-ui, sans-serif;
    color: #1d2433;
}
.os-xv--row .os-xv__text strong { display: block; font-weight: 600; }
.os-xv--row .os-xv__text span { display: block; font-weight: 500; color: #5b6475; }
.os-xv--row:hover .os-xv__text strong { text-decoration: underline; text-underline-offset: 3px; }
