/*
 * About page intro video (Vimeo), driven by about-video.js.
 * The buttons look and behave like the graduates' carousel (graduate-videos.css).
 * Selectors start with .about-video so the theme's button hover colours don't win.
 */
.about-video {
    width: 80%;
    margin: 0 auto 48px;
}

/* Keeps the 16:9 space on the page, also while the video is enlarged. */
.about-video__box {
    position: relative;
    height: 0;
    padding-top: 56.25%;
}

.about-video .about-video__frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 15px;
    background: #0d131a;
    box-shadow: 0 14px 36px rgba(0, 46, 77, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    /* Cover layout: logo height, space under it, play button size. */
    --av-logo: min(44%, 260px);
    --av-gap: 28px;
    --av-play: 72px;
    -webkit-tap-highlight-color: transparent;
    /* Own compositing layer: keeps the rounded corners on the video in iOS Safari. */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Taps go to our buttons and the frame, never into the Vimeo player. */
.about-video .about-video__frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    pointer-events: none;
}

/* ---------- Cover: Scope logo on white until the video is first played ----------
 * The logo and the play button under it form one group centred in the frame:
 * logo (--av-logo high), a --av-gap space, then the round play button (--av-play).
 */
.about-video .about-video__frame:not(.is-started) {
    background: #fff;
}

