/**
 * Prism.js Theme - The Hidden Stars
 * Based on VS Code Dark+ theme, customized for neuroscience content
 */

code[class*="language-"],
pre[class*="language-"] {
    color: #d4d4d4;
    font-size: 13px;
    text-shadow: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    direction: ltr;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    line-height: 1.5;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    hyphens: none;
}

pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
    text-shadow: none;
    background: #264f78;
}

@media print {
    code[class*="language-"],
    pre[class*="language-"] {
        text-shadow: none;
    }
}

pre[class*="language-"] {
    padding: 1em;
    margin: .5em 0;
    overflow: auto;
    background: #1e1e1e;
    border-radius: 8px;
    border: 1px solid #2d2d30;
}

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

:not(pre) > code[class*="language-"] {
    padding: .2em .4em;
    border-radius: 4px;
    white-space: normal;
    background: #f7fafc;
    color: #e53e3e;
    border: 1px solid #e2e8f0;
}

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

.token.punctuation {
    color: #d4d4d4;
}

.token.tag,
.token.attr-name,
.token.namespace,
.token.deleted {
    color: #92c5f8;
}

.token.function-name {
    color: #dcdcaa;
}

.token.boolean,
.token.number,
.token.function {
    color: #b5cea8;
}

.token.property,
.token.class-name,
.token.constant,
.token.symbol {
    color: #4ec9b0;
}

.token.selector,
.token.important,
.token.atrule,
.token.keyword,
.token.builtin {
    color: #c586c0;
}

.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.variable {
    color: #ce9178;
}

.token.operator,
.token.entity,
.token.url {
    color: #d4d4d4;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

.token.entity {
    cursor: help;
}

.token.inserted {
    color: green;
}

/* Language specific */
.token.language-css .token.string,
.style .token.string {
    color: #ce9178;
}

.token.language-javascript .token.keyword {
    color: #569cd6;
}

.token.language-python .token.keyword {
    color: #569cd6;
}

.token.language-json .token.property {
    color: #92c5f8;
}

.token.language-markdown .token.title {
    color: #4ec9b0;
    font-weight: bold;
}

.token.language-markdown .token.code {
    color: #ce9178;
}

/* Line highlighting */
pre[data-line] {
    position: relative;
    padding: 1em 0 1em 3em;
}

.line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    padding: inherit 0;
    margin-top: 1em;
    background: rgba(153, 122, 102, 0.08);
    background: linear-gradient(to right, rgba(153, 122, 102, 0.1) 70%, rgba(153, 122, 102, 0));
    pointer-events: none;
    line-height: inherit;
    white-space: pre;
}

/* Code title */
pre[class*="language-"][data-title]::before {
    content: attr(data-title);
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    background: #2d2d30;
    color: #cccccc;
    padding: 0.5em 1em;
    font-size: 0.75em;
    border-radius: 4px 4px 0 0;
    font-weight: 500;
}

/* Copy button */
.code-toolbar {
    position: relative;
}

.code-toolbar .toolbar {
    position: absolute;
    top: 0.3em;
    right: 0.2em;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
}

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

.code-toolbar .toolbar .toolbar-item {
    display: inline-block;
}

.code-toolbar .toolbar a {
    cursor: pointer;
}

.code-toolbar .toolbar button {
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    line-height: normal;
    overflow: visible;
    padding: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.code-toolbar .toolbar a,
.code-toolbar .toolbar button,
.code-toolbar .toolbar span {
    color: #bbb;
    font-size: 0.8em;
    padding: 0 0.5em;
    background: #2d2d30;
    background: rgba(224, 224, 224, 0.2);
    box-shadow: 0 2px 0 0 rgba(0,0,0,0.2);
    border-radius: 0.5em;
}

.code-toolbar .toolbar a:hover,
.code-toolbar .toolbar a:focus,
.code-toolbar .toolbar button:hover,
.code-toolbar .toolbar button:focus,
.code-toolbar .toolbar span:hover,
.code-toolbar .toolbar span:focus {
    color: inherit;
    text-decoration: none;
    background-color: #2c5aa0;
}

/* Neuroscience and scientific keywords highlighting */
.token.neuroscience {
    color: #ff6b6b;
    font-weight: bold;
}

.token.astrocyte {
    color: #4ecdc4;
    font-weight: bold;
}

.token.scientific-unit {
    color: #ffe66d;
}

.token.brain-region {
    color: #a8e6cf;
    font-weight: 500;
}

/* Custom styles for research code blocks */
pre[class*="language-"].research {
    border-left: 4px solid #2c5aa0;
    background: linear-gradient(135deg, #1e1e1e, #252526);
}

pre[class*="language-"].matlab {
    border-left: 4px solid #ff8c42;
}

pre[class*="language-"].python.neuroscience {
    border-left: 4px solid #4ecdc4;
}

pre[class*="language-"].r.statistics {
    border-left: 4px solid #4a90e2;
}

/* Inline code in blog posts */
:not(pre) > code {
    background: #f7fafc;
    color: #2c5aa0;
    border: 1px solid #e2e8f0;
    font-weight: 500;
}

/* Scientific notation support */
.token.scientific-notation {
    color: #dcdcaa;
    font-weight: normal;
}

/* Chemical formulas */
.token.chemical {
    color: #ce9178;
    font-style: normal;
}

/* Mathematical expressions */
.token.math {
    color: #b5cea8;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    code[class*="language-"],
    pre[class*="language-"] {
        font-size: 12px;
    }
    
    pre[class*="language-"] {
        padding: 0.8em;
        margin: 0.3em 0;
    }
    
    :not(pre) > code[class*="language-"] {
        padding: 0.15em 0.3em;
    }
    
    .code-toolbar .toolbar {
        top: 0.2em;
        right: 0.1em;
    }
    
    .code-toolbar .toolbar a,
    .code-toolbar .toolbar button,
    .code-toolbar .toolbar span {
        font-size: 0.7em;
        padding: 0 0.3em;
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    pre[class*="language-"],
    :not(pre) > code[class*="language-"] {
        background: #000000;
        border: 2px solid #ffffff;
    }
    
    code[class*="language-"],
    pre[class*="language-"] {
        color: #ffffff;
    }
    
    .token.comment,
    .token.block-comment,
    .token.prolog,
    .token.doctype,
    .token.cdata {
        color: #cccccc;
    }
    
    .token.punctuation {
        color: #ffffff;
    }
    
    .token.string,
    .token.char,
    .token.attr-value,
    .token.regex,
    .token.variable {
        color: #ffff00;
    }
    
    .token.keyword,
    .token.builtin {
        color: #00ffff;
    }
}

/* Print styles for code blocks */
@media print {
    pre[class*="language-"],
    :not(pre) > code[class*="language-"] {
        background: #ffffff;
        color: #000000;
        border: 1px solid #cccccc;
        box-shadow: none;
    }
    
    .token.comment,
    .token.block-comment,
    .token.prolog,
    .token.doctype,
    .token.cdata {
        color: #666666;
    }
    
    .token.string,
    .token.char,
    .token.attr-value,
    .token.regex,
    .token.variable {
        color: #333333;
    }
    
    .token.keyword,
    .token.builtin {
        color: #000000;
        font-weight: bold;
    }
    
    .code-toolbar .toolbar {
        display: none;
    }
}