/* 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);
  }
}

/**
* Currently only used in Checkbox.
*/

:root {
  --calcite-popper-transition: 150ms ease-in-out;
}

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

:host {
  display: flex;
  justify-content: center;
  outline: 2px solid transparent;
  outline-offset: 2px;
  color: var(--calcite-ui-text-3);
  cursor: pointer;
  min-width: 0;
  width: calc(100% / 7);
}

.day-v-wrapper {
  flex: 1 1 auto;
}

.day-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.day {
  display: flex;
  border-radius: 9999px;
  font-size: var(--calcite-font-size--2);
  line-height: 1rem;
  justify-content: center;
  align-items: center;
  line-height: 1;
  color: var(--calcite-ui-text-3);
  transition-property: all;
  opacity: var(--calcite-ui-opacity-disabled);
  background: none;
  box-shadow: 0 0 0 2px transparent, 0 0 0 0px transparent;
}

.text {
  margin-top: 1px;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 1px;
}

:host([scale=s]) .day-v-wrapper {
  padding-top: 0.125rem;
  padding-bottom: 0.125rem;
}

:host([scale=s]) .day-wrapper {
  padding: 0;
}

:host([scale=s]) .day {
  height: 27px;
  width: 27px;
  font-size: var(--calcite-font-size--2);
}