.about-video .about-video__cover {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: radial-gradient(120% 100% at 50% 30%, #fff 50%, #eef4f8 100%);
    box-shadow: inset 0 0 0 1px rgba(0, 75, 117, 0.08);
    border-radius: inherit;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0s linear 0s;
}

.about-video .about-video__cover img {
    position: absolute;
    top: calc(50% - (var(--av-gap) + var(--av-play)) / 2);
    left: 50%;
    width: auto;
    height: var(--av-logo);
    max-width: 80%;
    object-fit: contain;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

.about-video .about-video__frame.is-started .about-video__cover {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

/* Round play button in the brand blue, right under the logo. */
.about-video .about-video__frame:not(.is-started) .about-video__play {
    top: calc(50% + (var(--av-logo) + var(--av-gap)) / 2);
    width: var(--av-play);
    height: var(--av-play);
    border-radius: 50%;
    background: #004B75;
    box-shadow: 0 0 0 8px rgba(0, 75, 117, 0.1), 0 12px 28px rgba(0, 75, 117, 0.35);
}

.about-video .about-video__frame:not(.is-started) .about-video__play:hover,
.about-video .about-video__frame:not(.is-started) .about-video__play:focus-visible {
    background: #107E7D;
    box-shadow: 0 0 0 10px rgba(16, 126, 125, 0.14), 0 12px 28px rgba(16, 126, 125, 0.35);
}

.about-video .about-video__frame:not(.is-started) .about-video__play svg {
    width: 40%;
    height: 40%;
    margin-left: 4%; /* the triangle looks centred when nudged right */
}

/* Corner buttons on the white cover: light, in the brand blue. */
.about-video .about-video__frame:not(.is-started) .about-video__sound,
.about-video .about-video__frame:not(.is-started) .about-video__expand {
    background: rgba(0, 75, 117, 0.08);
    border-color: rgba(0, 75, 117, 0.2);
    color: #004B75;
    box-shadow: none;
}

.about-video .about-video__frame:not(.is-started) .about-video__sound:hover,
.about-video .about-video__frame:not(.is-started) .about-video__sound:focus,
.about-video .about-video__frame:not(.is-started) .about-video__sound:active,
.about-video .about-video__frame:not(.is-started) .about-video__expand:hover,
.about-video .about-video__frame:not(.is-started) .about-video__expand:focus,
.about-video .about-video__frame:not(.is-started) .about-video__expand:active {
    background: rgba(0, 75, 117, 0.16);
    border-color: rgba(0, 75, 117, 0.35);
    color: #004B75;
}

.about-video .about-video__frame:not(.is-started) .about-video__sound:focus-visible,
.about-video .about-video__frame:not(.is-started) .about-video__expand:focus-visible,
.about-video .about-video__frame:not(.is-started) .about-video__play:focus-visible {
    outline-color: #004B75;
}

/* ---------- Corner buttons: sound (left) and enlarge / close (right) ---------- */
.about-video .about-video__sound,
.about-video .about-video__expand {
    position: absolute;
    top: 14px;
    z-index: 4;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(11, 19, 32, 0.82);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    cursor: pointer;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.about-video .about-video__sound {
    left: 14px;
}

.about-video .about-video__expand {
    right: 14px;
}

.about-video .about-video__sound:hover,
.about-video .about-video__expand:hover {
    background: rgba(11, 19, 32, 0.96);
    border-color: rgba(255, 255, 255, 0.65);
    transform: scale(1.08);
}

.about-video .about-video__sound:active,
.about-video .about-video__expand:active {
    transform: scale(0.95);
}

.about-video .about-video__sound.is-unmuted {
    background: #0d6e6e;
    border-color: #2dd4bf;
    box-shadow: 0 0 16px rgba(45, 212, 191, 0.6);
}

.about-video .about-video__sound.is-unmuted:hover {
    background: #0f766e;
}

.about-video .about-video__sound svg,
.about-video .about-video__expand svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.about-video .about-video__icon-unmuted,
.about-video .about-video__sound.is-unmuted .about-video__icon-muted,
.about-video .about-video__icon-close,
.about-video.is-expanded .about-video__icon-enlarge {
    display: none;
}

.about-video .about-video__sound.is-unmuted .about-video__icon-unmuted,
.about-video.is-expanded .about-video__icon-close {
    display: block;
}

/* ---------- Play / pause (centre) ---------- */
.about-video .about-video__play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    width: 64px;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.86);
    color: #fff;
    cursor: pointer;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* From the round cover button (under the logo) to the centre once playing. */
    transition: top 0.35s ease, width 0.35s ease, height 0.35s ease, border-radius 0.35s ease,
        background-color 0.2s ease, box-shadow 0.2s ease;
}

.about-video .about-video__play:hover,
.about-video .about-video__play:focus-visible {
    background: rgba(0, 0, 0, 0.96);
}

.about-video .about-video__play svg {
    width: 25px;
    height: 25px;
    fill: currentColor;
    pointer-events: none;
}

.about-video .about-video__icon-play,
.about-video .about-video__frame.is-paused .about-video__icon-pause {
    display: none;
}

.about-video .about-video__frame.is-paused .about-video__icon-play {
    display: block;
}

/* The theme colours every button on hover / focus; keep the icons white. */
.about-video .about-video__sound:hover,
.about-video .about-video__sound:focus,
.about-video .about-video__sound:active,
.about-video .about-video__expand:hover,
.about-video .about-video__expand:focus,
.about-video .about-video__expand:active,
.about-video .about-video__play:hover,
.about-video .about-video__play:focus,
.about-video .about-video__play:active {
    color: #fff;
}

.about-video .about-video__sound:focus-visible,
.about-video .about-video__expand:focus-visible,
.about-video .about-video__play:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ---------- Enlarged: the same player (it keeps playing) shown big over the page ---------- */
.about-video__backdrop {
    display: none;
}

.about-video.is-expanded .about-video__backdrop {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100000;
    background: rgba(2, 18, 30, 0.9);
    cursor: pointer;
}

.about-video.is-expanded .about-video__frame {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 100001;
    /* As wide as possible while the whole 16:9 video still fits on the screen. */
    width: min(1280px, calc(100vw - 32px), calc((100vh - 32px) * 16 / 9));
    width: min(1280px, calc(100vw - 32px), calc((100dvh - 32px) * 16 / 9));
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    -webkit-transform: translate3d(-50%, -50%, 0);
    transform: translate3d(-50%, -50%, 0);
}

html.about-video-open,
html.about-video-open body {
    overflow: hidden;
}

/* ---------- Phones ---------- */
@media (max-width: 575.98px) {
    .about-video {
        width: auto;
        margin: 0 12px 40px;
    }

    .about-video .about-video__frame {
        border-radius: 12px;
        --av-logo: 40%;
        --av-gap: 12px;
        --av-play: 54px;
    }

    .about-video .about-video__frame:not(.is-started) .about-video__play {
        box-shadow: 0 0 0 6px rgba(0, 75, 117, 0.1), 0 8px 18px rgba(0, 75, 117, 0.3);
    }

    .about-video .about-video__sound,
    .about-video .about-video__expand {
        top: 10px;
        width: 32px;
        height: 32px;
    }

    .about-video .about-video__sound {
        left: 10px;
    }

    .about-video .about-video__expand {
        right: 10px;
    }

    .about-video.is-expanded .about-video__frame {
        border-radius: 0;
    }
}

/*
 * Enlarged on a phone held upright: a 16:9 video can't get wider than the screen, so it is
 * turned sideways to fill it (like a phone's own full-screen player); the visitor turns the phone.
 * If the browser itself rotates to landscape, the rule above applies instead.
 */
@media (max-width: 575.98px) and (orientation: portrait) {
    .about-video.is-expanded .about-video__frame {
        width: min(100vh, calc(100vw * 16 / 9));
        width: min(100dvh, calc(100vw * 16 / 9));
        -webkit-transform: translate3d(-50%, -50%, 0) rotate(90deg);
        transform: translate3d(-50%, -50%, 0) rotate(90deg);
    }
}

/* Enlarged on a phone held sideways: use the whole screen height. */
@media (max-height: 575.98px) and (orientation: landscape) {
    .about-video.is-expanded .about-video__frame {
        width: min(100vw, calc(100vh * 16 / 9));
        width: min(100vw, calc(100dvh * 16 / 9));
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .about-video .about-video__sound,
    .about-video .about-video__expand,
    .about-video .about-video__play,
    .about-video .about-video__cover,
    .about-video .about-video__frame.is-started .about-video__cover {
        transition: none;
    }
}
