/* Video: a content video with a poster frame and clear controls, and a muted background
 * loop that can always be paused. js/video.js drives both.
 *
 * Content video
 *   Poster   the poster frame and a 72px play button. The button says the length, and
 *            whether there is sound, to a screen reader ("Play the video, 0:32, no sound").
 *   Hover and focus   the play button grows 8% (200ms); focus adds the violet ring (3px, 4px out).
 *   Playing  a dark glass bar: play/pause, volume, time, a scrubber with the violet-to-plum
 *            fill, captions, full screen. It fades after two seconds without movement.
 *   Volume   the speaker button mutes and unmutes and keeps the level. Hover slides the level
 *            out to its right (88px, 160ms). Tab reaches it; up and down move it in steps of
 *            10 and the value shows above the handle. Phone: the mute button only.
 *   Keys     Space or K plays and pauses, M mutes, up and down set the volume, left and right
 *            skip 5 seconds.
 * Background loop
 *   Muted, no controls but one: pause, always visible, 44px. The choice holds for the visit.
 *   Reduced motion: the loop never starts; the poster frame stands still and the pause
 *   button is not shown. */

/* --player-ratio: footage that is not 16 / 9 sets its own frame, so none of it is cropped away. */
.player { position: relative; overflow: hidden; border-radius: var(--kit-radius-card); background: var(--kit-bg-deep); aspect-ratio: var(--player-ratio, 16 / 9); color: #FFFFFF; }
/* A film with a phone cut has its own frame under 768px (--player-ratio-phone); any other player keeps its one. */
@media (max-width: 767px) { .player { aspect-ratio: var(--player-ratio-phone, var(--player-ratio, 16 / 9)); } }
.player__poster, .player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player__shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(23,18,46,0) 50%, rgba(23,18,46,0.72) 100%); pointer-events: none; }
.player__error { position: absolute; left: 12px; right: 12px; top: 12px; margin: 0; padding: 12px; border-radius: var(--kit-radius-control); background: var(--kit-bg-deep); color: var(--kit-text-on-dark); font-size: var(--kit-type-ui-size); line-height: var(--kit-type-ui-line); text-align: center; }
.player.is-started .player__play, .player.is-started .player__shade { display: none; }
/* The tutorials player re-shows the poster frame and big button on pause, not only before the first play. */
.player--pausable.is-started:not(.is-playing) .player__shade { display: block; }
.player--pausable.is-started:not(.is-playing) .player__play { display: flex; }
.player__play {
  position: absolute; left: 50%; top: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; border: 0; border-radius: var(--kit-radius-full);
  display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.94); color: var(--kit-bg-deep);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5); transition: transform var(--kit-dur-short) var(--kit-ease);
}
.player__play svg { margin-left: 3px; }
.player__play:hover, .player__play.is-hover { transform: scale(1.08); }
.player__play:focus-visible, .player__play.is-focus { outline: 3px solid var(--kit-focus-on-dark); outline-offset: 4px; }

/* Captions cross the frame's centre on phones. Keep the paused Play above two caption lines;
 * following the CC setting keeps its position steady between cues and while scrubbing. */
@media (max-width: 767px) {
  .player.is-captioned.is-started:not(.is-playing) .player__play { top: calc(50% - 54px); width: 48px; height: 48px; margin: -24px 0 0 -24px; box-shadow: 0 8px 20px -6px rgba(0,0,0,0.5); }
  .player.is-captioned.is-started:not(.is-playing) .player__play svg { width: 20px; height: 20px; margin-left: 2px; }
}

/* The stand-in frame: where the real video is still to come. */
.player--standin { background: var(--kit-bg-deep-panel); }
.player--standin::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0 14px, rgba(255,255,255,0) 14px 28px); }
.player__wanted { position: absolute; left: 16px; right: 16px; top: 42%; text-align: center; color: var(--kit-text-on-dark-subtle); font-size: var(--kit-type-ui-size); line-height: var(--kit-type-ui-line); }

/* Our own caption box: native cue rendering sits at the very bottom of the video, under the
 * bar below, so the active cue is drawn here instead (the track stays in 'hidden' mode).
 * Above the bar while it shows; drops closer to the bottom once it fades. No clamp and no
 * overflow:hidden here: every cue is re-segmented to fit two lines of 42 characters before
 * it ever reaches this box (see the caption files themselves), so the box shows the cue's
 * real text in full; white-space:pre-line honours the two physical lines the VTT cue
 * carries instead of letting the browser re-wrap by pixel width. z-index 3 keeps the box above
 * the controls bar's shade (Frame edge, below), which reaches 100px up and would dim it. */
