/* 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([scale=s]) .container {
  width: 156px;
}

:host([scale=s]) .saved-colors {
  grid-template-columns: repeat(auto-fill, minmax(20px, 1fr));
}

:host([scale=s]) .channels {
  flex-direction: column;
}

:host([scale=s]) .channel {
  width: 100%;
  margin-bottom: 4px;
}

:host([scale=s]) .channel:last-child {
  margin-bottom: 0;
}

:host([scale=m]) .container {
  width: 272px;
}

:host([scale=l][dir=rtl]) .control-section > :nth-child(2) {
  margin-left: 0;
  margin-right: 12px;
}

:host([scale=l]) .container {
  width: 420px;
}

:host([scale=l]) .color-field-and-slider {
  margin-bottom: -20px;
}

:host([scale=l]) .section {
  padding: 0 16px 16px;
}

:host([scale=l]) .section:first-of-type {
  padding-top: 16px;
}

:host([scale=l]) .saved-colors {
  grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
  grid-gap: 12px;
  padding-top: 16px;
}

:host([scale=l]) .control-section {
  flex-wrap: nowrap;
}

:host([scale=l]) .control-section > :nth-child(2) {
  margin-left: 12px;
}

:host([scale=l]) .color-hex-options {
  flex-shrink: 1;
}

:host([scale=l]) .color-mode-container {
  flex-shrink: 3;
}

:host([appearance=minimal]) .container {
  border: none;
}

.container {
  display: inline-block;
  border: 1px solid var(--calcite-ui-border-1);
  background-color: var(--calcite-ui-foreground-1);
}

.color-field-and-slider {
  margin-bottom: -16px;
}

.color-field-and-slider--interactive {
  cursor: pointer;
}

.control-section {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.section {
  padding: 0 12px 12px;
}

.section:first-of-type {
  padding-top: 12px;
}

.color-hex-options,
.section--split {
  flex-grow: 1;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--calcite-ui-text-3);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.5;
}

.header.header--underlined {
  border-bottom: 1px solid var(--calcite-ui-border-1);
}

.header--hex {
  line-height: 1.5;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 12px 0 15px;
}

.control {
  margin-top: 8px;
}

.channels {
  display: flex;
  justify-content: space-between;
}

.channel {
  width: 31%;
}

.saved-colors {
  padding-top: 12px;
  display: -ms-grid;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(24px, 1fr));
  grid-gap: 8px;
  width: 100%;
}

.saved-colors-buttons {
  display: flex;
}

.saved-color {
  outline-offset: 0;
  outline-color: transparent;
  transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  cursor: pointer;
}

.saved-color:focus {
  outline: 2px solid var(--calcite-ui-blue-1);
  outline-offset: 2px;
}

.saved-color:hover {
  transition: outline-color 100ms ease-in-out;
  outline: 2px solid var(--calcite-ui-border-2);
  outline-offset: 2px;
}