/* ==========================================================================
   Shared code-block copy button — EltonUtils.CodeCopy
   The wrapper is injected around an existing `<pre>`, so it must stay layout
   neutral: no padding/border/margin of its own (the pre's margins collapse
   through it and keep the original rhythm).
   Colours assume the dark fenced-code block every markdown surface here
   renders (--color-code-bg + the github-dark hljs theme).
   ========================================================================== */
.eu-codeblock {
    position: relative;
}

.eu-codeblock-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--color-code-border);
    border-radius: 4px;
    background: var(--color-code-bg-dark);
    color: var(--color-code-text-light);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    /* Hidden until the block is hovered — a button on every block at rest
       competes with the code for attention. */
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.eu-codeblock:hover .eu-codeblock-copy,
.eu-codeblock-copy:focus,
.eu-codeblock-copy.is-copied,
.eu-codeblock-copy.is-failed {
    opacity: 1;
}

.eu-codeblock-copy:hover {
    background: var(--color-gray-800);
    color: var(--color-text-white);
}

.eu-codeblock-copy.is-copied {
    color: var(--color-success-light);
    border-color: var(--color-success-light);
}

.eu-codeblock-copy.is-failed {
    color: var(--color-error-light);
    border-color: var(--color-error-light);
}

/* Touch: there is no hover to reveal it, so keep it visible but quiet. */
@media (hover: none) {
    .eu-codeblock-copy {
        opacity: 0.75;
    }
}
