/* ====================================================
   BLOK KODE (Prism) — dipakai .sp-prose (single post v2)
   dan .singlepost-content (halaman rangkaian tutorial).

   Tujuan: menyamakan font, menghapus text-shadow Prism,
   memberi judul bahasa + tombol salin yang sejajar, serta
   membuat blok kode bisa digeser horizontal dengan rapi.
   ==================================================== */

/* ---------- pembungkus Prism ---------- */

.sp-prose .code-toolbar,
.singlepost-content .code-toolbar {
    position: relative;
    margin: 1.7em 0;
}

/* ---------- judul bahasa (diisi prism-label.js) ---------- */

.sp-prose .code-toolbar[data-label]::before,
.singlepost-content .code-toolbar[data-label]::before {
    content: attr(data-label);

    display: flex;
    align-items: center;

    box-sizing: border-box;
    height: 38px;
    padding: 0 16px;

    background: #161b22;
    border: 1px solid #21262d;
    border-bottom: 0;
    border-radius: 12px 12px 0 0;

    color: #8b949e;

    font-family: var(--font-mono, "JetBrains Mono", monospace);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}


/* Judul kustom (diisi penulis): tampil apa adanya, bukan kapital */
.sp-prose .code-toolbar[data-label-kind="custom"]::before,
.singlepost-content .code-toolbar[data-label-kind="custom"]::before {
    color: #c9d1d9;

    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
}

/* ---------- blok kode ---------- */

.sp-prose pre,
.singlepost-content pre {
    position: relative;

    box-sizing: border-box;
    margin: 1.7em 0;
    padding: 18px 20px;

    border: 1px solid #21262d;
    border-radius: 12px;

    background: #0d1117;
    color: #e6edf3;

    font-family: var(--font-mono, "JetBrains Mono", monospace);
    font-size: 13.5px;
    line-height: 1.7;

    overflow-x: auto;
    overscroll-behavior-x: contain;

    scrollbar-width: thin;
    scrollbar-color: #30363d transparent;

    text-shadow: none;
}

/* di dalam pembungkus: judul bahasa menempel di atas blok */
.sp-prose .code-toolbar pre,
.singlepost-content .code-toolbar pre {
    margin: 0;
    border-radius: 0 0 12px 12px;
}

.sp-prose .code-toolbar[data-label] pre,
.singlepost-content .code-toolbar[data-label] pre {
    border-top: 0;
}

/* tanpa judul bahasa: sudut tetap membulat penuh */
.sp-prose .code-toolbar:not([data-label]) pre,
.singlepost-content .code-toolbar:not([data-label]) pre {
    border-radius: 12px;
}

/* ---------- kode di dalam blok ---------- */

.sp-prose pre code,
.singlepost-content pre code {
    display: block;

    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;

    color: #e6edf3;

    font-family: inherit;
    font-size: inherit;
    line-height: inherit;

    white-space: pre;
    tab-size: 4;

    text-shadow: none;
}

/* ---------- kode inline ---------- */

.sp-prose :not(pre) > code,
.singlepost-content :not(pre) > code {
    padding: 2px 6px;

    border: 1px solid #d8dee4;
    border-radius: 6px;

    background: #f2f5f9;
    color: #1f2328;

    font-family: var(--font-mono, "JetBrains Mono", monospace);
    font-size: 0.86em;
    line-height: 1.5;

    white-space: normal;
    overflow-wrap: anywhere;

    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;

    text-shadow: none;
}

/* ---------- tombol salin bawaan Prism ---------- */

.sp-prose .code-toolbar > .toolbar,
.singlepost-content .code-toolbar > .toolbar {
    position: absolute;
    top: 7px;
    right: 10px;

    z-index: 3;

    opacity: 1;
}

.sp-prose .code-toolbar > .toolbar .toolbar-item,
.singlepost-content .code-toolbar > .toolbar .toolbar-item {
    display: inline-block;
}

.sp-prose .code-toolbar > .toolbar .toolbar-item > .copy-to-clipboard-button,
.singlepost-content .code-toolbar > .toolbar .toolbar-item > .copy-to-clipboard-button {
    padding: 3px 9px;

    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px;

    background: rgba(255, 255, 255, 0.06);
    color: #c9d1d9;

    font-family: var(--font-mono, "JetBrains Mono", monospace);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.6;

    cursor: pointer;

    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sp-prose .code-toolbar > .toolbar .toolbar-item > .copy-to-clipboard-button:hover,
.singlepost-content .code-toolbar > .toolbar .toolbar-item > .copy-to-clipboard-button:hover,
.sp-prose .code-toolbar > .toolbar .toolbar-item > .copy-to-clipboard-button:focus-visible,
.singlepost-content .code-toolbar > .toolbar .toolbar-item > .copy-to-clipboard-button:focus-visible {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

/* ---------- scrollbar tipis (WebKit/Blink) ---------- */

.sp-prose pre::-webkit-scrollbar,
.singlepost-content pre::-webkit-scrollbar {
    height: 8px;
}

.sp-prose pre::-webkit-scrollbar-track,
.singlepost-content pre::-webkit-scrollbar-track {
    background: transparent;
}

.sp-prose pre::-webkit-scrollbar-thumb,
.singlepost-content pre::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: #30363d;
}

.sp-prose pre::-webkit-scrollbar-thumb:hover,
.singlepost-content pre::-webkit-scrollbar-thumb:hover {
    background: #3d444d;
}

/* ---------- layar kecil ---------- */

@media (max-width: 768px) {

    .sp-prose pre,
    .singlepost-content pre {
        padding: 16px 16px;
        font-size: 12.5px;
        border-radius: 10px;
    }

    .sp-prose .code-toolbar[data-label]::before,
    .singlepost-content .code-toolbar[data-label]::before {
        height: 34px;
        padding: 0 14px;
        border-radius: 10px 10px 0 0;
        font-size: 11px;
    }

    .sp-prose .code-toolbar pre,
    .singlepost-content .code-toolbar pre {
        border-radius: 0 0 10px 10px;
    }
}