/* Questionnaire video player: custom controls and full-frame fill for the face-to-camera videos. */

/* Intro and About you: whole frame (1080x746 inside a square slot), the bars above and below take the colours of each video's own top and bottom edges. */
.video-slot[data-video-slot="intro"] video,
.video-slot[data-video-slot="about"] video { object-fit: contain; object-position: 50% 50%; }
/* Blurred backdrop: the slot's own poster, covering the slot, enlarged, blurred and slightly darkened behind the sharp video. */
.video-slot[data-video-slot="intro"], .video-slot[data-video-slot="about"] { background: #a7a095; isolation: isolate; }
.video-slot[data-video-slot="intro"]::before, .video-slot[data-video-slot="about"]::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: center / cover no-repeat;
    transform: scale(1.15); filter: blur(32px);
}
.video-slot[data-video-slot="intro"]::before { background-image: url("../videos/questionnaire/intro.webp"); }
.video-slot[data-video-slot="about"]::before { background-image: url("../videos/questionnaire/about-you.webp"); }

/* ---- player ---- */
.qv { position: absolute; inset: 0; container-type: size; overflow: hidden; color: #FFFFFF; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.qv:focus { outline: none; }
.qv:focus-visible { outline: 2px solid var(--brown-500); outline-offset: -2px; }
.qv:fullscreen { background: #000000; border-radius: 0; }
.qv:-webkit-full-screen { background: #000000; border-radius: 0; }

.qv button { appearance: none; -webkit-appearance: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; background: transparent; cursor: pointer; display: grid; place-items: center; }
.qv svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.qv :focus-visible { outline: 2px solid var(--brown-500); outline-offset: 2px; }

/* large play button */
/* centred with inset + auto margins, no transform; the button selector is more specific than `.qv button { margin: 0 }` */
.qv button.qv-big {
    position: absolute; inset: 0; margin: auto; width: 92px; height: 92px; transform: none; translate: none; border-radius: 50%; z-index: 2;
    background: rgba(255, 255, 255, 0.55) !important; color: var(--ink-950) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.7); box-sizing: border-box;   /* glass rim */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.qv button.qv-big:hover, .qv button.qv-big:focus-visible { background: rgba(255, 255, 255, 0.7) !important; }
.qv-big svg { width: 40px; height: 40px; fill: currentColor; margin-left: 4px; }
.qv.is-playing .qv-big { visibility: hidden; }

/* control bar */
.qv-bar {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; gap: 8px;
    padding: 36px 8px 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
    cursor: default;
    visibility: hidden;
}
.qv:not(.is-playing) .qv-bar, .qv.is-active .qv-bar, .qv-bar:hover, .qv:has(.qv-bar :focus-visible) .qv-bar { visibility: visible; }
.qv-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; }
.qv-btn:hover { background: rgba(0, 0, 0, 0.5); }
.qv-cur { display: inline-block; }
.qv-time { flex: none; font-size: 15px; line-height: 1; font-weight: 600; color: #FFFFFF; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: left; padding: 0 4px; }

/* progress */
.qv-prog { position: relative; flex: 1 1 0; min-width: 0; height: 46px; cursor: pointer; touch-action: none; outline-offset: -2px; margin: 0 4px; }
.qv-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); }
.qv-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 2px; background: #FFFFFF; }
.qv-handle { position: absolute; top: 50%; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #FFFFFF; display: none; }
.qv-prog:hover .qv-handle, .qv-prog.is-drag .qv-handle, .qv-prog:focus-visible .qv-handle { display: block; }
.qv-prog:focus-visible { outline-offset: 0; }

@container (max-width: 419px) {
    .qv-bar { gap: 2px; padding-left: 4px; padding-right: 4px; }
    .qv-total { display: none; }
    .qv-time { padding: 0 2px; }
    .qv-prog { margin: 0 2px; }
}
@container (max-width: 299px) { .qv-time { display: none; } }
@media (hover: none) { .qv-bar:hover { visibility: hidden; } .qv:not(.is-playing) .qv-bar:hover, .qv.is-active .qv-bar:hover { visibility: visible; } }

/* soften the recording's top and bottom edges into the backdrop: the frame fills the middle 69% of the square; a fade of 4% of its height (2.8% of the square) at each edge, none at the sides */
.video-slot[data-video-slot="intro"] video, .video-slot[data-video-slot="about"] video {
    -webkit-mask-image: linear-gradient(to bottom, transparent var(--bars), #000 calc(var(--bars) + (100% - 2 * var(--bars)) * 0.04), #000 calc(100% - var(--bars) - (100% - 2 * var(--bars)) * 0.04), transparent calc(100% - var(--bars)));
    mask-image: linear-gradient(to bottom, transparent var(--bars), #000 calc(var(--bars) + (100% - 2 * var(--bars)) * 0.04), #000 calc(100% - var(--bars) - (100% - 2 * var(--bars)) * 0.04), transparent calc(100% - var(--bars)));
}

/* full screen: every video shows its whole frame on plain black (no trim, no backdrop) */
.qv:fullscreen, .qv:-webkit-full-screen { background: #000000; }
.qv:fullscreen video, .qv:-webkit-full-screen video { width: 100%; height: 100%; object-fit: contain !important; object-position: 50% 50% !important; clip-path: none !important; -webkit-mask-image: none !important; mask-image: none !important; }

/* before the first play only the big play button shows; after it, the bar behaves as usual and the big button only shows when it does not overlap the bar */
.qv:not(.has-played) .qv-bar { visibility: hidden !important; }
@container (max-width: 419px) { .qv.has-played .qv-big { display: none; } }
@container (min-width: 420px) and (max-height: 271px) { .qv.has-played .qv-big { display: none; } }

/* poster state (before the first play, and after a section reset): the frame is softly blurred under a beige tint so it reads as a thumbnail behind frosted glass; the duration shows bottom right. Both vanish on the first play. */
.qv video { position: absolute; z-index: 0; }
.qv:not(.has-played) video { filter: blur(8px); transform: scale(1.06); }
.qv:not(.has-played)::before { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(246, 242, 238, 0.3); pointer-events: none; }
.qv-dur { display: none; position: absolute; right: 12px; bottom: 12px; z-index: 2; padding: 2px 8px; border-radius: 6px; background: rgba(20, 20, 22, 0.65); color: #FFFFFF; font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; pointer-events: none; }
.qv:not(.has-played) .qv-dur:not(:empty) { display: block; }
.qv:fullscreen video, .qv:-webkit-full-screen video { filter: none; transform: none; }
