/*@import url("https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap");*/
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap");

:root {
    /* Default Light Theme */
    --bg-color: #f0f0f0;
    --text-color: #1a1a1a;
    --border-color: #1a1a1a;
    --panel-bg: #f0f0f0;
}

/* Dark Theme Class */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --border-color: #f0f0f0;
    --panel-bg: #1a1a1a;
}

body {
    /*font-family: "Courier New", Courier, monospace;*/
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 16px;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden; /* Prevent global scroll */
    transition:
        background-color 0.3s,
        color 0.3s;
}

/* Custom Scrollbar - Webkit browsers (Chrome, Safari, Edge) */
.scroller::-webkit-scrollbar {
    width: 2px !important;
    height: 2px !important;
}

.scroller::-webkit-scrollbar-track {
    background: transparent !important;
}

.scroller::-webkit-scrollbar-thumb {
    background: var(--text-color) !important;
    border-radius: 3px;
}

.scroller::-webkit-scrollbar-thumb:hover {
    background: var(--text-color) !important;
}

/* Custom Scrollbar - Firefox */
.scroller {
    scrollbar-width: thin;
    /*scrollbar-color: var(--text-color) transparent;*/
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

/* Folder Tree Lines */
.tree-line {
    border-left: 1px dashed var(--border-color);
    transition: border-color 0.3s;
}

/* Utility for the dithering canvas */
canvas {
    image-rendering: pixelated;
    width: 100%;
    height: 100%;
    display: block;
}

/* Interaction quirks */
.hover-invert:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    cursor: pointer;
}

.hover-glow {
    cursor: pointer;
    transition: filter 0.2s ease;
}

.hover-glow:hover {
    filter: drop-shadow(0 0 6px var(--text-color));
}

.modal-enter {
    opacity: 0;
    transform: translateY(10px);
}
.modal-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.2s,
        transform 0.2s;
}

/* --- FIXED RANGE SLIDER STYLING --- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    margin: 8px 0;
}

input[type="range"]:focus {
    outline: none;
}

/* WebKit Track (Chrome/Safari/Edge) */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 2px;
    cursor: pointer;
    background: var(--text-color);
    border-radius: 0;
}

/* WebKit Thumb */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 12px;
    width: 12px;
    background: var(--bg-color);
    border: 1px solid var(--text-color);
    cursor: pointer;
    margin-top: -5px; /* Centers thumb on the 2px track */
}

/* Firefox Track */
input[type="range"]::-moz-range-track {
    width: 100%;
    height: 2px;
    cursor: pointer;
    background: var(--text-color);
    border-radius: 0;
}

/* Firefox Thumb */
input[type="range"]::-moz-range-thumb {
    height: 12px;
    width: 12px;
    background: var(--bg-color);
    border: 1px solid var(--text-color);
    cursor: pointer;
    border-radius: 0;
}

/* Color Input Styling */
input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    padding: 0;
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: none;
}

/* =============================================================================
   CUSTOM COLOR PICKER STYLES
   ============================================================================= */

.color-swatch {
    cursor: pointer;
    position: relative;
    outline: none;
}

.color-swatch:focus {
    outline: none;
}

/* Selected state indicator */
.color-swatch.selected::after {
    content: "×";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    color: var(--bg-color);
    mix-blend-mode: difference;
    pointer-events: none;
}

/* Hover state */
.color-swatch:hover {
    z-index: 10;
}

/* Dynamic Classes for JS usage */
.theme-bg {
    background-color: var(--bg-color);
}
.theme-border {
    border-color: var(--border-color);
}
.theme-text {
    color: var(--text-color);
}

/* =============================================================================
   MARKDOWN RENDERER STYLES
   ============================================================================= */

/* Container for rendered markdown */
.markdown-rendered {
    white-space: normal;
}

/* Headings */
.md-h1 {
    font-size: 1.35rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.md-h2 {
    font-size: 1.25rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.25rem 0 0.75rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px dashed var(--border-color);
}

.md-h3 {
    font-size: 1.15rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1rem 0 0.5rem 0;
}

.md-h4,
.md-h5,
.md-h6 {
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    margin: 0.75rem 0 0.5rem 0;
}

.md-h4::before {
    content: "// ";
    opacity: 0.5;
}
.md-h5::before {
    content: "/// ";
    opacity: 0.5;
}
.md-h6::before {
    content: "//// ";
    opacity: 0.5;
}

/* Paragraphs */
.md-p {
    margin: 0.75rem 0;
    line-height: 1.7;
}

/* Bold and Italic */
.md-bold {
    font-weight: bold;
}

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

.md-strike {
    text-decoration: line-through;
    opacity: 0.7;
}

.md-underline {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Images */
.md-image {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

/* Links */
.md-link {
    color: var(--text-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition:
        background-color 0.1s,
        color 0.1s;
}

.md-link:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* Inline Code */
.md-inline-code {
    font-family: "Courier New", Courier, monospace;
    background-color: var(--text-color);
    color: var(--bg-color);
    padding: 0.15rem 0.4rem;
    font-size: 0.9em;
}

/* Code Blocks */
.md-pre {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

[data-theme="dark"] .md-pre {
    background-color: rgba(255, 255, 255, 0.05);
}

.md-pre .md-code {
    font-family: "Courier New", Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
}

.md-pre .md-code::before {
    content: "/* " attr(data-lang) " */";
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.5;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Lists */
.md-ul,
.md-ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.md-ul {
    list-style: none;
}

.md-ul .md-li::before {
    /*content: "├── ";*/
    content: "> ";
    opacity: 0.6;
    margin-left: -1.5rem;
}

.md-ol {
    list-style: none;
    counter-reset: md-counter;
}

.md-ol .md-li {
    counter-increment: md-counter;
}

.md-ol .md-li::before {
    content: "[" counter(md-counter, decimal-leading-zero) "] ";
    opacity: 0.6;
    margin-left: -1.5rem;
}

.md-li {
    margin: 0.35rem 0;
    line-height: 1.6;
}

/* Blockquotes */
.md-blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.03);
    font-style: italic;
}

[data-theme="dark"] .md-blockquote {
    background-color: rgba(255, 255, 255, 0.03);
}

.md-blockquote::before {
    content: "> ";
    opacity: 0.5;
}

/* Horizontal Rule */
.md-hr {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 1.5rem 0;
}

.md-hr::after {
    content: "---";
    display: block;
    text-align: center;
    margin-top: -0.65rem;
    background-color: var(--bg-color);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    opacity: 0.4;
}

/* =============================================================================
   MOBILE STYLES
   ============================================================================= */

/*@media (max-width: 855px) {
    #viewer-title {
        max-width: 550px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}*/

@media (max-width: 768px) {
    #viewer-title {
        max-width: 300px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #params-drawer {
        display: none;
    }

    /* 50/50 split on mobile */
    body {
        flex-direction: column;
    }

    body > div:first-of-type {
        display: none !important;
    }

    /* Left panel (folder structure) */
    body > div:nth-of-type(2) {
        width: 100% !important;
        height: 50% !important;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    /* Right panel (dither blob) */
    #dither-panel {
        width: 100% !important;
        height: 50% !important;
    }

    /* Hide dither panel when file viewer is open */
    body.file-viewer-open #dither-panel {
        display: none !important;
    }

    /* Make folder panel full height when file viewer is open */
    body.file-viewer-open > div:nth-of-type(2) {
        height: 100% !important;
        border-bottom: none;
    }
}
