/* ---------------------------------
-----  dimension variables --------
---------------------------------- */
/* ------  standard elements padding & margin  ------- */
/* spacing */
/**
**  Official Font sizes
------------------------------- */
/**
** Line-heights
------------------------------- */
/*
  Mixin to progressively-enhance :focus-visible, keeping :focus where not supported
  Add an arbitrary list of selectors into the arguments, and the styling in the block.
  I you pass no selectors to the mixin the parent ("ampersand") operator is used instead.

  There are two mixins:
  - focus-visible: a generic focus-visible, giving you "slots" to decide what to render for :focus, :focus reset, and :focus-visible
  - focus-visible-outline: a focus-visible, which only resets the outline. If you don't need more custom resets, use this one!

  Use focus-visible:
  The key thing here is checking which slot is being rendered.
  For example, you can reset box-shadow here, or anything else.

  @include focus-visible using ($slot) {
      @if $slot == focus {
          outline: 2px solid transparent;
          box-shadow: 0 0 0 4px blue;
      }
      @if $slot == focusReset {
          box-shadow: none;
      }
      @if $slot == focusVisible {
          box-shadow: 0 0 0 4px blue;
      }
  }

  Use focus-visible-outline:
  @include focus-visible-outline("button", "a[href]") {
      outline: 2px solid blue;
  }

  Resulting CSS (compressed):

  button:focus,
  a[href]:focus {
      outline: 2px solid blue;
  }

  button:focus:not(:focus-visible),
  a[href]:focus:not(:focus-visible) {
      outline: none;
  }
  button:focus-visible,
  a[href]:focus-visible {
      outline: 2px solid blue;
  }
*/
/**
@prop --ux-scrollbar-bar-color: Background color of the bar
@prop --ux-scrollbar-bg-color: Background color of the component
@prop --ux-scrollbar-control-color: Color of control elements
@prop --ux-scrollbar-control-hover-color: Hover color of control elements
@prop --ux-scrollbar-control-width: Width of control elements
@prop --ux-scrollbar-control-height: Height of control elements
@prop --ux-scrollbar-gap: Gap size between scrollbar elements
@prop --ux-scrollbar-handle-color: Background color of the handle
@prop --ux-scrollbar-handle-length: Default length of the handle
@prop --ux-scrollbar-handle-size: Size of the handle
@prop --ux-scrollbar-icon-size: Size of scrollbar icons
@prop --ux-scrollbar-inset: Inset of the scrollbar container
@prop --ux-scrollbar-padding: Padding of the scrollbar container
@prop --ux-scrollbar-shadow: Box shadow of the scrollbar container
@prop --ux-scrollbar-size: Size of the component
@prop --ux-scrollbar-track-color: Color of the scrollbar track
@prop --ux-scrollbar-track-size: Size of the scrollbar track
 */
:host {
  --bar-color: var(--ux-scrollbar-bar-color, transparent);
  --bg-color: var(--ux-scrollbar-bg-color, transparent);
  --control-color: var(--ux-scrollbar-control-color, #000);
  --control-active-color: var(--ux-scrollbar-control-active-color, #000);
  --control-disabled-color: var(--ux-scrollbar-control-disabled-color, #a1a1a1);
  --control-hover-color: var(--ux-scrollbar-control-hover-color, #000);
  --control-height: var(--ux-scrollbar-control-height, 24px);
  --control-width: var(--ux-scrollbar-control-width, 24px);
  --handle-length: var(--ux-scrollbar-handle-length, 25%);
  --handle-size: var(--ux-scrollbar-handle-size, 2px);
  --icon-size: var(--ux-scrollbar-icon-size, 16px);
  --scrollbar-gap: var(--ux-scrollbar-gap, 10px);
  --scrollbar-inset: var(--ux-scrollbar-inset, 0);
  --scrollbar-padding: var(--ux-scrollbar-padding, 10px);
  --scrollbar-shadow: var(--ux-scrollbar-shadow, none);
  --scrollbar-size: var(--ux-scrollbar-size, 24px);
  --track-color: var(--ux-scrollbar-track-color, #f2f2f2);
  --track-size: var(--ux-scrollbar-track-size, 2px);
  box-sizing: border-box;
  display: block;
  width: var(--scrollbar-size);
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  height: auto;
  touch-action: none;
  background-color: var(--bg-color);
  pointer-events: auto;
}
@property --bar-color {
  :host {
    syntax: "<color>";
    inherits: false;
    initial-value: transparent;
  }
}
@property --bg-color {
  :host {
    syntax: "<color>";
    inherits: false;
    initial-value: transparent;
  }
}
@property --control-color {
  :host {
    syntax: "<color>";
    inherits: false;
    initial-value: #000;
  }
}
@property --control-disabled-color {
  :host {
    syntax: "<color>";
    inherits: false;
    initial-value: #a1a1a1;
  }
}
@property --control-hover-color {
  :host {
    syntax: "<color>";
    inherits: false;
    initial-value: #000;
  }
}
@property --control-height {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 24px;
  }
}
@property --control-width {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 24px;
  }
}
@property --handle-length {
  :host {
    syntax: "<length> | <percentage>";
    inherits: false;
    initial-value: 25%;
  }
}
@property --handle-size {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 2px;
  }
}
@property --handle-offset {
  :host {
    syntax: "<length> | <percentage>";
    inherits: false;
    initial-value: 0;
  }
}
@property --icon-size {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 20px;
  }
}
@property --scrollbar-gap {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 10px;
  }
}
@property --scrollbar-inset {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 0;
  }
}
@property --scrollbar-padding {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 10px;
  }
}
@property --scrollbar-shadow {
  :host {
    syntax: "*";
    inherits: false;
    initial-value: none;
  }
}
@property --scrollbar-size {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 24px;
  }
}
@property --track-color {
  :host {
    syntax: "<color>";
    inherits: false;
    initial-value: #f2f2f2;
  }
}
@property --track-size {
  :host {
    syntax: "<length>";
    inherits: false;
    initial-value: 2px;
  }
}

