/*
 * Usetech Code Style
 * Светлая палитра под бренд usetech.ru: акцент #78be21, нейтральные #222/#f2f2f2,
 * аккуратная рамка с тонкой тенью, мягкая полоска-акцент слева.
 */

.ucs-code {
    --ucs-accent: #78be21;
    --ucs-bg: #fdfdfd;
    --ucs-head-bg: #fafbf9;
    --ucs-head-text: #2f3a2c;
    --ucs-border: #ececea;
    --ucs-border-strong: #d6dad2;
    --ucs-text: #12161b;
    --ucs-muted: #6b7780;

    margin: 28px 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--ucs-bg);
    border: 1px solid var(--ucs-border);
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, ui-monospace, monospace;
    position: relative;
}

.ucs-code::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--ucs-accent) 0%, rgba(120, 190, 33, 0.55) 100%);
    pointer-events: none;
}

.ucs-code__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px 9px 17px;
    background: var(--ucs-head-bg);
    border-bottom: 1px solid var(--ucs-border);
    color: var(--ucs-head-text);
    font-size: 11.5px;
    line-height: 1;
    letter-spacing: 0.06em;
}

.ucs-code__lang {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-transform: uppercase;
    font-weight: 700;
    color: #1d2327;
}

.ucs-code__lang::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ucs-accent);
    box-shadow: 0 0 0 3px rgba(120, 190, 33, 0.18);
}

.ucs-code__copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff;
    color: #1d2327;
    border: 1px solid var(--ucs-border-strong);
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.02em;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ucs-code__copy:hover {
    background: var(--ucs-accent);
    color: #fff;
    border-color: var(--ucs-accent);
}

.ucs-code__copy:active {
    transform: translateY(1px);
}

.ucs-code__copy svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    display: block;
}

.ucs-code__copy[data-state="ok"] {
    background: rgba(120, 190, 33, 0.14);
    color: #3f6815;
    border-color: rgba(120, 190, 33, 0.55);
}

.ucs-code__copy[data-state="ok"]:hover {
    background: var(--ucs-accent);
    color: #fff;
}

.ucs-code__copy[data-state="err"] {
    background: rgba(214, 54, 56, 0.10);
    color: #a02123;
    border-color: rgba(214, 54, 56, 0.5);
}

.ucs-code pre,
.ucs-code pre.wp-block-code,
.ucs-code pre.has-background {
    margin: 0;
    padding: 18px 18px 18px 22px;
    background: transparent !important; /* перебиваем core .has-*-background-color !important */
    border: 0;
    border-radius: 0;
    overflow-x: auto;
    color: var(--ucs-text);
    font-size: 13.5px;
    line-height: 1.65;
}

.ucs-code pre code,
.ucs-code pre code.hljs {
    padding: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    white-space: pre;
    display: block;
}

/* Перекрываем github.css фон, чтобы не было «двойной» рамки */
.ucs-code .hljs {
    background: transparent;
}

.ucs-code pre::-webkit-scrollbar {
    height: 8px;
}

.ucs-code pre::-webkit-scrollbar-track {
    background: transparent;
}

.ucs-code pre::-webkit-scrollbar-thumb {
    background: #c8cec0;
    border-radius: 4px;
}

.ucs-code pre::-webkit-scrollbar-thumb:hover {
    background: var(--ucs-accent);
}

/* Inline-код */
:where(p, li, td, h1, h2, h3, h4, h5, h6) > code:not(.hljs) {
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(120, 190, 33, 0.10);
    color: #2c3338;
    border: 1px solid rgba(120, 190, 33, 0.22);
    font-family: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
    font-size: 0.9em;
}

@media (max-width: 640px) {
    .ucs-code__head {
        padding: 8px 10px 8px 13px;
    }

    .ucs-code pre {
        padding: 14px 12px 14px 16px;
        font-size: 12.5px;
    }

    .ucs-code__copy span {
        display: none;
    }

    .ucs-code__copy {
        padding: 6px 9px;
    }
}
