/**
 * CopyButton Styles
 * @countermeasure/web-components
 *
 * 1:1 visual parity with the React `CopyButton` primitive. Class rules below
 * map directly onto the React cva definition:
 *   base    -> inline-flex items-center justify-center gap-2 rounded-xl
 *              text-[13px] font-semibold transition-all duration-250
 *              focus-visible:ring-2 focus-visible:ring-primary/50
 *              disabled:pointer-events-none disabled:opacity-50
 *   default -> border border-border-glass bg-glass hover:bg-glass-hover
 *              hover:border-primary backdrop-blur-[20px]
 *   ghost   -> text-foreground-secondary hover:bg-glass-hover hover:text-foreground
 *   copied  -> text-accent-cyan border-accent-cyan/30
 *   sizes   -> default h-8 px-3 | sm h-7 px-2 text-[12px] | icon size-8 | icon-sm size-7
 */

/* ============================================================================
   BASE
   ============================================================================ */
.cmm-copy-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--color-foreground);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  cursor: pointer;
  user-select: none;
  outline: none;
  transition: all 250ms;
}

.cmm-copy-button:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--color-primary) 50%, transparent);
}

.cmm-copy-button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* ============================================================================
   ICON + LABEL
   ============================================================================ */
.cmm-copy-button__icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  pointer-events: none;
}

.cmm-copy-button__label {
  white-space: nowrap;
}

/* ============================================================================
   VARIANTS
   ============================================================================ */
.cmm-copy-button--default {
  background-color: var(--color-glass);
  border-color: var(--color-border-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.cmm-copy-button--default:hover {
  background-color: var(--color-glass-hover);
  border-color: var(--color-primary);
}

.cmm-copy-button--ghost {
  color: var(--color-foreground-secondary);
  background-color: transparent;
  border-color: transparent;
}

.cmm-copy-button--ghost:hover {
  color: var(--color-foreground);
  background-color: var(--color-glass-hover);
}

/* ============================================================================
   COPIED (SUCCESS) STATE — applies over either variant
   ============================================================================ */
.cmm-copy-button--copied {
  color: var(--color-accent-cyan);
  border-color: color-mix(in oklab, var(--color-accent-cyan) 30%, transparent);
}

/* ============================================================================
   SIZES
   ============================================================================ */
.cmm-copy-button--size-default {
  height: 2rem;
  padding: 0 0.75rem;
}

.cmm-copy-button--size-sm {
  height: 1.75rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
}

.cmm-copy-button--size-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
}

.cmm-copy-button--size-icon-sm {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
}

/* ============================================================================
   REDUCED MOTION
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  .cmm-copy-button {
    transition: none;
  }
}
