/*
 * Copy-to-clipboard affordance (CLAUDE.md §5).
 *
 * A small round icon button injected next to a marked value
 * (assets/js/copy-value.js). Follows the dot/circle motif and takes the
 * fill-invert via ::before like the footer's social circles — but never the
 * magnetic pull, which is reserved for real buttons. Token variables only.
 */

.doryo-copy {
	position: relative;
	z-index: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	width: 1.75rem;
	height: 1.75rem;
	margin-inline-start: var(--wp--preset--spacing--md);
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 50%;
	background: transparent;
	color: var(--wp--preset--color--fg-muted);
	vertical-align: -0.35em;
	cursor: pointer;
	transition: color 300ms var(--wp--custom--motion--ease),
		border-color 300ms var(--wp--custom--motion--ease);
}

/* The wiping ellipse — same interaction language as .doryo-button. */
.doryo-copy::before {
	content: "";
	position: absolute;
	z-index: -1;
	top: -50%;
	left: -25%;
	width: 150%;
	height: 200%;
	border-radius: 50%;
	background: var(--wp--preset--color--brand);
	transform: translate3d(0, 101%, 0);
	transition: transform 600ms var(--wp--custom--motion--ease);
	pointer-events: none;
}

.doryo-copy:hover,
.doryo-copy:focus-visible {
	border-color: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--fg-on-brand);
}

.doryo-copy:hover::before,
.doryo-copy:focus-visible::before {
	transform: translate3d(0, 0, 0);
}

/* Keep the focus ring a deliberate, visible design decision (§8). */
.doryo-copy:focus-visible {
	outline: 2px solid var(--wp--preset--color--brand);
	outline-offset: 2px;
}

/* Icon swap: copy -> check. Both are stacked; only one is ever shown, so the
   confirmation does not rely on colour alone. */
.doryo-copy .doryo-icon {
	width: 0.875rem;
	height: 0.875rem;
}

.doryo-copy .doryo-icon--check,
.doryo-copy.is-done .doryo-icon--copy {
	display: none;
}

.doryo-copy.is-done .doryo-icon--check {
	display: inline-block;
}

.doryo-copy.is-done {
	border-color: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--brand);
}

/* Visually hidden live region announcing the copy result. */
.doryo-copy-status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.doryo-copy,
	.doryo-copy::before {
		transition: none;
	}
}
