/* mujun.dev - terminal/brutalist developer documentation portal
   Catppuccin Mocha-inspired palette, JetBrains Mono + Inter typography. */

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

:root {
    --bg: #1e1e2e;
    --panel: #313244;
    --text: #cdd6f4;
    --link: #89b4fa;
    --green: #a6e3a1;
    --red: #f38ba8;
    --border: #45475a;
    --orange: #fab387;

    --font-display: 'JetBrains Mono', 'Space Mono', ui-monospace, Menlo, monospace;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-code: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
}

/* ----- App grid ----- */

.app {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

/* ----- Sidebar (terminal file tree) ----- */

.sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    font-family: var(--font-code);
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.18);
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
}
.dot-r { background: var(--red); }
.dot-y { background: var(--orange); }
.dot-g { background: var(--green); }

.sidebar-title {
    margin-left: 10px;
    color: var(--border);
    letter-spacing: 0.18em;
    font-size: 0.66rem;
    text-transform: uppercase;
}

.tree {
    padding: 12px 0;
    flex: 1 1 auto;
}

.tree-folder {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    cursor: pointer;
    color: var(--text);
    user-select: none;
    transition: background 120ms ease;
}

.tree-folder:hover {
    background: rgba(137, 180, 250, 0.06);
}

.caret {
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid var(--text);
    transition: transform 160ms ease;
    flex: none;
}

.tree-folder.open .caret {
    transform: rotate(90deg);
}

.folder-icon {
    width: 12px;
    height: 9px;
    background: var(--orange);
    border-radius: 1px 2px 0 0;
    position: relative;
    flex: none;
    opacity: 0.85;
}

.folder-icon::before {
    content: "";
    position: absolute;
    left: 0;
    top: -2px;
    width: 5px;
    height: 3px;
    background: var(--orange);
    border-radius: 1px 1px 0 0;
}

.folder-name {
    color: var(--text);
}

.tree-children {
    list-style: none;
    margin: 2px 0 8px 0;
    padding: 0 0 0 18px;
    border-left: 1px dashed var(--border);
    margin-left: 19px;
    overflow: hidden;
    max-height: 600px;
    transition: max-height 220ms ease;
}

.tree-children.collapsed {
    max-height: 0;
    margin-bottom: 0;
}

.tree-file {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    margin: 1px 0;
    cursor: pointer;
    color: var(--text);
    border-left: 2px solid transparent;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.tree-file:hover {
    background: rgba(137, 180, 250, 0.06);
    color: var(--link);
}

.tree-file.active {
    background: rgba(137, 180, 250, 0.10);
    border-left-color: var(--link);
    color: var(--link);
}

.file-icon {
    width: 8px;
    height: 10px;
    background: var(--border);
    position: relative;
    flex: none;
    border-radius: 1px;
}

.file-icon::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 3px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.file-path {
    font-size: 0.74rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
}

.status-key {
    color: var(--border);
}

.status-val {
    color: var(--green);
}

/* ----- Main content ----- */

.main {
    padding: 56px 64px 48px;
    max-width: 100%;
    overflow-x: hidden;
}

.hero {
    max-width: 720px;
    margin-bottom: 36px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 28px;
}

.prompt {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.01em;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.prompt-sigil {
    color: var(--green);
}

.prompt-text {
    color: var(--text);
}

.cursor {
    color: var(--link);
    animation: blink 1s steps(2, start) infinite;
    display: inline-block;
    margin-left: 2px;
}

.cursor-static {
    animation: blink 1s steps(2, start) infinite;
    margin-left: 4px;
}

@keyframes blink {
    50% { opacity: 0; }
}

.lede {
    margin-top: 18px;
    color: var(--text);
    opacity: 0.85;
    font-size: 0.95rem;
    line-height: 1.75;
    max-width: 680px;
}

.kanji {
    font-family: var(--font-display);
    color: var(--orange);
    font-weight: 700;
    margin-right: 2px;
}

.hero-meta {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-family: var(--font-code);
    font-size: 0.75rem;
    color: var(--border);
}

.meta-tag {
    color: var(--border);
}

/* ----- Breadcrumb ----- */

.breadcrumb {
    font-family: var(--font-code);
    font-size: 0.78rem;
    color: var(--border);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.crumb {
    color: var(--text);
    opacity: 0.7;
}

.crumb-active {
    color: var(--link);
    opacity: 1;
}

.crumb-sep {
    color: var(--border);
}

/* ----- Documents ----- */

.content {
    max-width: 720px;
}

.doc {
    animation: fadeIn 280ms ease;
}

.doc.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.doc-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 2.6vw, 1.85rem);
    line-height: 1.25;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.doc-title::before {
    content: "// ";
    color: var(--border);
    font-weight: 400;
}

.doc-meta {
    font-family: var(--font-code);
    font-size: 0.78rem;
    color: var(--border);
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border);
}

.annotation {
    color: var(--orange);
}

.doc-prose {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text);
    margin: 18px 0;
}

