/*
 * Slider: an optional label above a block-tall control holding a 4px track and icon-sized thumbs. Thumbs are kept
 * within the track (`thumbAlignment='contain'`, with the thumb size measured by the component), so the track spans the
 * full width and lines up with the label.
 */

@layer dx-components {
  .dx-slider {
    --dx-slider-thumb: var(--dx-icon-size);
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .dx-slider[data-disabled] {
    opacity: 0.5;
  }
  .dx-slider[data-orientation='vertical'] {
    height: 100%;
    width: max-content;
  }

  .dx-slider-label {
    font-size: var(--dx-font-size);
    line-height: var(--dx-line-height);
    color: var(--color-fg-subtle);
  }

  .dx-slider-control {
    display: flex;
    align-items: center;
    height: var(--dx-block-size);
  }
  .dx-slider-control[data-orientation='vertical'] {
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    width: var(--dx-block-size);
    height: auto;
  }

  .dx-slider-track {
    position: relative;
    flex: 1 1 auto;
    height: 4px;
    border-radius: 9999px;
    overflow: hidden;
    background: var(--color-input-surface);
  }
  .dx-slider-track[data-orientation='vertical'] {
    width: 4px;
    height: 100%;
  }

  .dx-slider-range {
    background: var(--color-accent-bg);
  }
  .dx-slider-range[data-orientation='horizontal'] {
    height: 100%;
  }
  .dx-slider-range[data-orientation='vertical'] {
    width: 100%;
  }

  .dx-slider-thumb {
    box-sizing: border-box;
    width: var(--dx-slider-thumb);
    height: var(--dx-slider-thumb);
    border-radius: 9999px;
    border: 2px solid var(--color-accent-bg);
    background: var(--color-base-surface);
    cursor: grab;
    transition: background-color 120ms ease-out;
  }
  /* The machine sets the main-axis offset inline; the cross axis is ours. */
  .dx-slider-thumb[data-orientation='horizontal'] {
    top: calc((var(--dx-block-size) - var(--dx-slider-thumb)) / 2);
  }
  .dx-slider-thumb[data-orientation='vertical'] {
    left: calc((var(--dx-block-size) - var(--dx-slider-thumb)) / 2);
  }
  .dx-slider-thumb:hover:not([data-disabled]) {
    background: var(--color-hover-surface);
  }
  .dx-slider-thumb[data-dragging] {
    cursor: grabbing;
  }
  .dx-slider-thumb[data-disabled] {
    cursor: default;
  }
  /* A round thumb takes the ring outside its edge; the inset ring would vanish under the border. */
  .dx-slider-thumb.dx-focus-ring:focus-visible {
    box-shadow: 0 0 0 var(--dx-focus-ring-width) var(--dx-focus-ring-color);
  }

  @media (prefers-reduced-motion: reduce) {
    .dx-slider-thumb {
      transition: none;
    }
  }
}
