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

:where(.vds-button) {
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  appearance: none;
  background: none;
  outline: none;
  border: none;
  border-radius: var(--media-button-border-radius, 8px);
  width: var(--media-button-size, 40px);
  height: var(--media-button-size, 40px);
  transition: transform 0.2s ease-out;
  contain: layout style;
  cursor: pointer;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
}

.vds-button {
  border: var(--media-button-border);
  color: var(--media-button-color, var(--media-controls-color, #f5f5f5));
  padding: var(--media-button-padding, 0px);
}

:where([data-fullscreen] .vds-button) {
  width: var(--media-fullscreen-button-size, 42px);
  height: var(--media-fullscreen-button-size, 42px);
}

@media screen and (max-width: 599px) {
  :where([data-fullscreen] .vds-button) {
    width: var(--media-sm-fullscreen-button-size, 42px);
    height: var(--media-sm-fullscreen-button-size, 42px);
  }
}

:where(.vds-button .vds-icon) {
  width: var(--media-button-icon-size, 80%);
  height: var(--media-button-icon-size, 80%);
  border-radius: var(--media-button-border-radius, 8px);
}

:where(.vds-menu-button .vds-icon) {
  display: flex !important;
}

:where(.vds-button[aria-hidden='true']) {
  display: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .vds-button:hover {
    background-color: var(--media-button-hover-bg, rgb(255 255 255 / 0.2));
  }

  .vds-button:hover {
    transform: var(--media-button-hover-transform, scale(1.05));
    transition: var(--media-button-hover-transition, transform 0.2s ease-in);
  }

  .vds-button[aria-expanded='true'] {
    transform: unset;
  }
}

@media (pointer: coarse) {
  .vds-button:hover {
    border-radius: var(--media-button-touch-hover-border-radius, 100%);
    background-color: var(--media-button-touch-hover-bg, rgb(255 255 255 / 0.2));
  }
}

:where(.vds-button:focus) {
  outline: none;
}

:where(.vds-button[data-focus], .vds-button:focus-visible) {
  box-shadow: var(--media-focus-ring);
}

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

:where(.vds-live-button) {
  min-width: auto;
  min-height: auto;
  width: var(--media-live-button-width, 40px);
  height: var(--media-live-button-height, 40px);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  appearance: none;
  background: none;
  outline: none;
  border: none;
}

:where(.vds-live-button-text) {
  font-family: var(--media-font-family, sans-serif);
  font-size: var(--media-live-button-font-size, 12px);
  font-weight: var(--media-live-button-font-weight, 600);
  letter-spacing: var(--media-live-button-letter-spacing, 1.5px);
  transition: color 0.3s ease;
}

.vds-live-button-text {
  background-color: var(--media-live-button-bg, #8a8a8a);
  border-radius: var(--media-live-button-border-radius, 2px);
  color: var(--media-live-button-color, #161616);
  padding: var(--media-live-button-padding, 1px 4px);
}

:where(.vds-live-button[data-focus] .vds-live-button-text) {
  box-shadow: var(--media-focus-ring);
}

:where(.vds-live-button[data-edge]) {
  cursor: unset;
}

.vds-live-button[data-edge] .vds-live-button-text {
  background-color: var(--media-live-button-edge-bg, #dc2626);
  color: var(--media-live-button-edge-color, #f5f5f5);
}

@media (pointer: fine) {
  :where(.vds-live-button:hover) {
    background-color: unset;
  }
}

/*
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * States
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

/* Play Button */
.vds-button:not([data-paused]) .vds-play-icon,
.vds-button[data-ended] .vds-play-icon,
.vds-button[data-paused] .vds-pause-icon,
.vds-button[data-ended] .vds-pause-icon,
.vds-button:not([data-ended]) .vds-replay-icon,
/* PIP Button */
.vds-button[data-active] .vds-pip-enter-icon,
.vds-button:not([data-active]) .vds-pip-exit-icon,
/* Fullscreen Button */
.vds-button[data-active] .vds-fs-enter-icon,
.vds-button:not([data-active]) .vds-fs-exit-icon,
/* Caption Button */
.vds-button:not([data-active]) .vds-cc-on-icon,
.vds-button[data-active] .vds-cc-off-icon,
/* Mute Button */
.vds-button:not([data-muted]) .vds-mute-icon,
.vds-button:not([data-state='low']) .vds-volume-low-icon,
.vds-button:not([data-state='high']) .vds-volume-high-icon {
  display: none;
}