.inner {
  display: flex;
  position: absolute;
  width: auto;
  height: auto;
  flex-flow: column nowrap;
  inset: var(--scrollbar-inset);
  background-color: var(--bar-color);
  box-shadow: var(--scrollbar-shadow);
  gap: var(--scrollbar-gap);
}

.controls {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--scrollbar-gap);
}
.controls .ux-icon {
  font-size: var(--icon-size);
  color: currentColor;
  transform-origin: 50% 50%;
}
.controls--disabled {
  pointer-events: none;
}
.controls--disabled .btn {
  color: var(--control-disabled-color);
  cursor: auto;
}
.controls--middle {
  flex: 1 1 auto;
  gap: 0;
}

.bar {
  display: block;
  position: absolute;
  inset: 0;
  cursor: pointer;
  overflow: hidden;
}
.bar:hover .handle {
  background-color: var(--control-hover-color);
}
.bar:active .handle {
  background-color: var(--control-active-color);
}

.btn {
  appearance: none;
  background: transparent;
  border: 0 none;
  border-radius: 0;
  color: var(--control-color);
  width: var(--control-width);
  height: var(--control-height);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: 0 none;
}
.btn:focus-visible {
  outline: var(--ux-button-outline-width) solid var(--ux-button-focus-border-color);
  outline-offset: calc(-1 * var(--ux-button-outline-width));
}
.btn:hover {
  color: var(--control-hover-color);
}
.btn:active {
  color: var(--control-active-color);
}

.track,
.handle {
  box-sizing: border-box;
  display: block;
  margin: auto;
  position: absolute;
  pointer-events: none;
}

.track {
  background-color: var(--track-color);
}

.handle {
  background-color: var(--control-color);
}

:host(:not([direction=horizontal])) .inner,
:host(:not([direction=horizontal])) .controls {
  flex-flow: column nowrap;
}
:host(:not([direction=horizontal])) .controls--start .ux-icon {
  transform: rotate(180deg);
}
:host(:not([direction=horizontal])) .controls--end .ux-icon {
  transform: none;
}
:host(:not([direction=horizontal])) .inner {
  padding: var(--scrollbar-padding) 0;
}
:host(:not([direction=horizontal])) .track,
:host(:not([direction=horizontal])) .handle {
  top: 0;
  left: 50%;
  margin-top: auto;
}
:host(:not([direction=horizontal])) .track {
  width: var(--track-size);
  height: 100%;
  margin-left: calc(-0.5 * var(--track-size));
}
:host(:not([direction=horizontal])) .handle {
  width: var(--handle-size);
  height: var(--handle-length);
  margin-left: calc(-0.5 * var(--handle-size));
  top: var(--handle-offset);
}

:host([direction=horizontal]) {
  width: auto;
  height: var(--scrollbar-size);
  left: 0;
  top: auto;
  bottom: 0;
  right: 0;
}
:host([direction=horizontal]) .inner {
  padding: 0 var(--scrollbar-padding);
}
:host([direction=horizontal]) .controls,
:host([direction=horizontal]) .inner {
  flex-flow: row nowrap;
}
:host([direction=horizontal]) .btn {
  width: var(--control-height);
  height: var(--control-width);
}
:host([direction=horizontal]) .controls--start .ux-icon {
  transform: rotate(90deg);
}
:host([direction=horizontal]) .controls--end .ux-icon {
  transform: rotate(-90deg);
}
:host([direction=horizontal]) .track,
:host([direction=horizontal]) .handle {
  left: 0;
  top: 50%;
  margin-left: auto;
}
:host([direction=horizontal]) .track {
  width: 100%;
  height: var(--track-size);
  margin-top: calc(-0.5 * var(--track-size));
}
:host([direction=horizontal]) .handle {
  width: var(--handle-length);
  height: var(--handle-size);
  margin-top: calc(-0.5 * var(--handle-size));
  left: var(--handle-offset);
}

:host(:not([direction=horizontal]).ux-scrollbar--multiple) .inner {
  bottom: var(--scrollbar-size);
}

:host([direction=horizontal].ux-scrollbar--multiple) {
  right: var(--scrollbar-size);
}