﻿/* ── Layout ─────────────────────────────────────────────── */
.code-block-wrapper {
    min-width: 0; /* ← prevents flex/grid blowout */
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #1e1e2e;
    margin: 1.25rem 0;
    border: 1px solid var(--nh-color-border);
    font-size: 0.875rem;
    background: rgba(255 255 255 / 0.02);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    /*background: rgba(255 255 255 / 0.03);
    border-bottom-color: rgba(255 255 255 / 0.06);*/
}

.code-block-lang {
    font-family: monospace;
    font-size: 0.7rem;
    color: rgba(255 255 255 / 0.4);
    letter-spacing: 0.06em;
}
.code-block-header-text {
    font-family: monospace;
    font-size: 0.7rem;
    color: rgba(255 255 255 / 0.6);
    letter-spacing: 0.06em;
}

.code-block-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255 255 255 / 0.35);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.15s ease, background 0.15s ease;
    line-height: 1;
}

    .code-block-copy:hover {
        color: rgba(255 255 255 / 0.8);
        background: rgba(255 255 255 / 0.07);
    }

    .code-block-copy .copy-icon-symbol {
        font-size: 22px;
        transition: transform 0.15s ease;
        display: block;
    }

    .code-block-copy.copied {
        color: var(--nh-color-accent);
    }

        .code-block-copy.copied .copy-icon-symbol {
            animation: icon-pop 0.2s ease;
        }

@keyframes icon-pop {
    0% {
        transform: scale(0.7);
    }

    60% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.code-block-wrapper pre {
    margin: 0;
    padding: 1rem 1.25rem;
    overflow-x: auto; /* ← scrolls horizontally */
    overflow-y: visible;
    white-space: pre;
    padding: 1rem 1.25rem;
    overflow-x: auto;
}

.code-block-wrapper code {
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: clamp(0.6rem, 1vw, 0.875rem);
    line-height: 1.7;
    color: #a9b7c6;
}

/* ── Tokens ─────────────────────────────────────────────── */
.nh-code-color-comment {
    color: #616161;
    font-style: italic;
}

.nh-code-color-string {
    color: #c07858;
}

.nh-code-color-keyword {
    color: #6796e6;
}
/* void, const, float — blue */
.nh-code-color-type {
    color: #9c74c8;
}
/* UClass names — same as default */
.nh-code-color-number {
    color: #6897bb;
}

.nh-code-color-method {
    color: #4ec9b0;
}
/* function names — teal */
.nh-code-color-operator {
    color: #a9b7c6;
}

.nh-code-color-preproc {
    color: #bbb529;
}

.nh-code-color-class {
    color: var(--nh-blue);
}

.nh-code-color-struct {
    color: var(--nh-blue);
}

.nh-code-color-event {
    color: var(--nh-yellow);
}

/* ── CodeLine (single-line inline variant) ──────────────── */
.code-line-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.5rem 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--nh-color-border);
    background: rgba(255 255 255 / 0.03);
    font-size: 0.875rem;
    white-space: nowrap;
    vertical-align: middle;
    max-width: 100%;
    overflow: hidden;
}

    .code-line-wrapper code {
        font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
        font-size: clamp(0.6rem, 1vw, 0.8rem);
        line-height: 1.5;
        color: #a9b7c6;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1 1 auto;
        min-width: 0;
    }

.code-line-lang {
    font-family: monospace;
    font-size: 0.65rem;
    color: rgba(255 255 255 / 0.3);
    letter-spacing: 0.06em;
    flex-shrink: 0;
    user-select: none;
}

.code-line-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: rgba(255 255 255 / 0.3);
    cursor: pointer;
    padding: 0.1rem;
    transition: color 0.15s ease, background 0.15s ease;
    line-height: 1;
}

    .code-line-copy:hover {
        color: rgba(255 255 255 / 0.8);
        background: rgba(255 255 255 / 0.07);
    }

    .code-line-copy .copy-icon-symbol {
        font-size: 16px;
        display: block;
        transition: transform 0.15s ease;
    }

    .code-line-copy.copied {
        color: var(--nh-color-accent);
    }

        .code-line-copy.copied .copy-icon-symbol {
            animation: icon-pop 0.2s ease;
        }


.nh-code-term {
    background-color: var(--nh-color-bg-surface);
    border: 1px solid var(--nh-color-border-subtle);
    border-radius: 4px;
    padding: 2px 7px;
    font-family: 'Cascadia Code', 'Consolas', 'Fira Code', monospace;
    font-size: 0.875em;
    letter-spacing: 0.01em;
}