/* Make the shiki <pre> a positioning container so the button can sit in
   its top-right corner. */
.markdown-body pre.shiki {
  position: relative;
}

.code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #d0d7de;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.12s, background-color 0.12s, color 0.12s;
}

/* More prominent when the user is on the block or focuses the button. */
.markdown-body pre.shiki:hover .code-copy,
.code-copy:focus-visible {
  opacity: 0.9;
}

.code-copy:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.95);
}

.code-copy-icon {
  font-size: 14px;
  line-height: 1;
  color: #57606a;
}

.code-copy.is-copied {
  opacity: 1;
  background: #ddf4ff;
  border-color: #0969da;
}
.code-copy.is-copied .code-copy-icon {
  color: #0969da;
}

@media (prefers-color-scheme: dark) {
  .code-copy {
    background: rgba(13, 17, 23, 0.6);
    border-color: #484f58;
  }
  .code-copy:hover {
    background: rgba(13, 17, 23, 0.95);
  }
  .code-copy-icon {
    color: #8b949e;
  }
  .code-copy.is-copied {
    background: rgba(56, 139, 253, 0.18);
    border-color: #58a6ff;
  }
  .code-copy.is-copied .code-copy-icon {
    color: #58a6ff;
  }
}

[data-theme="dark"] .code-copy {
  background: rgba(13, 17, 23, 0.6);
  border-color: #484f58;
}
[data-theme="dark"] .code-copy:hover {
  background: rgba(13, 17, 23, 0.95);
}
[data-theme="dark"] .code-copy-icon {
  color: #8b949e;
}
[data-theme="dark"] .code-copy.is-copied {
  background: rgba(56, 139, 253, 0.18);
  border-color: #58a6ff;
}
[data-theme="dark"] .code-copy.is-copied .code-copy-icon {
  color: #58a6ff;
}

[data-theme="light"] .code-copy {
  background: rgba(255, 255, 255, 0.6);
  border-color: #d0d7de;
}
[data-theme="light"] .code-copy:hover {
  background: rgba(255, 255, 255, 0.95);
}
[data-theme="light"] .code-copy-icon {
  color: #57606a;
}

@media print {
  .code-copy {
    display: none;
  }
}
