#generator > p:first-of-type {
  justify-self: center;
  color: var(--color-light);
  text-align: center;

  a {
    white-space: nowrap;
  }
}

.workspace {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;

  > * {
    flex: 1 0 30ch;
  }
}

.canvas {
  --surface: var(--color-background);

  display: grid;
  place-content: center;
  justify-items: center;
  background-color: var(--surface);
  max-width: 100%;
  padding: 2rem;
  box-shadow: inset 0 0 0 0.1em #000, inset 0 0 0 0.18em #fff;
}

.controls {
  --color-graph: #{scale-color(tdbc-color("background"), $lightness: 12%)};
  --transparent: rgba(255, 255, 255, 0);

  padding-top: 1rem;
  padding-bottom: 1rem;
  border: none;
  background: repeating-linear-gradient(
      to right,
      var(--color-graph),
      var(--color-graph) 1px,
      var(--transparent) 1px,
      var(--transparent) 5%
    ),
    repeating-linear-gradient(
      to bottom,
      var(--color-graph),
      var(--color-graph) 1px,
      var(--transparent) 1px,
      var(--transparent) 5%
    );
  border-bottom: 1px solid var(--color-graph);
  border-right: 1px solid var(--color-graph);

  > div {
    display: grid;
    grid-gap: 1rem;
  }

  legend {
    font-weight: 500;
    font-size: 1.25em;
  }

  label {
    justify-self: start;
  }

  p {
    text-align: left;
  }

  button {
    font-size: 1rem;
    margin-top: 1rem;
    position: relative;

    &::after {
      content: "Copied!";
      position: absolute;
      left: 50%;
      transition: all 180ms ease-in-out;
      color: var(--color-blue);
      z-index: -1;
    }

    &.copied::after {
      left: calc(100% + 0.5rem);
      color: var(--color-green);
      z-index: 0;
    }
  }
}

label {
  display: inline-grid;
  grid-gap: 0.5em;
  line-height: 1.1;
  align-items: center;
  font-size: 1.25rem;
  min-height: 24px;

  input:not([type="text"]),
  [class*="control"] {
    grid-area: input;
    cursor: pointer;
  }

  input {
    &:not([type="text"]) {
      opacity: 0;
      width: 1em;
      height: 1em;
    }

    &:focus + .color-control {
      box-shadow: 0 0 0 0.2em #000, 0 0 0 0.3em #fff;
    }
  }
}

.color {
  grid-template-columns: 18ch 1em min-content;
  grid-template-areas: "label input text";

  .color-control {
    --color: white;

    width: 0.8em;
    height: 0.8em;
    border-radius: 0.15em;
    background-color: var(--color);
    box-shadow: 0 0 0 0.1em #000, 0 0 0 0.18em #fff;
  }

  input[type="text"] {
    grid-area: text;
    background-color: var(--color-light);
    color: var(--color-dark);
    border: none;
    border-radius: 0.15em;
    padding: 0 0.25em;
    font-family: inherit;
    font-size: 16px;
    font-size: Max(16px, 1rem);
    width: clamp(8ch, 10vw, 14ch);
    max-width: 100%;
    line-height: 1;
    height: 1.5rem;
  }
}

.results {
  display: grid;
  grid-gap: 2rem;
  justify-items: center;
  padding-top: 2rem;
}

.results ul {
  display: grid;
  grid-gap: 0.5rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-light);

  li {
    display: grid;
    grid-template-columns: 1.25em 1fr 12ch;
    grid-gap: 0.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    align-items: center;
    line-height: 1.1;

    &::before {
      content: attr(data-icon);
    }

    strong {
      font-size: 1.25em;
      letter-spacing: 0.03em;
      text-align: right;

      small {
        display: inline-block;
        margin-left: 0.15em;
        opacity: 0.8;
      }
    }
  }
}

.switch {
  grid-template-areas: "input label";
  grid-template-columns: 2.5rem auto;

  input,
  span {
    width: 2.5rem;
    height: 1rem;
  }

  .switch-control {
    border-radius: 1em;
    background-color: rgba(tdbc-color("text"), 0.45);

    display: inline-grid;
    align-items: center;

    &::before {
      --switch-color: var(--color-light);
      --switch-x: 0%;

      content: "";
      width: 1em;
      height: 1em;
      border-radius: 50%;
      background-color: var(--switch-color);
      transform: translateY(-8%) translateX(var(--switch-x));
      transition: all 180ms ease-in-out;
    }
  }

  input:checked + .switch-control::before {
    --switch-color: var(--color-green);
    --switch-x: 100%;
  }

  input:focus + .switch-control::before {
    box-shadow: inset 0 0 0 2px var(--color-light), inset 0 0 0 4px var(--color-dark);
  }
}

label,
legend,
.results ul {
  color: var(--color-light);
}

.controls,
.results {
  padding-right: min(1.5rem, 3vw);
  padding-left: min(1.5rem, 3vw);
}

textarea {
  display: none;
}

.status,
#results-summary {
  position: absolute;
  clip: rect(0 0 0 0);
  width: 0;
  height: 0;
}
