/* Theater mode for the feature videos. Behavior lives in pg4assets/js/pg.theater.js. */

/* Launchers on the page */

.pg-theater-launch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.pg-theater-launch svg {
    margin: -2px 0; /* keep the button as tall as the text-only ones */
}

@media (max-width: 479px) {
    .pg-theater-launch {
        line-height: 18px;
        text-align: left;
        white-space: normal;
    }
}

.pg-theater-launch svg,
.pg-theater-watch svg {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linejoin: round;
}

.pg-theater-launch svg .fill,
.pg-theater-watch svg .fill {
    fill: currentColor;
    stroke: none;
}

.pg-theater-watch {
    position: absolute;
    top: 100%;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    color: var(--pg-blue-dark);
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.3s, transform 0.3s, visibility 0s 0.3s;
}

.pg-theater-watch:hover,
.pg-theater-watch:focus {
    color: var(--pg-blue);
    text-decoration: underline;
    outline: none;
}

.feature-block .gif-wrap {
    transition: margin-bottom 0.3s ease;
}

/* Space under the video for the link, once a clip of the section has been played */
.feature-block.pg-theater-played .gif-wrap {
    margin-bottom: 80px;
}

@media (max-width: 991px) {
    /* The video is not scaled up here, so it needs less room */
    .feature-block.pg-theater-played .gif-wrap {
        margin-bottom: 60px;
    }
}

.feature-block.pg-theater-played .pg-theater-watch {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.3s 0.15s, transform 0.3s 0.15s;
}

/* Overlay */

.pg-theater-is-open,
.pg-theater-is-open body {
    overflow: hidden;
}

.pg-theater {
    --pg-theater-muted: rgba(255, 255, 255, 0.62);
    --pg-theater-line: rgba(255, 255, 255, 0.14);
    --pg-theater-hover: rgba(255, 255, 255, 0.1);
    --pg-theater-accent: #38b6e6;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
    background: #070c0f;
    color: var(--pg-white);
    font-family: var(--font-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
    overscroll-behavior: contain;
    touch-action: manipulation;
}

.pg-theater[hidden] {
    display: none;
}

.pg-theater.is-visible {
    opacity: 1;
}

.pg-theater-col {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

.pg-theater svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pg-theater svg .fill {
    fill: currentColor;
    stroke: none;
}

.pg-theater button {
    font-family: inherit;
}

/* No focus rings. Keyboard focus shows as the hover background instead. */
.pg-theater:focus,
.pg-theater :focus {
    outline: none;
}

/* Top bar: section, clip picker and actions */

.pg-theater-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.pg-theater-heading {
    flex: 1;
    min-width: 0;
}

.pg-theater-group {
    display: flex;
    gap: 0.5em;
    margin-bottom: 2px;
    color: var(--pg-theater-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

.pg-theater-group-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-theater-group-count {
    flex: none;
}

.pg-theater-picker {
    position: relative;
}

.pg-theater-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% + 8px);
    margin-left: -8px;
    padding: 2px 6px 2px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 26px;
    font-weight: 300;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.15s;
}

.pg-theater-title:hover,
.pg-theater-title:focus-visible,
.pg-theater-title[aria-expanded="true"] {
    background: var(--pg-theater-hover);
}

.pg-theater-title-text {
    min-width: 0;
    text-align: left;
}

.pg-theater-title svg {
    flex: none;
    color: var(--pg-theater-muted);
    transition: transform 0.2s;
}

.pg-theater-title[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.pg-theater-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: -8px;
    z-index: 3;
    width: 380px;
    max-width: calc(100vw - 24px);
    max-height: min(62vh, 560px);
    padding: 6px 0;
    overflow-y: auto;
    background: #141c21;
    border: 1px solid var(--pg-theater-line);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.pg-theater-menu-group + .pg-theater-menu-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--pg-theater-line);
}

.pg-theater-menu-label {
    padding: 8px 16px 4px;
    color: var(--pg-theater-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.pg-theater-option {
    position: relative;
    padding: 7px 16px 7px 36px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 15px;
    line-height: 1.35;
    cursor: pointer;
}

.pg-theater-option:hover,
.pg-theater-option:focus {
    background: var(--pg-theater-hover);
    color: var(--pg-white);
}

.pg-theater-option:focus-visible {
    box-shadow: inset 3px 0 0 var(--pg-theater-accent);
}

.pg-theater-option[aria-selected="true"] {
    color: var(--pg-theater-accent);
    font-weight: 600;
}

.pg-theater-option[aria-selected="true"]::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 17px;
    margin-top: -5px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid currentColor;
}

.pg-theater-actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: 4px;
}

.pg-theater-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.pg-theater-icon:hover,
.pg-theater-icon:focus-visible {
    background: var(--pg-theater-hover);
}

.pg-theater-icon:disabled {
    background: transparent;
    opacity: 0.3;
    cursor: default;
}

.pg-theater-icon[hidden] {
    display: none;
}

.pg-theater-autoplay {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: var(--pg-theater-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pg-theater-autoplay:hover,
.pg-theater-autoplay:focus-visible {
    background: var(--pg-theater-hover);
    color: var(--pg-white);
}

.pg-theater-switch {
    position: relative;
    width: 30px;
    height: 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.25);
    transition: background 0.2s;
}

.pg-theater-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--pg-white);
    transition: transform 0.2s;
}

.pg-theater-autoplay[aria-checked="true"] .pg-theater-switch {
    background: var(--pg-blue);
}