.player__captions {
  position: absolute; left: 12px; right: 12px; bottom: 60px; z-index: 3; margin: 0 auto; width: fit-content; max-width: calc(100% - 24px);
  padding: 4px 10px; border-radius: var(--kit-radius-control); background: rgba(23,18,46,0.8); pointer-events: none;
  color: var(--kit-text-on-dark); font-size: var(--kit-type-ui-size); line-height: var(--kit-type-ui-line); text-align: center; white-space: pre-line;
}
.player__captions:empty { display: none; }
/* On a film with a phone cut the captions start on, so the poster would carry a cue over the play button; they wait for the film to start. */
.player[data-phone-cut]:not(.is-started) .player__captions { display: none; }
.player.is-idle .player__captions { bottom: 16px; }

/* The controls bar */
.vbar {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2; height: 44px; padding: 0 4px; border-radius: var(--kit-radius-row);
  display: flex; align-items: center; gap: 4px; background: rgba(23,18,46,0.8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity var(--kit-dur-short) var(--kit-ease);
}
.player.is-idle .vbar { opacity: 0; pointer-events: none; }
.vbtn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border: 0; border-radius: var(--kit-radius-full);
  background: transparent; color: #FFFFFF;
}
.vbtn:hover { background: rgba(255,255,255,0.14); }
.vbtn:disabled { opacity: 0.4; cursor: default; }
.vbtn:disabled:hover { background: transparent; }
.vbtn:focus-visible { outline: 2px solid var(--kit-focus-on-dark); outline-offset: 1px; }
.vbtn[aria-pressed="true"].vbtn--cc { background: rgba(255,255,255,0.18); }
.vbtn .cc { font-family: var(--kit-font-mono); font-size: 11px; line-height: 14px; font-weight: var(--kit-weight-medium); padding: 2px 5px; border-radius: var(--kit-radius-sm); box-shadow: inset 0 0 0 1.5px currentColor; }
.vbtn .i-play, .player.is-playing .vbtn--play .i-pause { display: block; }
.vbtn .i-pause, .player.is-playing .vbtn--play .i-play { display: none; }
.vbtn .i-vol-off, .player.is-muted .vbtn--mute .i-vol-on { display: none; }
.player.is-muted .vbtn--mute .i-vol-off { display: block; }
.vtime { font-family: var(--kit-font-mono); font-size: 11px; line-height: 14px; white-space: nowrap; margin-left: 4px; }
.vscrub { position: relative; flex-grow: 1; height: 20px; margin: 0 8px; cursor: pointer; }
.vscrub::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.24); }
.vscrub__fill { position: absolute; left: 0; top: 8px; height: 4px; width: var(--p, 0%); border-radius: 2px; background: var(--kit-gradient-scrub); }
.vscrub__handle { position: absolute; left: var(--p, 0%); top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: var(--kit-radius-full); background: var(--kit-bg-surface); box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.vscrub:focus-visible { outline: 2px solid var(--kit-focus-on-dark); outline-offset: 4px; border-radius: var(--kit-radius-sm); }
/* Keep touch drags on the sliders from becoming a page scroll. */
.vscrub, .vvol__level { touch-action: none; }
.vvol { display: flex; align-items: center; }
.vvol__level { display: none; position: relative; width: 0; height: 20px; overflow: visible; transition: width 160ms var(--kit-ease), margin 160ms var(--kit-ease); }
.vvol__level::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.24); }
.vvol__fill { position: absolute; left: 0; top: 8px; height: 4px; width: var(--v, 70%); border-radius: 2px; background: var(--kit-bg-surface); }
.vvol__handle { position: absolute; left: var(--v, 70%); top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: var(--kit-radius-full); background: var(--kit-bg-surface); opacity: 0; }
.vvol__value { position: absolute; left: var(--v, 70%); bottom: 18px; transform: translateX(-50%); padding: 3px 7px; border-radius: var(--kit-radius-chip); background: var(--kit-bg-surface); color: var(--kit-bg-deep); font-size: 12px; line-height: var(--kit-type-label-line); font-weight: var(--kit-weight-semibold); white-space: nowrap; opacity: 0; pointer-events: none; }
.vvol__level:focus-visible { outline: none; }
.vvol__level:focus-visible .vvol__handle, .vvol__level.is-focus .vvol__handle { outline: 2px solid var(--kit-focus-on-dark); outline-offset: 2px; }
.vvol__level:focus-visible .vvol__value, .vvol__level.is-focus .vvol__value { opacity: 1; }
.vfull { display: none; }
@media (min-width: 768px) {
  .vbar { left: 12px; right: 12px; bottom: 12px; height: 52px; padding: 0 8px; border-radius: 14px; gap: 6px; }
  .player__captions { bottom: 76px; font-size: var(--kit-type-small-size); line-height: var(--kit-type-small-line); }
  .player.is-idle .player__captions { bottom: 20px; }
  .vtime { font-size: 12px; line-height: var(--kit-type-label-line); }
  .vvol__level { display: block; }
  .vvol:hover .vvol__level, .vvol:focus-within .vvol__level, .vvol.is-open .vvol__level { width: 88px; margin: 0 10px 0 2px; }
  .vvol:hover .vvol__handle, .vvol:focus-within .vvol__handle, .vvol.is-open .vvol__handle { opacity: 1; }
  .vfull { display: inline-flex; }
}

