: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 {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin: 0 0.25em;
  box-sizing: initial;
  line-height: 0;
  border-radius: 100px;
  border: 2px solid var(--swatch-border-color);
  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: 1px 1px 1px rgba(0, 0, 0, .3);
}

.swatch-gradient {
  display: inline-block;
  border-radius: 0.25em;
  width: 10em;
}

.swatch-color {
  display: inline-block;
  margin: 0;
  padding: 0;
  border-radius: 100px;
  height: 1em;
  width: 1em;
  background: linear-gradient(to right, var(--swatch-stops));
}

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

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

.swatch.out-of-gamut .swatch-color {
  opacity: 0;
}

span.swatch:not(.swatch-gradient):hover {
  z-index: 2;
  transform: scale(1.7);
  translateY(10%);
}

span.swatch.swatch-gradient:hover {
  z-index: 2;
  transform: scale(1.3);
  translateY(10%);
}
