/* ==========================================
   Alog - Prism.js Custom Theme
   Neural Dark Code Highlighting
   ========================================== */

code[class*="language-"],
pre[class*="language-"] {
    color: #e6edf3;
    background: none;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.7;
    tab-size: 2;
    hyphens: none;
    -moz-tab-size: 2;
    -o-tab-size: 2;
}

/* Code blocks */
pre[class*="language-"] {
    padding: 1.25rem;
    margin: 1rem 0;
    overflow: auto;
    border-radius: 8px;
    background: #161b22;
    border: 1px solid #30363d;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
    background: #161b22;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
    padding: 2px 6px;
    border-radius: 4px;
    white-space: normal;
    background: #21262d;
}

/* Selection */
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
    background: rgba(124, 58, 237, 0.3);
    text-shadow: none;
}

/* ---- Token Colors ---- */

/* Comments */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #6e7681;
    font-style: italic;
}

/* Punctuation */
.token.punctuation {
    color: #8b949e;
}

/* Namespace */
.token.namespace {
    opacity: 0.7;
}

/* Properties, Tags, Booleans, Constants, Symbols, Deleted */
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: #79c0ff;
}

/* Selectors, Attribute names, Strings, Characters, Built-in, Inserted */
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #a5d6ff;
}

/* Operators, Entities, URLs */
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #79c0ff;
}

/* At-rules, Keywords */
.token.atrule,
.token.attr-value,
.token.keyword {
    color: #ff7b72;
}

/* Functions, Class names */
.token.function,
.token.class-name {
    color: #d2a8ff;
}

/* Regex */
.token.regex {
    color: #a5d6ff;
}

/* Important, Bold */
.token.important,
.token.bold {
    font-weight: bold;
}

/* Italic */
.token.italic {
    font-style: italic;
}

/* Entity */
.token.entity {
    cursor: help;
}

/* Variables */
.token.variable {
    color: #ffa657;
}

/* Template strings */
.token.template-string {
    color: #a5d6ff;
}

.token.template-punctuation {
    color: #ff7b72;
}

/* Interpolation */
.token.interpolation {
    color: #ffa657;
}

/* Annotations / Decorators */
.token.annotation {
    color: #d2a8ff;
}

/* Parameters */
.token.parameter {
    color: #ffa657;
}

/* Type hint */
.token.type {
    color: #79c0ff;
}


/* ---- Language-specific ---- */

/* JSON */
.language-json .token.property {
    color: #79c0ff;
}

.language-json .token.string {
    color: #a5d6ff;
}

.language-json .token.number {
    color: #79c0ff;
}

.language-json .token.boolean {
    color: #ff7b72;
}

.language-json .token.null {
    color: #ff7b72;
}

/* Markdown */
.language-markdown .token.title {
    color: #d2a8ff;
    font-weight: bold;
}

.language-markdown .token.bold {
    color: #ffa657;
    font-weight: bold;
}

.language-markdown .token.italic {
    color: #e6edf3;
    font-style: italic;
}

.language-markdown .token.url {
    color: #58a6ff;
    text-decoration: underline;
}

.language-markdown .token.code {
    color: #a5d6ff;
    background: rgba(110, 118, 129, 0.15);
    border-radius: 3px;
    padding: 1px 4px;
}

/* CSS */
.language-css .token.selector {
    color: #7ee787;
}

.language-css .token.property {
    color: #79c0ff;
}

.language-css .token.function {
    color: #d2a8ff;
}

.language-css .token.url {
    color: #a5d6ff;
}

/* HTML */
.language-html .token.tag {
    color: #7ee787;
}

.language-html .token.attr-name {
    color: #79c0ff;
}

.language-html .token.attr-value {
    color: #a5d6ff;
}

/* Shell / Bash */
.language-bash .token.function {
    color: #d2a8ff;
}

.language-bash .token.variable {
    color: #ffa657;
}

.language-bash .token.builtin {
    color: #ff7b72;
}

/* PHP */
.language-php .token.variable {
    color: #ffa657;
}

.language-php .token.this {
    color: #ff7b72;
}

/* Python */
.language-python .token.decorator {
    color: #d2a8ff;
}

.language-python .token.builtin {
    color: #79c0ff;
}

/* SQL */
.language-sql .token.keyword {
    color: #ff7b72;
}

.language-sql .token.function {
    color: #d2a8ff;
}

/* YAML */
.language-yaml .token.key {
    color: #7ee787;
}

.language-yaml .token.value {
    color: #a5d6ff;
}


/* ---- Line numbers ---- */
pre[class*="language-"].line-numbers {
    position: relative;
    padding-left: 3.8em;
    counter-reset: linenumber;
}

pre[class*="language-"].line-numbers > code {
    position: relative;
    white-space: inherit;
}

.line-numbers .line-numbers-rows {
    position: absolute;
    pointer-events: none;
    top: 0;
    font-size: 100%;
    left: -3.8em;
    width: 3em;
    letter-spacing: -1px;
    border-right: 1px solid #30363d;
    user-select: none;
}

.line-numbers-rows > span {
    display: block;
    counter-increment: linenumber;
}

.line-numbers-rows > span::before {
    content: counter(linenumber);
    color: #484f58;
    display: block;
    padding-right: 0.8em;
    text-align: right;
}


/* ---- Line highlighting ---- */
pre[data-line] {
    position: relative;
}

.line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    padding: inherit 0;
    margin-top: 1.25rem;
    background: rgba(124, 58, 237, 0.08);
    border-left: 3px solid var(--color-accent);
    pointer-events: none;
    line-height: inherit;
    white-space: pre;
}


/* ---- Toolbar (copy button) ---- */
div.code-toolbar {
    position: relative;
}

div.code-toolbar > .toolbar {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

div.code-toolbar:hover > .toolbar {
    opacity: 1;
}

div.code-toolbar > .toolbar > .toolbar-item > button,
div.code-toolbar > .toolbar > .toolbar-item > a,
div.code-toolbar > .toolbar > .toolbar-item > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #21262d;
    color: #8b949e;
    font-size: 12px;
    font-family: inherit;
    border-radius: 6px;
    border: 1px solid #30363d;
    cursor: pointer;
    transition: all 0.2s ease;
}

div.code-toolbar > .toolbar > .toolbar-item > button:hover {
    background: #292e36;
    color: #e6edf3;
    border-color: #484f58;
}

/* Language label */
div.code-toolbar > .toolbar > .toolbar-item:first-child > span {
    background: transparent;
    border: none;
    color: #484f58;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: default;
}


/* ---- Diff highlighting ---- */
.token.inserted-sign,
.token.prefix.inserted {
    color: #7ee787;
}

.token.deleted-sign,
.token.prefix.deleted {
    color: #f87171;
}

.token.unchanged {
    color: #8b949e;
}

pre.diff-highlight > code .token.deleted:not(.prefix),
pre > code.diff-highlight .token.deleted:not(.prefix) {
    background-color: rgba(248, 81, 73, 0.1);
    display: inline;
}

pre.diff-highlight > code .token.inserted:not(.prefix),
pre > code.diff-highlight .token.inserted:not(.prefix) {
    background-color: rgba(63, 185, 80, 0.1);
    display: inline;
}
