@layer toggle {
  .toggle-stage {
    align-items: stretch;
  }

  .toggle-specimens {
    width: min(100%, 650px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .toggle-example {
    min-width: 0;
    min-height: 128px;
    padding: 18px;
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 15px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    background: var(--background);
  }

  .toggle-example-wide {
    grid-column: 1 / -1;
  }

  .toggle-example h2 {
    color: var(--muted-foreground);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .04em;
  }

  .toggle-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .toggle-row-sizes {
    min-height: 36px;
  }

  .toggle-control {
    position: relative;
    display: inline-flex;
    border-radius: var(--radius);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .toggle-control > input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    opacity: 0;
    pointer-events: none;
  }

  .toggle-face {
    min-width: 32px;
    height: 32px;
    padding-inline: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0 solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--foreground);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    user-select: none;
    transition: color 150ms cubic-bezier(.4, 0, .2, 1),
                background-color 150ms cubic-bezier(.4, 0, .2, 1),
                border-color 150ms cubic-bezier(.4, 0, .2, 1),
                box-shadow 150ms cubic-bezier(.4, 0, .2, 1);
  }

  .toggle-face svg {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
  }

  .toggle-outline .toggle-face {
    border-width: 1px;
    border-color: var(--input);
  }

  .toggle-control:hover .toggle-face,
  .toggle-control > input:checked + .toggle-face {
    background: var(--muted);
    color: var(--foreground);
  }

  .toggle-control > input:checked + .toggle-face svg:has(path[d^="m19 21"]) {
    fill: currentColor;
  }

  .toggle-control > input:focus-visible + .toggle-face {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
    outline: none;
  }

  .toggle-control:has(input:disabled) {
    cursor: not-allowed;
  }

  .toggle-control > input:disabled + .toggle-face {
    opacity: .5;
  }

  .toggle-control:has(input:disabled):hover .toggle-face {
    background: transparent;
  }

  .toggle-control:has(input:checked:disabled):hover .toggle-face {
    background: var(--muted);
  }

  .toggle-icon-only .toggle-face {
    padding-inline: 0;
  }

  .toggle-small .toggle-face {
    min-width: 28px;
    height: 28px;
    border-radius: min(calc(var(--radius) - 2px), 12px);
    font-size: .8rem;
    line-height: 1.75;
  }

  .toggle-small .toggle-face svg {
    width: 14px;
    height: 14px;
  }

  .toggle-large .toggle-face {
    min-width: 36px;
    height: 36px;
  }

  @media (max-width: 620px) {
    .toggle-specimens {
      grid-template-columns: 1fr;
    }

    .toggle-example-wide {
      grid-column: auto;
    }
  }

  @media (max-width: 360px) {
    .toggle-example {
      padding: 16px 14px;
    }

    .toggle-row {
      gap: 6px;
    }
  }
}