:host([scale=m]) .day-v-wrapper {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

:host([scale=m]) .day-wrapper {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

:host([scale=m]) .day {
  height: 33px;
  width: 33px;
  font-size: var(--calcite-font-size--1);
}

:host([scale=l]) .day-v-wrapper {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

:host([scale=l]) .day-wrapper {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

:host([scale=l]) .day {
  height: 43px;
  width: 43px;
  font-size: var(--calcite-font-size-0);
}

:host([current-month]) .day {
  opacity: 1;
}

:host([disabled]) {
  cursor: default;
  opacity: 0.25;
}

:host(:hover:not([disabled])) .day,
:host([active]:not([range])) .day {
  background-color: var(--calcite-ui-foreground-2);
  color: var(--calcite-ui-text-1);
}

:host(:focus),
:host([active]) {
  z-index: 1;
}

:host(:focus:not([disabled])) .day {
  box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);
}

:host([selected]) .day {
  font-weight: var(--calcite-font-weight-medium);
  background-color: var(--calcite-ui-brand) !important;
  color: var(--calcite-ui-foreground-1) !important;
  z-index: 1;
}

:host([range][selected]) .day-wrapper {
  background-color: var(--calcite-ui-foreground-current);
}

:host([start-of-range]) :not(.calcite--rtl) .day-wrapper,
:host([end-of-range]) .calcite--rtl .day-wrapper {
  border-top-left-radius: 40%;
  border-bottom-left-radius: 40%;
  box-shadow: inset 4px 0 var(--calcite-ui-foreground-1);
}

:host([start-of-range]) :not(.calcite--rtl) .day,
:host([end-of-range]) .calcite--rtl .day {
  opacity: 1;
}

:host([start-of-range]:not(:focus)) :not(.calcite--rtl) .day,
:host([end-of-range]:not(:focus)) .calcite--rtl .day {
  box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}

:host([end-of-range]) :not(.calcite--rtl) .day-wrapper,
:host([start-of-range]) .calcite--rtl .day-wrapper {
  border-top-right-radius: 40%;
  border-bottom-right-radius: 40%;
  box-shadow: inset -4px 0 var(--calcite-ui-foreground-1);
}

:host([end-of-range]) :not(.calcite--rtl) .day,
:host([start-of-range]) .calcite--rtl .day {
  opacity: 1;
}

:host([end-of-range]:not(:focus)) :not(.calcite--rtl) .day,
:host([start-of-range]:not(:focus)) .calcite--rtl .day {
  box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}

:host([end-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper,
:host([start-of-range][scale=l]) .calcite--rtl .day-wrapper {
  box-shadow: inset -8px 0 var(--calcite-ui-foreground-1);
}

:host([start-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper,
:host([end-of-range][scale=l]) .calcite--rtl .day-wrapper {
  box-shadow: inset 8px 0 var(--calcite-ui-foreground-1);
}

:host([highlighted]) .day-wrapper {
  background-color: var(--calcite-ui-foreground-current);
}

:host([highlighted]) .day-wrapper .day {
  color: var(--calcite-ui-text-1);
}

:host([highlighted]:not([active]:focus)) .day {
  border-radius: 0;
  color: var(--calcite-ui-text-1);
}

:host([range-hover]:not([selected])) .day-wrapper {
  background-color: var(--calcite-ui-foreground-2);
}

:host([range-hover]:not([selected])) .day {
  border-radius: 0;
}

:host([end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,
:host([start-of-range][range-hover]) .calcite--rtl .day-wrapper {
  background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
  border-radius: 0;
  box-shadow: none;
}

:host([start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,
:host([end-of-range][range-hover]) .calcite--rtl .day-wrapper {
  background-image: linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
  border-radius: 0;
  box-shadow: none;
}

:host(:hover[end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,
:host(:hover[start-of-range][range-hover]) .calcite--rtl .day-wrapper {
  background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));
  border-radius: 0;
  box-shadow: none;
}

:host(:hover[start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,
:host(:hover[end-of-range][range-hover]) .calcite--rtl .day-wrapper {
  background-image: linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));
  border-radius: 0;
  box-shadow: none;
}

:host(:hover[range-hover]:not([selected]).focused--end) :not(.calcite--rtl) .day-wrapper,
:host(:hover[range-hover]:not([selected]).focused--start) .calcite--rtl .day-wrapper {
  background-image: linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current));
}

:host(:hover[range-hover]:not([selected]).focused--end) :not(.calcite--rtl) .day,
:host(:hover[range-hover]:not([selected]).focused--start) .calcite--rtl .day {
  border-radius: 9999px;
  opacity: 1;
  box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}

:host(:hover[range-hover]:not([selected]).focused--start) :not(.calcite--rtl) .day-wrapper,
:host(:hover[range-hover]:not([selected]).focused--end) .calcite--rtl .day-wrapper {
  background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
}

:host(:hover[range-hover]:not([selected]).focused--start) :not(.calcite--rtl) .day,
:host(:hover[range-hover]:not([selected]).focused--end) .calcite--rtl .day {
  border-radius: 9999px;
  opacity: 1;
  box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}

:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day-wrapper,
:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day-wrapper {
  background-image: linear-gradient(to right, var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
}

:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day,
:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day {
  border-radius: 9999px;
  opacity: 1;
  box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}

:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day-wrapper,
:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day-wrapper {
  background-image: linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));
}

:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day,
:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day {
  border-radius: 9999px;
  opacity: 1;
  box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1);
}

:host(:hover[start-of-range].hover--inside-range.focused--end) .day-wrapper,
:host(:hover[end-of-range].hover--inside-range.focused--start) .day-wrapper {
  background-image: none;
}

:host([start-of-range].hover--inside-range.focused--end) .day-wrapper,
:host([end-of-range].hover--inside-range.focused--start) .day-wrapper {
  background-color: var(--calcite-ui-foreground-2);
}

:host([highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,
:host([range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,
:host([highlighted]:first-child) .calcite--rtl .day-wrapper,
:host([range-hover]:first-child) .calcite--rtl .day-wrapper {
  border-top-right-radius: 45%;
  border-bottom-right-radius: 45%;
  box-shadow: inset -4px 0px 0px 0px var(--calcite-ui-foreground-1);
}

:host([highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,
:host([range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,
:host([highlighted]:last-child) .calcite--rtl .day-wrapper,
:host([range-hover]:last-child) .calcite--rtl .day-wrapper {
  border-top-left-radius: 45%;
  border-bottom-left-radius: 45%;
  box-shadow: inset 4px 0px 0px 0px var(--calcite-ui-foreground-1);
}

:host([scale=s][highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,
:host([scale=s][range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,
:host([scale=s][highlighted]:first-child) .calcite--rtl .day-wrapper,
:host([scale=s][range-hover]:first-child) .calcite--rtl .day-wrapper {
  box-shadow: inset -1px 0px 0px 0px var(--calcite-ui-foreground-1);
}

:host([scale=s][highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,
:host([scale=s][range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,
:host([scale=s][highlighted]:last-child) .calcite--rtl .day-wrapper,
:host([scale=s][range-hover]:last-child) .calcite--rtl .day-wrapper {
  box-shadow: inset 1px 0px 0px 0px var(--calcite-ui-foreground-1);
}

:host([scale=l][highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,
:host([scale=l][range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,
:host([scale=l][highlighted]:last-child) .calcite--rtl .day-wrapper,
:host([scale=l][range-hover]:last-child) .calcite--rtl .day-wrapper {
  box-shadow: inset 6px 0px 0px 0px var(--calcite-ui-foreground-1);
}

:host([scale=l][highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,
:host([scale=l][range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,
:host([scale=l][highlighted]:first-child) .calcite--rtl .day-wrapper,
:host([scale=l][range-hover]:first-child) .calcite--rtl .day-wrapper {
  box-shadow: inset -6px 0px 0px 0px var(--calcite-ui-foreground-1);
}