:root {
  --swatch-border-color: hsl(0, 0%, 90%);
  --swatch-bg-color: white;
  --swatch-bg-alt-color: hsl(0, 0%, 87%);
  --swatch-gamut-border-color: hsl(340 82% 52%);
  --swatch-stops: transparent, transparent;
}

:root [data-md-color-scheme="slate"] {
  --swatch-border-color: hsla(232, 15%, 25%, 1);
}

:root [data-md-color-scheme="dracula"] {
  --swatch-border-color: hsl(233, 15%, 33%, 1);
  --swatch-gamut-border-color: hsl(326, 100%, 74%);
}

.swatch {
  vertical-align: text-bottom;
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  margin-left: 0.25em;
  margin-right: 0.2em;
  border-radius: 100px;
  line-height: 0;
  transition: all 0.5s ease;
  background-color: var(--swatch-bg-color);
  background-image: linear-gradient(45deg, var(--swatch-bg-alt-color) 25%, transparent 25%),
                    linear-gradient(-45deg, var(--swatch-bg-alt-color) 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, var(--swatch-bg-alt-color) 75%),
                    linear-gradient(-45deg, transparent 75%, var(--swatch-bg-alt-color) 75%);
  background-size: 0.5em 0.5em;
  background-position: 0 0, 0 0.25em, 0.25em -0.25em, -0.25em 0px;
  box-shadow: 0.1em 0.1em 0.1em rgba(0, 0, 0, .3);
}

.swatch-gradient {
  display: inline-block;
  width: 10em;
  background-size: 1em 1em;
  background-position: 0 0, 0 0.50em, 0.50em -0.50em, -0.50em 0px;
  box-shadow: none;
}

.swatch-color {
  vertical-align: text-bottom;
  display: inline-block;
  box-sizing: border-box;
  border-radius: 100px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--swatch-border-color);
  height: 1.25em;
  width: 1.25em;
  background: linear-gradient(to right, var(--swatch-stops));
}

.swatch-gradient .swatch-color {
  width: 10em;
}

div.swatch-gradient,
div.swatch-gradient .swatch-color {
  border-radius: 0;
  width: 100%;
  height: 3em;
  margin: 0;
}

div.swatch-bar .swatch:not(.swatch-gradient),
div.swatch-bar .swatch:not(.swatch-gradient) .swatch-color {
  border-radius: 0;
  height: 3em;
  width: 3em;
  margin: 0;
}

div.swatch-bar {
  box-sizing: border-box;
  border: 2px solid var(--md-code-bg-color);
  background-color: var(--md-default-bg-color);
  background-image: linear-gradient(45deg, var(--md-code-bg-color) 25%, transparent 25%),
                    linear-gradient(-45deg, var(--md-code-bg-color) 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, var(--md-code-bg-color) 75%),
                    linear-gradient(-45deg, transparent 75%, var(--md-code-bg-color) 75%);
  background-size: 1em 1em;
  background-position: 0 0, 0 0.50em, 0.50em -0.50em, -0.50em 0px;
}

.swatch.out-of-gamut .swatch-color {
  border-color: var(--swatch-gamut-border-color);
}

.swatch:hover {
  z-index: 2;
  transform: scale(2);
}

div.swatch-bar > span.swatch:hover {
  z-index: 2;
  transform: scale(1.2) translateY(-0.2em);
}

div.swatch-bar > div.swatch:hover {
  z-index: 2;
  transform: scale(1.02, 1.2) translateY(-0.2em);
}

div.color-command {
  line-height: 0;
}

div.color-command .highlight pre,
div.color-command .highlighttable {
  margin-top: 0;
}

div.color-command .highlighttable:not(:last-child) {
  margin-bottom: 0;
}

div.color-command .highlight pre code {
  border-top: 1px solid var(--md-default-fg-color--lightest);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

div.color-command .highlighttable:not(:last-child) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

@media screen and (max-width: 44.9375em) {
  .md-typeset > div.color-command {
    margin: 0 -.8rem;
  }

  .md-typeset > div.color-command .highlight code {
    border-radius: 0;
  }
}
