/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Video Layout
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

[data-media-player] .vds-video-layout:not([data-match]) {
  display: none !important;
}

[data-media-player][data-layout='video'] {
  background-color: var(--video-bg, black);
}

[data-media-player][data-layout='video']:not([data-fullscreen]) {
  border-radius: var(--video-border-radius, 6px);
  border: var(--video-border, 1px solid rgb(255 255 255 / 0.1));
}

:where(.vds-video-layout) {
  --media-brand: var(--video-brand, #f5f5f5);
  --media-font-family: var(--video-font-family, sans-serif);
  --media-controls-color: var(--video-controls-color, #f5f5f5);
  --media-tooltip-y-offset: 6px;
  --media-menu-y-offset: 6px;
  --media-focus-ring-color: var(--video-focus-ring-color, rgb(78 156 246));
  --media-focus-ring: var(--video-focus-ring, 0 0 0 3px var(--media-focus-ring-color));
  color: var(--video-controls-color, #f5f5f5);
  display: contents;
}

:where([data-media-player][data-focus]:not([data-playing]) .vds-video-layout .vds-controls) {
  border-radius: var(--video-border-radius, 6px);
  box-shadow: var(--media-focus-ring);
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Controls
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout .vds-controls[data-visible]) {
  border-radius: var(--video-border-radius, 6px);
  background-image: linear-gradient(
    to top,
    rgb(0 0 0 / 0.6),
    10%,
    transparent,
    95%,
    rgb(0 0 0 / 0.3)
  );
}

.vds-video-layout .vds-controls-group {
  align-items: center;
  display: flex;
  pointer-events: auto;
  z-index: 0;
  padding: 4px 6px;
}

.vds-video-layout .vds-controls-group:first-child {
  z-index: 50;
}

/* second last group */
.vds-video-layout .vds-controls-group:nth-last-child(2) {
  padding: 0 12px;
  z-index: 11;
  margin-bottom: -16px;
}

.vds-video-layout:not([data-sm]) .vds-controls-group:last-child {
  --media-menu-y-offset: 26px;
  --media-tooltip-y-offset: 26px;
  --media-slider-preview-offset: 26px;
  z-index: 10;
}

:where(.vds-video-layout .vds-button) {
  margin-right: 2.5px;
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Title
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout[data-sm] .vds-chapter-title) {
  font-size: var(--video-sm-chapter-title-font-size, 15px);
}

:where([data-fullscreen] .vds-video-layout .vds-chapter-title) {
  font-size: var(--video-fullscreen-chapter-title-font-size, 16px);
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Buttons
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout:not([data-sm]) .vds-mute-button) {
  margin-left: -2.5px;
  margin-right: -5px;
}

:where(.vds-video-layout[data-sm]) {
  --media-button-size: var(--video-sm-button-size, 36px);
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Sliders
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout .vds-time-slider) {
  --media-slider-height: 45px;
  flex-grow: 0;
}

:where(.vds-video-layout .vds-slider-thumbnail) {
  --media-thumbnail-border: var(--video-slider-thumbnail-border, 1px solid #f5f5f5);
  border-radius: var(--video-slider-thumbnail-border-radius, 2px);
}

.vds-video-layout .vds-time-slider .vds-slider-value {
  background-color: var(--video-time-bg, unset);
  text-shadow:
    -1px -1px 0 #333333,
    1px -1px 0 #333333,
    -1px 1px 0 #333333,
    1px 1px 0 #333333;
}

:where(.vds-video-layout[data-sm] .vds-time) {
  text-shadow: unset;
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Large Layout Volume Slider
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout[data-lg] .vds-volume) {
  --gap: var(--video-volume-gap, 10px);
  display: contents;
}

:where(.vds-video-layout[data-lg] .vds-volume-popup) {
  display: contents;
}

:where(.vds-video-layout[data-lg] .vds-volume-slider) {
  margin: 0;
  max-width: 0;
  transition: all 0.15s ease;
}

:where(.vds-video-layout[data-lg] .vds-volume[data-active] .vds-volume-slider),
:where(.vds-video-layout[data-lg] .vds-volume:has([data-active]) .vds-volume-slider) {
  margin-left: var(--gap);
  opacity: 1;
  visibility: visible;
  max-width: var(--video-volume-slider-max-width, 72px);
}

/* safe area. */
.vds-video-layout[data-lg] .vds-volume-slider::after {
  content: '';
  position: fixed;
  top: 0;
  left: calc(-1 * var(--gap));
  width: var(--gap);
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Small Layout Volume Slider
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout[data-sm] .vds-volume) {
  --media-slider-height: var(--video-volume-height, 96px);
  --media-slider-preview-offset: calc(-200% - 6px);
  --gap: var(--video-volume-gap, 10px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

:where(.vds-video-layout[data-sm] .vds-volume-popup) {
  display: block;
  position: absolute;
  top: calc(100% + var(--gap));
  left: 50%;
  opacity: 0;
  transform: translateX(-50%);
  transition:
    opacity 150ms ease-out,
    visibility 150ms ease-out;
  border-radius: var(--video-volume-border-radius, 8px);
  filter: var(--media-volume-filter, drop-shadow(0 1px 1px rgb(0 0 0 / 0.05)));
  visibility: hidden;
}

/* safe area. */
.vds-video-layout[data-sm] .vds-mute-button::after {
  content: '';
  position: fixed;
  bottom: calc(-1 * var(--gap));
  right: 0;
  width: 100%;
  height: var(--gap);
  z-index: 1;
  pointer-events: auto;
}

.vds-video-layout .vds-volume-popup {
  background-color: var(--video-volume-bg, var(--media-menu-bg, var(--default-bg)));
  border: var(--video-volume-border, var(--default-border));
}

.light .vds-video-layout .vds-volume-popup,
.vds-video-layout.light .vds-volume-popup {
  --default-bg: rgb(250 250 250);
  --default-border: 1px solid rgb(10 10 10 / 0.1);
}

.dark .vds-video-layout .vds-volume-popup,
.vds-video-layout.dark .vds-volume-popup {
  --default-bg: rgb(10 10 10);
  --default-border: 1px solid rgb(255 255 255 / 0.1);
}

:where(.vds-video-layout[data-sm] .vds-volume[data-active] .vds-volume-popup),
:where(.vds-video-layout[data-sm] .vds-volume:has([data-active]) .vds-volume-popup) {
  transition:
    opacity 150ms ease-in,
    visibility 150ms ease-in;
  opacity: 1;
  visibility: visible;
}

:where(.vds-video-layout[data-sm] .vds-volume[data-active] .vds-tooltip-content) {
  display: none !important;
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Time
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout .vds-time[data-type='current']) {
  margin-right: 2px;
}

:where(.vds-video-layout .vds-time[data-type='current'][remainder]) {
  margin-left: 2px;
}

.vds-video-layout .vds-time {
  --default-color: #f5f5f5 !important;
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Captions
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where([data-preview] .vds-video-layout .vds-captions) {
  opacity: 0;
}

:where(.vds-video-layout .vds-captions) {
  z-index: 10;
  transition: var(--video-captions-transition, bottom 0.3s ease-in-out);
}

@media (min-width: 980px) {
  :where([data-fullscreen] .vds-video-layout .vds-captions) {
    bottom: var(--video-lg-fullscreen-captions-offset, 54px);
  }
}

:where([data-media-player][data-controls] .vds-video-layout .vds-captions) {
  bottom: var(--video-captions-offset, 78px);
}

:where([data-media-player][data-controls] .vds-video-layout[data-sm] .vds-captions) {
  bottom: var(--video-sm-captions-offset, 48px);
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Chapters
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout .vds-time-slider .vds-slider-chapter-title) {
  width: 100%;
  text-align: center;
  text-shadow:
    -1px -1px 0 #212121,
    1px -1px 0 #212121,
    -1px 1px 0 #212121,
    1px 1px 0 #212121;
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Gestures
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout .vds-gesture) {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

:where(.vds-video-layout .vds-gesture[action='seek:-10']) {
  width: var(--video-gesture-seek-width, 20%);
  z-index: 1;
}

:where(.vds-video-layout .vds-gesture[action='seek:10']) {
  left: unset;
  right: 0;
  width: var(--video-gesture-seek-width, 20%);
  z-index: 1;
}

@media (pointer: coarse) {
  :where(.vds-video-layout .vds-gesture[action='toggle:paused']) {
    display: none;
  }
}

@media not (pointer: coarse) {
  :where([data-media-player] .vds-video-layout .vds-gesture[action='toggle:controls']) {
    display: none;
  }
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Live Button
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout .vds-live-button) {
  margin-left: 12px;
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Time Group
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout:not([data-sm]) .vds-time-group) {
  margin-left: 10px;
}

:where(.vds-video-layout[data-sm] .vds-time) {
  font-size: var(--video-sm-time-font-size, 14px);
}

:where([data-fullscreen] .vds-video-layout .vds-time) {
  font-size: var(--video-fullscreen-time-font-size, 16px);
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Load Container
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout .vds-load-container) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 99;
}

:where(
    [data-media-player][data-load='play']:not([data-started])
      .vds-video-layout[data-match]
      .vds-load-container
  ) {
  display: flex;
}

:where(.vds-video-layout .vds-load-container .vds-play-button) {
  --size: var(--video-load-button-size, 56px);
  --color: var(--video-load-button-color, rgb(0 0 0 / 0.8));
  --bg-color: var(--video-load-button-bg, var(--media-brand));

  --media-button-hover-transform: 0;
  --media-button-border: var(--video-load-button-border, var(--color));
  --media-button-hover-bg: var(--video-load-button-bg, var(--media-brand));

  width: var(--size);
  height: var(--size);
  pointer-events: auto;
  margin-bottom: 2px;
  overflow: hidden;
}

.vds-video-layout .vds-load-container .vds-play-button {
  border-radius: var(--video-load-button-border-radius, 100%);
  color: var(--color);
}

.vds-video-layout .vds-load-container .vds-play-button {
  background-color: var(--bg-color);
}

:where(.vds-video-layout[data-sm] .vds-load-container .vds-play-button) {
  --size: var(--video-sm-load-button-size, 48px);
  --media-button-hover-transform: translateY(0%);
  width: var(--size);
  height: var(--size);
  transform: translateY(0%);
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Small Layout
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where(.vds-video-layout[data-sm] .vds-controls-group:nth-last-child(2)) {
  pointer-events: none;
}

:where(.vds-video-layout[data-sm] .vds-controls-group:last-child) {
  z-index: 2;
  margin-top: -2.5px;
  margin-bottom: -6px;
}

:where([data-fullscreen] .vds-video-layout[data-sm] .vds-controls-group:last-child) {
  margin-bottom: 0;
}

.vds-video-layout[data-sm] .vds-controls-group {
  padding: 2px;
}

:where(.vds-video-layout[data-sm])
  :where(
    .vds-button,
    .vds-slider:not(.vds-time-slider),
    .vds-time,
    .vds-time-divider,
    .vds-chapter-title
  ) {
  transition: opacity 0.15s ease;
}

:where([data-media-player]:not([data-started]) .vds-video-layout[data-sm])
  :where(.vds-button .vds-slider, .vds-time-group) {
  opacity: 0;
  visibility: hidden;
}

:where(.vds-video-layout[data-sm] .vds-time-slider) {
  transition: transform 0.1s linear;
}

@media (pointer: coarse) {
  :where([data-preview] .vds-video-layout:not([data-no-scrub-gesture]))
    :where(
      .vds-button,
      .vds-slider:not(.vds-time-slider),
      .vds-time,
      .vds-chapter-title,
      .vds-time-divider,
      .vds-captions,
      .vds-live-button
    ) {
    opacity: 0;
  }

  :where([data-preview] .vds-video-layout:not([data-no-scrub-gesture]) .vds-time-slider) {
    --track-height: var(--video-sm-slider-focus-track-height, 12px);
    transform: translateY(-6px);
    transition: transform 0.1s linear;
  }
}

:where(.vds-video-layout[data-sm] .vds-controls .vds-play-button) {
  --size: var(--video-sm-play-button-size, 45px);
  --media-button-hover-transform: translateY(25%);
  width: var(--size);
  height: var(--size);
  transform: translateY(25%);
  border-radius: 100%;
  pointer-events: auto;
  margin-bottom: 2px;
  overflow: hidden;
}

.vds-video-layout[data-sm] .vds-controls .vds-play-button {
  background-color: var(--video-sm-play-button-bg, rgba(0 0 0 / 0.6));
}

:where(
    [data-media-player]:not([data-started])
      .vds-video-layout[data-sm]
      .vds-controls-group:not(:nth-child(3))
  ) {
  opacity: 0;
  visibility: hidden;
}

/* center big play button inside buffering indicator. */
:where(.vds-video-layout[data-sm] .vds-buffering-indicator) {
  --media-buffering-size: 64px;
  transform: translate(-2px, -4px);
}

:where(.vds-video-layout .vds-start-duration .vds-time) {
  position: absolute;
  right: 8px;
  bottom: 8px;
  margin-right: 8px;
  margin-bottom: 8px;
  z-index: 10;
}

.vds-video-layout .vds-start-duration .vds-time {
  padding: var(--video-sm-start-duration-padding, 3px 6px);
  color: var(--video-sm-start-duration-color, var(--video-controls-color));
  background-color: var(--video-sm-start-duration-bg, rgba(0 0 0 / 0.64));
}

:where([data-started] .vds-video-layout .vds-start-duration .vds-time) {
  display: none;
}

:where([data-media-player]:not([data-can-play]) .vds-video-layout .vds-start-duration .vds-time) {
  opacity: 0;
}

:where(.vds-video-layout[data-sm] .vds-time[data-type='current']) {
  margin-left: 8px;
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Fullscreen
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

:where([data-fullscreen] .vds-video-layout .vds-controls-group:nth-last-child(2)) {
  margin-bottom: -16px;
}

@media (orientation: portrait) {
  :where([data-fullscreen] .vds-video-layout .vds-captions) {
    bottom: 30lvh;
    bottom: 10dvh;
  }
}

@media (orientation: landscape) {
  :where([data-fullscreen] .vds-video-layout .vds-controls-group:nth-last-child(2)) {
    margin-bottom: -12px;
  }
}
