/*
 *******************************************************************************
 * Project: Portfolio Website  -  IntelliJ "New UI" dark theme shell
 *
 * Author: Collin Turner
 * =============================================================================
 * (c) Copyright 2025 CollinDTurner All rights reserved.
 *******************************************************************************
*/

:root {
    /* chrome */
    --ide-bg:            #1e1f22;
    --ide-bg-panel:      #2b2d30;
    --ide-bg-editor:     #1e1f22;
    --ide-border:        #303236;
    --ide-border-strong: #1e1f22;

    /* text */
    --ide-fg:        #dfe1e5;
    --ide-fg-dim:    #9da0a8;
    --ide-fg-faint:  #6f737a;
    --ide-fg-editor: #bcbec4;

    /* interaction */
    --ide-hover:        #35373b;
    --ide-selected:     #2e436e;   /* focused selection (blue) */
    --ide-selected-dim: #3a3d41;   /* unfocused selection (grey) */
    --ide-accent:       #3574f0;   /* primary blue */
    --ide-run:          #5fb865;   /* run green */
    --ide-modified:     #e8a33d;

    /* editor syntax */
    --syn-comment:  #7a7e85;
    --syn-keyword:  #cf8e6d;
    --syn-string:   #6aab73;
    --syn-number:   #2aacb8;
    --syn-key:      #c77dbb;
    --syn-punct:    #bcbec4;
    --syn-tag:      #67a37c;
    --syn-func:     #56a8f5;

    /* scrollbar */
    --ide-scroll: #4b4d51;

    --ui-font:   "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
    --mono-font: "JetBrains Mono", "SF Mono", "Consolas", "Liberation Mono", monospace;

    --toolbar-h: 40px;
    --stripe-w:  32px;
    --tabs-h:    35px;
    --status-h:  24px;
    --gutter-w:  52px;
    --project-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--ide-bg);
    color: var(--ide-fg);
    font-family: var(--ui-font);
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input  { font-family: inherit; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--ide-scroll); border: 3px solid transparent; background-clip: content-box; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #5c5f66; background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ============================================================ layout */
.ide {
    display: grid;
    grid-template-rows: var(--toolbar-h) 1fr var(--status-h);
    height: 100vh;
}

/* ============================================================ toolbar */
.ide-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    background: var(--ide-bg-panel);
    border-bottom: 1px solid var(--ide-border-strong);
    -webkit-user-select: none;
    user-select: none;
}
.tb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--ide-fg-dim);
    font-size: 15px;
}
.tb-btn:hover { background: var(--ide-hover); color: var(--ide-fg); }
.tb-run { color: var(--ide-run); }
.tb-run:hover { background: rgba(95, 184, 101, 0.15); }
.tb-project { font-weight: 600; letter-spacing: .2px; }
.tb-vcs {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--ide-fg-dim);
}
.tb-vcs:hover { background: var(--ide-hover); }
.tb-vcs svg { width: 14px; height: 14px; fill: currentColor; }
.tb-spacer { flex: 1; }
.tb-search {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 200px;
    height: 26px;
    padding: 0 9px;
    border: 1px solid var(--ide-border);
    border-radius: 6px;
    background: var(--ide-bg);
    color: var(--ide-fg-faint);
}
.tb-search:focus-within { border-color: var(--ide-accent); }
.tb-search svg { width: 13px; height: 13px; fill: currentColor; flex: none; }
.tb-search input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--ide-fg);
    font-size: 12.5px;
}
.tb-search input::placeholder { color: var(--ide-fg-faint); }

/* ============================================================ body */
.ide-body {
    display: flex;
    min-height: 0;
    background: var(--ide-bg);
}

