/* Click-to-copy wrapper (shared/_copyable): pins a copy button top-right of the yielded
   block; the icon swaps to a check while the wrapper carries .is-copied. */
@layer components {
  .copyable {
    position: relative;
  }

  .copy-button {
    position: absolute;
    right: var(--space-2);
    top: var(--space-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    padding: var(--space-1);
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    transition: color var(--duration-fast) var(--ease-smooth),
      border-color var(--duration-fast) var(--ease-smooth),
      transform var(--duration-fast) var(--ease-smooth);
  }
  .copy-button:hover {
    border-color: var(--border-strong);
    color: var(--text);
  }
  .copy-button:active {
    transform: scale(0.96);
  }

  /* Single-line blocks center the button; the top-anchored default is for multi-line
     blocks (e.g. the read-only-role SQL), where centering would float mid-text. */
  .copyable-center .copy-button {
    top: 50%;
    transform: translateY(-50%);
  }
  .copyable-center .copy-button:active {
    transform: translateY(-50%) scale(0.96);
  }

  /* Right padding for copyable content that isn't a code-block (which pads itself). */
  .copy-clear {
    padding-right: calc(var(--space-6) + var(--space-4));
  }

  .copy-icon {
    width: var(--icon);
    height: var(--icon);
  }
  .copy-icon-done {
    display: none;
    color: var(--success);
  }
  .copyable.is-copied .copy-icon-idle {
    display: none;
  }
  .copyable.is-copied .copy-icon-done {
    display: inline-block;
  }
}
