@layer base, utils, components;

/* Base WebTUI */
@import 'https://cdn.jsdelivr.net/npm/@webtui/css@0.1.9/dist/base.css';

/* Utils */
@import 'https://cdn.jsdelivr.net/npm/@webtui/css@0.1.9/dist/utils/box.css';

/* Components */
@import 'https://cdn.jsdelivr.net/npm/@webtui/css@0.1.9/dist/components/input.css';
@import 'https://cdn.jsdelivr.net/npm/@webtui/css@0.1.9/dist/components/mark.css';
@import 'https://cdn.jsdelivr.net/npm/@webtui/css@0.1.9/dist/components/pre.css';
@import 'https://cdn.jsdelivr.net/npm/@webtui/css@0.1.9/dist/components/typography.css';

/* Font Declarations */
@font-face {
    font-family: 'NerdFontSymbolsMono';
    src: url('../fonts/SymbolsNerdFontMono-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'AgaveMono';
    src: url('../fonts/AgaveNerdFontMono-Regular.ttf') format('truetype');
}

/* CSS */
@layer base {
    :root {
        /* Font Configuration: */
        --font-size: 18px;
        --font-family: 'AgaveMono', 'NerdFontSymbolsMono', monospace;

        /* Color Configuration: */
        --background0: #2d353b; /* Background 0 */
        --background1: #475258; /* Background 3 */

        --foreground0: #d3c6aa; /* Foreground */
        --foreground1: #9da9a0; /* Grey 2 */

        --comments: #7a8478; /* Grey 0 */

        --errors: #e67e80; /* Red */
        --numbers: #d699b6; /* Purple */
        --parameters: #e69875; /* Orange */
        --strings: #a7c080; /* Green */
        --links: #7fbbb3; /* Blue */
        --regex: #a7c080; /* Green */
        --functions: #83c092; /* Aqua */
        --headings: #dbbc7f; /* Yellow */
        --properties: #e69875; /* Orange */
        --attributes: #d699b6; /* Purple */

        --box-border-color: var(--background1);
    }

    body {
        width: 100%;
        min-height: 100vh;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .header {
        display: flex;
        justify-content: space-between;
    }
    span {
        background-color: var(--background0);
        padding: 0 1ch;
    }
}

@layer utils {
    column,
    row {
        display: flex;
    }

    column[self-='grow'],
    row[self-='grow'] {
        flex-grow: 1;
    }

    column:is(column) {
        flex-direction: column;
    }

    row[gap-='1'] {
        gap: 1lh 1ch;
    }

    [align-='center'] { align-items: center; }
    [align-='stretch'] { align-items: stretch; }
    [justify-='center'] { justify-content: center; }
    [justify-='between'] { justify-content: between; }
}

@layer components {
    
    mark,
    [is-='mark'] {
        &[fg-='errors'] {
            color: var(--errors)
        }
        &[fg-='numbers'] {
            color: var(--numbers)
        }
        &[fg-='parameters'] {
            color: var(--parameters)
        }
        &[fg-='strings'] {
            color: var(--strings)
        }
        &[fg-='links'] {
            color: var(--links)
        }
        &[fg-='regex'] {
            color: var(--regex)
        }
        &[fg-='functions'] {
            color: var(--functions)
        }
        &[fg-='headings'] {
            color: var(--headings)
        }
        &[fg-='properties'] {
            color: var(--properties)
        }
        &[fg-='attributes'] {
            color: var(--attributes)
        }
    }
}

input {
    background-color: var(--background0);
}

/* Navbar CSS */
#nav-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 0 1ch;
}

#box-header {
    color: var(--comments);
}

/* Sidebar CSS */
#sidebar-container {
    display: flex;
    max-width: 32ch;
    width: 100%;
}

#sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-grow: 1;
}

#sidebar-content {
    padding: 0 1ch;
}

#sidebar-content label {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

#my-pre {
    --font-size: 12px;
    --pre-background: var(--background0);
}

.row {
    display: flex;
}

#input-row {
    display: flex;
}