/* left tool-window stripe */
.ide-stripe {
    width: var(--stripe-w);
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 0;
    background: var(--ide-bg-panel);
    border-right: 1px solid var(--ide-border-strong);
    -webkit-user-select: none;
    user-select: none;
}
.stripe-btn {
    writing-mode: vertical-rl;
    padding: 10px 0;
    margin: 2px 3px;
    border-radius: 5px;
    font-size: 11.5px;
    letter-spacing: .3px;
    color: var(--ide-fg-dim);
}
.stripe-btn:hover:not(:disabled) { background: var(--ide-hover); color: var(--ide-fg); }
.stripe-btn.active { background: var(--ide-selected-dim); color: var(--ide-fg); }
.stripe-btn:disabled { opacity: .45; cursor: default; }
.stripe-spacer { flex: 1; }

/* project tool window */
.ide-project {
    width: var(--project-width);
    flex: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--ide-bg);
    border-right: 1px solid var(--ide-border);
}
body.project-collapsed .ide-project,
body.project-collapsed .ide-resizer { display: none; }

.panel-header {
    display: flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--ide-fg-dim);
    -webkit-user-select: none;
    user-select: none;
}
.panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 4px 0 12px;
}

/* resizer */
.ide-resizer {
    width: 5px;
    flex: none;
    margin-left: -3px;
    cursor: col-resize;
    z-index: 5;
}
.ide-resizer:hover, .ide-resizer.dragging { background: var(--ide-accent); opacity: .4; }

/* ============================================================ tree */
.tree, .tree ul { list-style: none; }
.tree-row {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding-right: 10px;
    white-space: nowrap;
    font-size: 13px;
    color: var(--ide-fg);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.tree-row:hover { background: var(--ide-hover); }
.tree-file.selected > .tree-row { background: var(--ide-selected); }

.tree-chevron {
    width: 12px;
    height: 12px;
    flex: none;
    position: relative;
    color: var(--ide-fg-dim);
}
.tree-folder > .tree-row .tree-chevron::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    border: 4px solid transparent;
    border-left-color: currentColor;
    transition: transform .12s ease;
}
.tree-folder:not(.collapsed) > .tree-row .tree-chevron::before {
    transform: rotate(45deg);
    top: 4px;
    left: 1px;
}
.tree-folder.collapsed > .tree-children { display: none; }

.tree-icon {
    width: 16px;
    height: 16px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font: 700 9px/1 var(--mono-font);
    color: #1e1f22;
}
.tree-icon.icon-folder,
.tree-icon.icon-module {
    background: none;
    color: #a9b0bb;
}
.tree-icon.icon-folder::before,
.tree-icon.icon-module::before {
    content: "";
    width: 15px;
    height: 12px;
    background: currentColor;
    -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3.5h4l1.2 1.5h7.8a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-13a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
    mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3.5h4l1.2 1.5h7.8a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-13a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
}
.tree-icon.icon-module::before { opacity: .9; }
.tree-icon.icon-md   { background: #4a88c7; }
.tree-icon.icon-md::after   { content: "M"; }
.tree-icon.icon-json { background: #e8a33d; }
.tree-icon.icon-json::after { content: "{}"; font-size: 8px; }
.tree-icon.icon-html { background: #e37933; }
.tree-icon.icon-html::after { content: "<>"; font-size: 8px; }
.tree-icon.icon-java { background: #e76f00; }
.tree-icon.icon-java::after { content: "J"; }
.tree-icon.icon-txt  { background: #8b9099; }
.tree-icon.icon-txt::after  { content: "T"; }

/* ============================================================ editor */
.ide-editor {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--ide-bg-editor);
}

/* tab bar */
.editor-tabs {
    display: flex;
    align-items: stretch;
    height: var(--tabs-h);
    flex: none;
    background: var(--ide-bg-panel);
    border-bottom: 1px solid var(--ide-border-strong);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-user-select: none;
    user-select: none;
}
.editor-tabs::-webkit-scrollbar { height: 0; }

.tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 8px 0 12px;
    max-width: 220px;
    border-right: 1px solid var(--ide-border-strong);
    color: var(--ide-fg-dim);
    font-size: 12.5px;
    white-space: nowrap;
    position: relative;
    cursor: pointer;
}
.tab:hover { background: var(--ide-hover); }
.tab.active {
    background: var(--ide-bg-editor);
    color: var(--ide-fg);
}
.tab.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--ide-accent);
}
.tab.drag-over-left::before,
.tab.drag-over-right::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: var(--ide-accent);
}
.tab.drag-over-left::before  { left: -1px; }
.tab.drag-over-right::before { right: -1px; }
.tab.dragging { opacity: .4; }