.doc-prose em {
    color: var(--orange);
    font-style: italic;
    opacity: 0.95;
}

.inline-code {
    font-family: var(--font-code);
    font-size: 0.85em;
    background: var(--panel);
    color: var(--green);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

/* ----- Diff blocks ----- */

.diff {
    background: var(--panel);
    border-radius: 6px;
    border-left: 3px solid var(--border);
    padding: 18px 0;
    margin: 22px 0;
    overflow-x: auto;
    font-family: var(--font-code);
    font-size: 0.85rem;
    line-height: 1.6;
    position: relative;
}

.diff::before {
    content: attr(data-lang);
    position: absolute;
    top: 6px;
    right: 12px;
    font-size: 0.65rem;
    color: var(--border);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    pointer-events: none;
}

.diff code {
    display: block;
    padding: 0 18px 0 0;
    font-family: inherit;
    font-size: inherit;
    color: var(--text);
}

.diff .ln {
    display: inline-block;
    width: 36px;
    color: var(--border);
    text-align: right;
    padding-right: 14px;
    user-select: none;
    border-right: 1px solid var(--border);
    margin-right: 14px;
}

.diff-add,
.diff-rem {
    display: inline;
    padding: 1px 6px;
    border-radius: 2px;
}

.diff-add {
    color: var(--green);
}

.diff-add::before {
    content: "+ ";
    color: var(--green);
    font-weight: 700;
}

.diff-rem {
    color: var(--red);
}

.diff-rem::before {
    content: "- ";
    color: var(--red);
    font-weight: 700;
}

/* line backgrounds via the surrounding pre — subtle */
.diff code > .diff-add { background: rgba(166, 227, 161, 0.06); }
.diff code > .diff-rem { background: rgba(243, 139, 168, 0.06); }

/* ----- Callouts ----- */

.callout {
    margin: 22px 0;
    padding: 14px 18px;
    background: rgba(250, 179, 135, 0.08);
    border-left: 3px solid var(--orange);
    border-radius: 4px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 0.9rem;
    line-height: 1.7;
}

.callout-tag {
    font-family: var(--font-code);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--orange);
    background: rgba(250, 179, 135, 0.14);
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.12em;
    flex: none;
    margin-top: 2px;
}

.callout p {
    margin: 0;
    color: var(--text);
    opacity: 0.92;
}

.callout em {
    color: var(--orange);
    font-style: italic;
}

/* ----- Terminal footer ----- */

.terminal-footer {
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px dashed var(--border);
    max-width: 720px;
    font-family: var(--font-code);
    font-size: 0.82rem;
    color: var(--text);
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.terminal-line .prompt-sigil {
    color: var(--green);
    font-weight: 700;
}

.cmd {
    color: var(--text);
}

.log-output {
    margin: 8px 0;
    color: var(--border);
    font-size: 0.78rem;
    line-height: 1.7;
    white-space: pre-wrap;
    min-height: 130px;
    padding-left: 18px;
    border-left: 1px solid var(--border);
}

.log-output .hash {
    color: var(--orange);
}

.log-output .branch {
    color: var(--green);
}

.log-output .author {
    color: var(--link);
}

.copyright {
    margin-top: 18px;
    color: var(--border);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

/* ----- Responsive ----- */

@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        max-height: 280px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .main {
        padding: 36px 24px 32px;
    }

    .hero-meta {
        gap: 10px;
    }
}

@media (max-width: 540px) {
    .main {
        padding: 28px 18px 24px;
    }

    .diff .ln {
        width: 28px;
        padding-right: 10px;
        margin-right: 10px;
    }

    .doc-title {
        font-size: 1.4rem;
    }
}