.pg-theater-autoplay[aria-checked="true"] .pg-theater-switch::after {
    transform: translateX(14px);
}

/* Video */

.pg-theater-screen {
    position: relative;
    container-type: inline-size;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 6px;
    background: #000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.pg-theater-screen video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.15s;
}

.pg-theater-screen.is-switching video {
    opacity: 0;
}

.pg-theater-big {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    margin: -42px 0 0 -42px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

.pg-theater-big svg {
    width: 40px;
    height: 40px;
}

.pg-theater-screen.is-paused .pg-theater-big {
    opacity: 1;
    transform: none;
}

.pg-theater-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--pg-white);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    animation: pg-theater-spin 0.8s linear infinite;
    pointer-events: none;
}

.pg-theater-screen.is-loading .pg-theater-spinner {
    opacity: 1;
    transition-delay: 0.3s;
}

.pg-theater-screen.is-loading .pg-theater-big {
    opacity: 0;
}

@keyframes pg-theater-spin {
    to {
        transform: rotate(360deg);
    }
}

.pg-theater-preroll {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6% 10%;
    background: #2a8bbd url("../movies/movie.loading.jpg") center / cover no-repeat;
    color: var(--pg-white);
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0s 0.3s;
}

.pg-theater-screen.is-preroll .pg-theater-preroll {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s;
}

.pg-theater-screen.is-preroll .pg-theater-big,
.pg-theater-screen.is-preroll .pg-theater-spinner {
    opacity: 0;
}

.pg-theater-preroll-group {
    margin-bottom: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.pg-theater-preroll-count {
    white-space: nowrap;
}

.pg-theater-preroll-title {
    margin-bottom: 14px;
    font-size: clamp(22px, 4.2cqw, 46px);
    font-weight: 300;
    line-height: 1.2;
}

.pg-theater-preroll-desc {
    max-width: 760px;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(15px, 1.9cqw, 21px);
    line-height: 1.5;
}

.pg-theater-preroll-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.55);
    transform: scaleX(0);
    transform-origin: left;
}

.pg-theater-screen.is-preroll .pg-theater-preroll-bar {
    animation: pg-theater-countdown 3s linear forwards;
}

/* On a small player the description does not fit; it is shown above the video anyway */
@container (max-width: 520px) {
    .pg-theater-preroll-desc {
        display: none;
    }

    .pg-theater-preroll-group {
        margin-bottom: 8px;
        font-size: 11px;
        letter-spacing: 2px;
    }

    .pg-theater-preroll-title {
        margin-bottom: 0;
    }
}

@keyframes pg-theater-countdown {
    to {
        transform: scaleX(1);
    }
}

/* Controls under the video */

.pg-theater-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.pg-theater-progress {
    position: relative;
    flex: 1;
    height: 24px;
    margin-left: 6px;
    cursor: pointer;
    touch-action: none;
}

.pg-theater-progress::before,
.pg-theater-progress-fill {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 4px;
    margin-top: -2px;
    border-radius: 2px;
    transition: height 0.15s, margin 0.15s;
}

.pg-theater-progress::before {
    background: rgba(255, 255, 255, 0.18);
}

.pg-theater-progress-fill {
    background: var(--pg-blue);
    transform: scaleX(0);
    transform-origin: left;
}

.pg-theater-progress:hover::before,
.pg-theater-progress:hover .pg-theater-progress-fill,
.pg-theater-progress:focus-visible::before,
.pg-theater-progress:focus-visible .pg-theater-progress-fill,
.pg-theater-progress.is-seeking::before,
.pg-theater-progress.is-seeking .pg-theater-progress-fill {
    height: 6px;
    margin-top: -3px;
}

.pg-theater-next {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    max-width: 300px;
    height: 40px;
    padding: 0 10px 0 16px;
    border: 1px solid var(--pg-theater-line);
    border-radius: 20px;
    background: transparent;
    color: var(--pg-white);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.pg-theater-next:hover,
.pg-theater-next:focus-visible {
    background: var(--pg-theater-hover);
}

.pg-theater-next:disabled {
    background: transparent;
    opacity: 0.35;
    cursor: default;
}

.pg-theater-next-label {
    flex: none;
    color: var(--pg-theater-muted);
    font-weight: 600;
}

.pg-theater-next-title {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pg-theater-next svg {
    flex: none;
}

.pg-theater-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 4px 0 14px;
}

.pg-theater-desc {
    flex: 1;
    min-width: 0;
    max-width: 860px;
    margin: 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 16px;
    line-height: 1.5;
}

.pg-theater-nav {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

@media (max-width: 767px) {
    .pg-theater {
        padding: 12px;
    }

    .pg-theater-bar {
        gap: 8px;
    }

    .pg-theater-group {
        font-size: 11px;
        letter-spacing: 1.5px;
    }

    .pg-theater-title {
        font-size: 20px;
    }

    .pg-theater-autoplay {
        padding: 0 8px;
    }

    .pg-theater-autoplay-label,
    .pg-theater-next-label,
    .pg-theater-next-title {
        display: none;
    }

    .pg-theater-next {
        justify-content: center;
        width: 40px;
        padding: 0;
        border: 0;
        border-radius: 50%;
    }

    .pg-theater-info {
        gap: 8px;
        margin-bottom: 10px;
    }

    .pg-theater-desc {
        font-size: 15px;
    }

    .pg-theater-nav {
        gap: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pg-theater,
    .pg-theater *,
    .pg-theater-launch,
    .pg-theater-watch,
    .feature-block .gif-wrap {
        transition: none !important;
    }
}