.tab .tree-icon { width: 15px; height: 15px; }
.tab-label { overflow: hidden; text-overflow: ellipsis; }
.tab-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex: none;
    color: var(--ide-fg-faint);
    font-size: 14px;
    line-height: 1;
    visibility: hidden;
}
.tab:hover .tab-close,
.tab.active .tab-close { visibility: visible; }
.tab.modified .tab-close::before { content: "\2022"; }        /* dot */
.tab-close::before { content: "\00d7"; }
.tab.modified:hover .tab-close::before,
.tab.modified .tab-close:hover::before { content: "\00d7"; }
.tab-close:hover { background: var(--ide-hover); color: var(--ide-fg); }

/* editor content + gutter */
.editor-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    position: relative;
}
.editor-scroll {
    position: relative;
    min-height: 100%;
}
.gutter {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: var(--gutter-w);
    padding-top: 14px;
    text-align: right;
    font: 400 13px/21px var(--mono-font);
    color: #4b5059;
    background: var(--ide-bg-editor);
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}
.gutter span { display: block; padding-right: 14px; }
.gutter.hidden { display: none; }

.editor-panes { margin-left: var(--gutter-w); min-height: 200px; }
.editor-doc[hidden] { display: none; }

/* ============================================================ document styling */
.doc {
    max-width: 860px;
    padding: 14px 48px 80px 20px;
    font-size: 13.5px;
    line-height: 21px;
    color: var(--ide-fg-editor);
}
.doc-loading, .doc-error { padding: 20px; color: var(--ide-fg-faint); font-family: var(--mono-font); }
.doc-error { color: #e2696b; }

.doc h1, .doc h2, .doc h3 { font-weight: 600; color: var(--ide-fg); line-height: 1.35; }
.doc h1 { font-size: 24px; margin: 6px 0 14px; }
.doc h2 { font-size: 18px; margin: 30px 0 10px; }
.doc h3 { font-size: 15px; margin: 20px 0 6px; }
.doc p  { margin: 10px 0; }
.doc ul, .doc ol { margin: 10px 0 10px 22px; }
.doc li { margin: 4px 0; }
.doc a { color: var(--syn-func); text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc strong { color: var(--ide-fg); font-weight: 600; }
.doc hr { border: 0; border-top: 1px solid var(--ide-border); margin: 24px 0; }
.doc code {
    font-family: var(--mono-font);
    font-size: 12px;
    background: #2b2d30;
    border: 1px solid var(--ide-border);
    border-radius: 4px;
    padding: 1px 5px;
}
.doc pre {
    font-family: var(--mono-font);
    font-size: 12.5px;
    line-height: 20px;
    background: #26282e;
    border: 1px solid var(--ide-border);
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 12px 0;
}
.doc pre code { background: none; border: 0; padding: 0; }
.doc blockquote {
    border-left: 3px solid var(--ide-border);
    padding-left: 14px;
    color: var(--ide-fg-dim);
    margin: 12px 0;
}

/* markdown "source" flavour: prefix headings with # like the raw file */
.doc-md h1::before,
.doc-md h2::before,
.doc-md h3::before {
    color: var(--syn-comment);
    font-weight: 400;
    font-family: var(--mono-font);
}
.doc-md h1::before { content: "# "; }
.doc-md h2::before { content: "## "; }
.doc-md h3::before { content: "### "; }

.doc-md .frontmatter {
    font-family: var(--mono-font);
    font-size: 12px;
    color: var(--syn-comment);
    border-left: 2px solid var(--ide-border);
    padding: 2px 0 2px 12px;
    margin-bottom: 18px;
    white-space: pre-wrap;
}
.doc-md .tag {
    display: inline-block;
    font-family: var(--mono-font);
    font-size: 11.5px;
    color: var(--syn-string);
    background: rgba(106, 171, 115, .1);
    border: 1px solid rgba(106, 171, 115, .25);
    border-radius: 4px;
    padding: 1px 7px;
    margin: 2px 4px 2px 0;
}

/* json "file" */
.doc-json pre { background: var(--ide-bg-editor); border: 0; padding: 0; font-size: 13px; line-height: 21px; }
.doc-json .k { color: var(--syn-key); }
.doc-json .s { color: var(--syn-string); }
.doc-json .n { color: var(--syn-number); }
.doc-json .b { color: var(--syn-keyword); }
.doc-json .p { color: var(--syn-punct); }
.doc-json .c { color: var(--syn-comment); }

.doc .headshot {
    float: right;
    width: 132px;
    height: 132px;
    border-radius: 8px;
    margin: 4px 0 12px 20px;
    object-fit: cover;
    border: 1px solid var(--ide-border);
}
.doc .kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 14px 0; }
.doc .kv dt { color: var(--syn-key); font-family: var(--mono-font); font-size: 12.5px; }
.doc .kv dd { color: var(--ide-fg-editor); }

.doc .timeline { border-left: 2px solid var(--ide-border); margin: 16px 0; padding-left: 20px; }
.doc .timeline .role { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.doc .timeline .when { color: var(--ide-fg-faint); font-family: var(--mono-font); font-size: 12px; white-space: nowrap; }

.doc .links { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.doc .links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--ide-border);
    border-radius: 8px;
    color: var(--ide-fg);
}
.doc .links a:hover { border-color: var(--ide-accent); background: var(--ide-hover); text-decoration: none; }
.doc .links svg { width: 16px; height: 16px; fill: currentColor; }

/* style-guide fragment (reused from the standalone page) */
.doc .sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.doc .sg-swatch { border: 1px solid var(--ide-border); border-radius: 6px; overflow: hidden; font-family: var(--mono-font); font-size: 11px; }
.doc .sg-swatch .chip { height: 54px; }
.doc .sg-swatch .meta { padding: 6px 8px; color: var(--ide-fg-dim); }

/* ============================================================ welcome */
.welcome {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}
.welcome[hidden] { display: none; }
.welcome-inner { max-width: 420px; }
.welcome-logo {
    font-family: var(--mono-font);
    font-size: 40px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--ide-fg);
}
.welcome-logo::after { content: "_"; color: var(--ide-accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.welcome-sub { margin-top: 8px; color: var(--ide-fg-dim); }
.welcome-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 26px 0 18px; }
.welcome-links button {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--ide-border);
    border-radius: 7px;
    color: var(--ide-fg);
    font-family: var(--mono-font);
    font-size: 12px;
}
.welcome-links button:hover { border-color: var(--ide-accent); background: var(--ide-hover); }
.welcome-hint { color: var(--ide-fg-faint); font-size: 12px; }

/* ============================================================ status bar */
.ide-status {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 12px;
    background: var(--ide-bg-panel);
    border-top: 1px solid var(--ide-border-strong);
    color: var(--ide-fg-dim);
    font-size: 11.5px;
    -webkit-user-select: none;
    user-select: none;
}
.ide-status .st-spacer { flex: 1; }
.ide-status svg { width: 12px; height: 12px; fill: currentColor; vertical-align: -2px; margin-right: 4px; }
.ide-status .st-item { white-space: nowrap; }
.ide-status .st-item:hover { color: var(--ide-fg); }

@media (max-width: 720px) {
    :root { --project-width: 200px; }
    .tb-search { width: 130px; }
    .tb-project { display: none; }
}
