/* mixins & extensions */
@keyframes in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes in-down {
  0% {
    opacity: 0;
    transform: translate3D(0, -5px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3D(0, 0, 0);
  }
}
@keyframes in-up {
  0% {
    opacity: 0;
    transform: translate3D(0, 5px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3D(0, 0, 0);
  }
}
@keyframes in-scale {
  0% {
    opacity: 0;
    transform: scale3D(0.95, 0.95, 1);
  }
  100% {
    opacity: 1;
    transform: scale3D(1, 1, 1);
  }
}
:root {
  --calcite-animation-timing: calc(150ms * var(--calcite-internal-duration-factor));
  --calcite-internal-duration-factor: var(--calcite-duration-factor, 1);
  --calcite-internal-animation-timing-fast: calc(100ms * var(--calcite-internal-duration-factor));
  --calcite-internal-animation-timing-medium: calc(200ms * var(--calcite-internal-duration-factor));
  --calcite-internal-animation-timing-slow: calc(300ms * var(--calcite-internal-duration-factor));
}

.calcite-animate {
  opacity: 0;
  animation-fill-mode: both;
  animation-duration: var(--calcite-animation-timing);
}

.calcite-animate__in {
  animation-name: in;
}

.calcite-animate__in-down {
  animation-name: in-down;
}

.calcite-animate__in-up {
  animation-name: in-up;
}

.calcite-animate__in-scale {
  animation-name: in-scale;
}

/**
* Currently only used in Checkbox.
*/
:root {
  --calcite-popper-transition: var(--calcite-animation-timing);
}

:host([hidden]) {
  display: none;
}

:host {
  display: block;
  max-width: 100%;
  cursor: pointer;
  color: var(--calcite-ui-text-3);
  outline: 2px solid transparent;
  outline-offset: 2px;
}

:host([scale=s]) {
  font-size: var(--calcite-font-size--2);
  line-height: 1rem;
}
:host([scale=s]) .node-container {
  --calcite-tree-padding-y: 0.25rem;
}
:host([scale=s]) .node-container .checkbox,
:host([scale=s]) .node-container .chevron,
:host([scale=s]) .node-container .checkmark,
:host([scale=s]) .node-container .bullet-point {
  margin-inline: 0.25rem;
}

:host([scale=m]) {
  font-size: var(--calcite-font-size--1);
  line-height: 1rem;
}
:host([scale=m]) .node-container {
  --calcite-tree-padding-y: 0.5rem;
}
:host([scale=m]) .node-container .checkbox,
:host([scale=m]) .node-container .chevron,
:host([scale=m]) .node-container .checkmark,
:host([scale=m]) .node-container .bullet-point {
  margin-inline: 0.5rem;
}

:host([scale=l]) {
  font-size: var(--calcite-font-size-0);
  line-height: 1.25rem;
}
:host([scale=l]) .node-container {
  --calcite-tree-padding-y: 0.75rem;
}
:host([scale=l]) .node-container .checkbox,
:host([scale=l]) .node-container .chevron,
:host([scale=l]) .node-container .checkmark,
:host([scale=l]) .node-container .bullet-point {
  margin-inline: 0.75rem;
}

:host([lines]) .children-container:after {
  position: absolute;
  top: 0px;
  width: 1px;
  transition-property: color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
  transition-property: all;
  transition-duration: var(--calcite-animation-timing);
  transition-timing-function: ease-in-out;
  transition-delay: 0s;
  height: 96%;
  content: "";
  background-color: var(--calcite-ui-border-2);
  z-index: -1;
}

:host(:not([lines])) .node-container:after {
  display: none;
}

::slotted(*) {
  min-width: 0px;
  max-width: 100%;
  overflow-wrap: break-word;
  color: inherit;
  text-decoration: none !important;
}
::slotted(*):hover {
  text-decoration: none !important;
}

::slotted(a) {
  width: 100%;
  -webkit-text-decoration-line: none;
          text-decoration-line: none;
}

:host {
  outline-offset: 0;
  outline-color: transparent;
  transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
}

:host(:focus) {
  outline: 2px solid var(--calcite-ui-brand);
  outline-offset: -2px;
}

.checkbox {
  outline: 2px solid transparent;
  outline-offset: 2px;
  line-height: 0;
}

.checkbox-label {
  pointer-events: none;
  display: flex;
  align-items: center;
}

.children-container {
  position: relative;
  height: 0px;
  overflow: hidden;
  margin-inline-start: 1.25rem;
  transform: scaleY(0);
  opacity: 0;
  transition: var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out;
  transform-origin: top;
}
:host([expanded]) > .children-container {
  transform: scaleY(1);
  opacity: 1;
  height: auto;
}

.node-container {
  position: relative;
  display: flex;
  align-items: center;
  padding: var(--calcite-tree-padding-y) 0;
}
.node-container .checkmark, .node-container .bullet-point {
  opacity: 0;
  transition-property: all;
  transition-duration: var(--calcite-animation-timing);
  transition-timing-function: ease-in-out;
  transition-delay: 0s;
  color: var(--calcite-ui-border-1);
}

.node-container:hover .checkmark, .node-container:hover .bullet-point, :host([selected]) .node-container:hover .checkmark, :host([selected]) .node-container:hover .bullet-point, :host(:focus) .node-container .checkmark, :host(:focus) .node-container .bullet-point {
  opacity: 1;
}

:host([selected]) > .node-container, :host([selected]) > .node-container:hover {
  font-weight: var(--calcite-font-weight-medium);
  color: var(--calcite-ui-text-1);
}
:host([selected]) > .node-container .bullet-point, :host([selected]) > .node-container .checkmark, :host([selected]) > .node-container:hover .bullet-point, :host([selected]) > .node-container:hover .checkmark {
  opacity: 1;
  color: var(--calcite-ui-brand);
}

:host(:not([has-children])):host([scale=s]) > .node-container[data-selection-mode=ancestors] .checkbox {
  padding-inline-start: 1.25rem;
}
:host(:not([has-children])):host([scale=m]) > .node-container[data-selection-mode=ancestors] .checkbox {
  padding-inline-start: 1.5rem;
}
:host(:not([has-children])):host([scale=l]) > .node-container[data-selection-mode=ancestors] .checkbox {
  padding-inline-start: 1.75rem;
}

:host([has-children]) > .node-container[data-selection-mode=ancestors] .checkbox {
  margin-inline-start: 0;
}

:host([has-children]) > .node-container .bullet-point, :host([has-children]) > .node-container .checkmark {
  display: none;
}

:host([has-children][expanded]:not([selected])) > .node-container ::slotted(*) {
  font-weight: var(--calcite-font-weight-medium);
  color: var(--calcite-ui-text-1);
}

:host([has-children][selected]) > .node-container[data-selection-mode=children], :host([has-children][selected]) > .node-container[data-selection-mode=multi-children] {
  color: var(--calcite-ui-brand);
}

.chevron {
  position: relative;
  align-self: center;
  color: var(--calcite-ui-text-3);
  transition-property: all;
  transition-duration: var(--calcite-animation-timing);
  transition-timing-function: ease-in-out;
  transition-delay: 0s;
  flex: 0 0 auto;
  transform: rotate(0deg);
}
.calcite--rtl .chevron {
  transform: rotate(180deg);
}
:host([expanded]) > .node-container > .chevron {
  transform: rotate(90deg);
}

:host([selected]) .checkmark,
:host([selected]) .bullet-point {
  color: var(--calcite-ui-brand);
}