/* =========================================================================
   TERMINAL PORTFOLIO — styles
   Dark, green-on-black "phosphor" terminal look. No dependencies.
   ========================================================================= */

:root {
    --page-bg: #070a08;
    --term-bg: #000000;
    --header-bg: #101512;
    --header-border: #1d2a20;
    --fg: #b8ffc9;
    --green: #4af626;
    --cyan: #5fe8ff;
    --yellow: #ffd75f;
    --red: #ff6b6b;
    --blue: #6aa8ff;
    --dim: #4c6b55;
    --font: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas,
            'Courier New', monospace;
}

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

html,
body {
    height: 100%;
}

body {
    background:
        radial-gradient(ellipse at 50% -20%, rgba(74, 246, 38, 0.08), transparent 60%),
        var(--page-bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- window */
.terminal {
    /* grow with the browser window — no fixed width/height caps */
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    min-width: 0;
    min-height: 360px;
    background: var(--term-bg);
    border: 1px solid var(--header-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 24px 60px rgba(0, 0, 0, 0.65),
        0 0 40px rgba(74, 246, 38, 0.06);
}

/* ---------------------------------------------------------------- header */
.terminal-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(var(--header-bg), #0b0e0c);
    border-bottom: 1px solid var(--header-border);
}

.traffic-lights {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.light-red { background: #ff5f57; }
.light-yellow { background: #febc2e; }
.light-green { background: #28c840; }

.terminal-title {
    flex: 1;
    text-align: center;
    color: var(--dim);
    font-size: 12.5px;
    letter-spacing: 0.4px;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- tabs */
.tab-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 8px 12px 0;
    background: linear-gradient(#0b0e0c, #0a0d0b);
    border-bottom: 1px solid var(--header-border);
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    background: #0d120f;
    border: 1px solid var(--header-border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: var(--dim);
    font-size: 12.5px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    max-width: 200px;
    transition: color 0.12s, background 0.12s;
}

.tab:hover { color: var(--fg); }

.tab.active {
    background: #0a0f0c;
    color: var(--green);
    border-color: #2a4a33;
}

.tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-close {
    flex: 0 0 auto;
    color: var(--dim);
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 3px;
}

.tab-close:hover {
    color: var(--red);
    background: rgba(255, 107, 107, 0.12);
}

.tab-add {
    align-self: center;
    padding: 0 8px 4px;
    color: var(--dim);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

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

/* ---------------------------------------------------------------- body */
.terminal-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* each terminal tab / session is a fixed column: the output area scrolls on
   its own (a "sub-scroll") while the prompt line stays pinned at the bottom */
.session-pane {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 18px;
}

/* subtle CRT scanlines */
.terminal-body::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.015) 0,
        rgba(255, 255, 255, 0.015) 1px,
        transparent 1px,
        transparent 3px
    );
}

.terminal-body {
    position: relative;
}

.output {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.output-line {
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 1.1em;
}

/* ---------------------------------------------------------------- prompt */
.prompt-text {
    white-space: pre;
}

.p-user { color: var(--green); font-weight: 700; }
.p-host { color: var(--cyan); }
.p-at, .p-colon { color: var(--dim); }
.p-path { color: var(--blue); font-weight: 600; }
.p-dollar { color: var(--fg); }

.input-line {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 2px;
    padding-bottom: 4px;
}

.input-line input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    caret-color: var(--green);
}

/* ---------------------------------------------------------------- colors */
.c-cyan { color: var(--cyan); }
.c-green { color: var(--green); }
.c-yellow { color: var(--yellow); }
.c-red { color: var(--red); }
.c-blue { color: var(--blue); }
.c-dim { color: var(--dim); }
.c-bold { font-weight: 700; }
.c-underline { text-decoration: underline; }
.c-italic { font-style: italic; }

/* ---------------------------------------------------------------- markdown */
.md-h { margin: 0; }
.md-h1 { color: var(--green); font-weight: 800; font-size: 1.22em; }
.md-h2 { color: var(--cyan);  font-weight: 700; }
.md-h3 { color: var(--blue);  font-weight: 700; }
.md-h4, .md-h5, .md-h6 { color: var(--yellow); font-weight: 600; }
.md-li { padding-left: 0.4em; }
.md-quote {
    color: var(--dim);
    font-style: italic;
    border-left: 2px solid var(--dim);
    padding-left: 10px;
    margin: 2px 0;
}
.md-hr {
    border: none;
    border-top: 1px solid var(--dim);
    margin: 8px 0;
}
.md-code {
    color: var(--yellow);
    background: rgba(255, 215, 95, 0.08);
    padding: 0 5px;
    border-radius: 3px;
    font-family: var(--font);
}
.c-link {
    color: var(--blue);
    text-decoration: underline;
    cursor: pointer;
}
.c-link:hover { color: var(--cyan); }
/* folders keep their cyan look even though they are links too */
.c-link.c-cyan { color: var(--cyan); }
.md-img {
    display: block;
    max-width: 100%;
    max-height: 340px;
    margin: 8px 0;
    border: 1px solid var(--header-border);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

::selection {
    background: var(--green);
    color: #000;
}

/* ---------------------------------------------------------------- scrollbar */
.output::-webkit-scrollbar {
    width: 10px;
}

.output::-webkit-scrollbar-track {
    background: #000;
}

.output::-webkit-scrollbar-thumb {
    background: #1d2a20;
    border-radius: 6px;
    border: 2px solid #000;
}

.output::-webkit-scrollbar-thumb:hover {
    background: #2c4433;
}

/* ---------------------------------------------------------------- Jupyter notebook */
/* Projects registered with a `notebook` array are rendered by `cat <file>.ipynb`
   as a Jupyter notebook in a browser (light nbconvert theme inside the dark
   terminal). */

.nb {
    background: #ffffff;
    color: #1f1f1f;
    border: 1px solid #cfcfcf;
    border-radius: 8px;
    overflow: hidden;
    white-space: normal;
    word-break: normal;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.55;
    margin: 6px 0;
}

.nb-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 7px 14px;
    background: #f7f7f7;
    border-bottom: 1px solid #dcdcdc;
}

.nb-name {
    font-weight: 700;
    color: #2b2b2b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nb-menus {
    flex: 1;
    color: #8a8a8a;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
}

.nb-kernel {
    color: #555;
    font-size: 12px;
    background: #e9e9e9;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
}

.nb-body {
    padding: 14px 14px 4px;
    background: #ffffff;
}

.nb-cell {
    margin-bottom: 12px;
}

.nb-cell.nb-code {
    background: #f7f7f7;
    border: 1px solid #cfcfcf;
    border-radius: 3px;
    overflow: hidden;
}

.nb-row {
    display: flex;
    align-items: stretch;
}

.nb-prompt {
    flex: 0 0 4.6em;
    min-width: 4.6em;
    padding: 6px 10px 6px 12px;
    text-align: right;
    font-family: 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-size: 12px;
    color: #303f9f;
    background: #f7f7f7;
    user-select: none;
    white-space: nowrap;
}

.nb-prompt-out {
    color: #d84315;
}

.nb-source {
    flex: 1;
    min-width: 0;
    padding: 6px 12px;
    background: #ffffff;
    font-family: 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre;
    word-break: normal;
    overflow-x: auto;
    color: #111;
}

.nb-output-row {
    border-top: 1px solid #e2e2e2;
}

.nb-output {
    flex: 1;
    min-width: 0;
    padding: 6px 12px;
    background: #ffffff;
    font-family: 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-size: 12.5px;
    line-height: 1.5;
    color: #111;
}

.nb-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: #111;
    font-family: inherit;
}

.nb-err {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: #b00000;
    font-family: inherit;
}

.nb-html {
    color: #111;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    line-height: 1.4;
}

.nb-img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    margin: 2px 0;
}

/* ---- notebook Markdown cells ---- */
.nb-md {
    padding: 2px 4px;
    color: #333;
}

.nb-p { margin: 0 0 8px; }
.nb-h { font-weight: 700; margin: 14px 0 6px; line-height: 1.3; color: #1a5fb4; }
.nb-h1 { font-size: 1.4em; }
.nb-h2 { font-size: 1.22em; }
.nb-h3 { font-size: 1.08em; }
.nb-h4, .nb-h5, .nb-h6 { font-size: 1em; }
.nb-quote {
    border-left: 3px solid #c9c9c9;
    padding-left: 10px;
    margin: 0 0 8px;
    color: #666;
}
.nb-ul, .nb-ol { margin: 0 0 8px; padding-left: 1.7em; }
.nb-ul li, .nb-ol li { margin: 2px 0; }
.nb-hr { border: none; border-top: 1px solid #d8d8d8; margin: 10px 0; }
.nb-code {
    background: #ececec;
    color: #b50000;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-size: 12px;
}
.nb-link { color: #1a5fb4; text-decoration: underline; }
.nb-link:hover { color: #0b3a70; }
.nb-codeblock {
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 8px 10px;
    margin: 0 0 8px;
    overflow-x: auto;
    white-space: pre;
    font-family: 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-size: 12px;
    color: #111;
}

/* ---- Python syntax colours (Jupyter's CodeMirror theme) ---- */
.nb-tok-kw { color: #008000; font-weight: 700; }
.nb-tok-blt { color: #0086d2; }
.nb-tok-def { color: #0000ff; }
.nb-tok-str { color: #ba2121; }
.nb-tok-num { color: #080; }
.nb-tok-com { color: #408080; font-style: italic; }
.nb-tok-dec { color: #aa22ff; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 640px) {
    body {
        padding: 0;
    }

    .terminal {
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        border: none;
    }

    body,
    .input-line input {
        font-size: 14px;
    }
}