/* Background loop */
.bg-video { position: relative; overflow: hidden; }
.bg-video > img, .bg-video > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@keyframes kit-drift { 0% { transform: scale(1.02) translate(0, 0); } 100% { transform: scale(1.08) translate(-1.5%, -1%); } }
/* The poster drifts to stand in for playback until the real loop is in. */
.bg-video > img.is-drifting { animation: kit-drift 18s ease-in-out infinite alternate; transform-origin: 60% 40%; }
.bg-video.is-paused > img.is-drifting { animation-play-state: paused; }
.bg-pause {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--kit-radius-full);
  background: rgba(255,255,255,0.92); color: var(--kit-bg-deep);
}
.bg-pause:hover { background: var(--kit-bg-surface); }
.media.bg-video .bg-pause { position: absolute; z-index: 1; right: 16px; bottom: 16px; }
/* A loop with no ground of its own (the Deployment hero's devices): the 4:3 video is transparent
   outside its devices and their shadows, so the page shows through and no media panel is drawn.
   Each device's label is page text in the label style, so it keeps its size at every width; it is
   placed by percentage of the 1440 x 1080 video box, centred under its device, in a band the video
   keeps fully transparent in every frame. The pause control takes the box's empty corner. */
.devices { aspect-ratio: 4 / 3; }
.devices__label { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.devices__label--laptop { left: 28.5417%; top: 47.5926%; }  /* x 411, y 514 */
.devices__label--tablet { left: 76.6667%; top: 47.5926%; }  /* x 1104, y 514 */
.devices__label--headset { left: 50%; top: 91.2963%; }      /* x 720, y 986 */
.devices .bg-pause { position: absolute; z-index: 1; right: 0; bottom: 0; }
.bg-pause .i-play, .is-paused .bg-pause .i-pause { display: none; }
.is-paused .bg-pause .i-play { display: block; }

@media (prefers-reduced-motion: reduce) {
  .bg-video > img.is-drifting { animation: none; }
  .bg-pause { display: none; }
  .player__play, .vbar, .vvol__level { transition: none; }
  .player__play:hover { transform: none; }
}
.player:not(.is-started) .vbar { display: none; }
.vnote { padding: 0 6px; font-size: 13px; line-height: 18px; color: var(--kit-text-on-dark-muted); white-space: nowrap; }

/* Frame edge. A video clipped by a rounded corner can show a stair-stepped corner or a pale fringe,
 * and screen recordings often carry their own light outer pixel and app chrome along the bottom.
 * Four layers keep the frame clean in every engine:
 *   1. the dark ground behind the video, so any gap reads as frame, not page;
 *   2. clip-path as well as overflow, which every engine anti-aliases, plus the mask Safari needs
 *      to clip a playing video layer;
 *   3. a 1.2% scale that trims the recording's outer pixel;
 *   4. a 1px dark hairline drawn over the edge, and a shade under the controls bar so whatever the
 *      recording shows at its foot never peeks around the bar. The shade fades with the bar. */
.player { isolation: isolate; clip-path: inset(0 round var(--kit-radius-card)); -webkit-mask-image: -webkit-radial-gradient(white, black); }
.player video { transform: scale(1.012); }
.player::after { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(16,17,22,0.14); pointer-events: none; }
/* A pale recording on a white page has no edge of its own: the hairline above draws one. Where the
 * player sits on the page, playlist.css adds a soft lift on its wrapper, because clip-path would cut
 * a shadow on the player itself. */
.vbar::before { content: ""; position: absolute; left: -12px; right: -12px; bottom: -12px; height: 112px; z-index: -1; background: linear-gradient(180deg, rgba(12,13,17,0) 0%, rgba(12,13,17,0.72) 100%); pointer-events: none; }
