/* ============================================================
   tokens
   ============================================================ */
:root {
    --page-bg: #050507;
    --window-bg: #0e0f12;
    --window-bg-soft: #131418;
    --titlebar-bg: #1c1d22;
    --titlebar-border: #2a2b30;
    --rule: #23242a;
    --rule-soft: #1b1c21;

    --text: #ececee;
    --text-dim: #8a8a92;
    --text-fade: #5a5a62;

    --green: #02e35c;
    --green-bright: #5fff8c;
    --green-soft: rgba(2, 227, 92, 0.12);

    --accent: #5cccff;
    --user: #5cccff;
    --host: #02e35c;
    --path: #c79bff;

    --tag-bg: rgba(2, 227, 92, 0.07);
    --tag-border: rgba(2, 227, 92, 0.32);

    --shadow-window: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.02);
    --font-mono: 'Menlo', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
}

/* ============================================================
   themes - overrides for the variables above
   activated by body classes set by JS (theme command)
   ============================================================ */
body.theme-amber {
    --green: #ffb000;
    --green-bright: #ffd75f;
    --green-soft: rgba(255, 176, 0, 0.12);
    --accent: #ffb000;
    --user: #ffb000;
    --host: #ffd75f;
    --path: #ffcc66;
    --text: #ffd97a;
    --text-dim: #b08540;
    --tag-bg: rgba(255, 176, 0, 0.08);
    --tag-border: rgba(255, 176, 0, 0.32);
}
/* subtle CRT scanlines for amber */
body.theme-amber::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.08) 0px,
        rgba(0, 0, 0, 0.08) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 1;
    mix-blend-mode: multiply;
}

body.theme-mono {
    --green: #e6e6e6;
    --green-bright: #ffffff;
    --green-soft: rgba(230, 230, 230, 0.1);
    --accent: #cccccc;
    --user: #ffffff;
    --host: #e6e6e6;
    --path: #b0b0b0;
    --text: #f0f0f0;
    --text-dim: #808080;
    --tag-bg: rgba(255, 255, 255, 0.05);
    --tag-border: rgba(255, 255, 255, 0.2);
}

body.theme-solarized {
    --page-bg: #fdf6e3;
    --window-bg: #eee8d5;
    --window-bg-soft: #e4ddc8;
    --titlebar-bg: #93a1a1;
    --titlebar-border: #93a1a1;
    --rule: #93a1a1;
    --rule-soft: #b8c2c2;

    --green: #859900;
    --green-bright: #b58900;
    --green-soft: rgba(133, 153, 0, 0.15);
    --accent: #268bd2;
    --user: #268bd2;
    --host: #2aa198;
    --path: #d33682;
    --text: #586e75;
    --text-dim: #93a1a1;
    --text-fade: #93a1a1;

    --tag-bg: rgba(38, 139, 210, 0.08);
    --tag-border: rgba(38, 139, 210, 0.3);

    --shadow-window: 0 24px 70px rgba(101, 123, 131, 0.25), 0 0 0 1px rgba(101, 123, 131, 0.05);
}

/* ============================================================
   reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    background: var(--page-bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(2, 227, 92, 0.05), transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 100%, rgba(92, 204, 255, 0.04), transparent 60%);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 17px;
    line-height: 1.65;
    min-height: 100vh;
    padding: 4vh 3vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   window chrome (the actual terminal frame)
   ============================================================ */
.window {
    max-width: min(94vw, 1800px);
    margin: 0 auto;
    background: var(--window-bg);
    border: 1px solid var(--titlebar-border);
    border-radius: 12px;
    box-shadow: var(--shadow-window);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 86vh;
    animation: windowIn 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes windowIn {
    from { opacity: 0; transform: translateY(10px) scale(0.995); }
    to   { opacity: 1; transform: none; }
}

.titlebar {
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, #25262c 0%, #1c1d22 100%);
    border-bottom: 1px solid var(--titlebar-border);
    padding: 0.55em 0.95em;
    user-select: none;
    position: relative;
}

.traffic-lights {
    display: flex;
    gap: 0.5em;
    align-items: center;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3a3a40;
    box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.4);
}

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

.titlebar-title {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.82em;
    pointer-events: none;
    letter-spacing: 0.01em;
}

/* ============================================================
   terminal content area
   ============================================================ */
.terminal {
    padding: 1.6em 2em 1.8em;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.terminal > footer {
    margin-top: auto;
}

/* ---------- prompts ---------- */
.prompt, .input-line {
    margin: 1.1em 0 0.25em;
    color: var(--text);
    word-break: break-word;
}

.prompt:first-of-type,
.input-line:first-child,
.terminal > .input-line:first-of-type {
    margin-top: 0.2em;
}

/* prompt coloring — same rules apply to the echo line (.input-line)
   AND the live input row (.input-row), so colors don't shift on Enter */
.prompt .user,    .input-line .user,    .input-row .user    { color: var(--user); }
.prompt .at,      .input-line .at,      .input-row .at      { color: var(--text-dim); }
.prompt .host,    .input-line .host,    .input-row .host    { color: var(--host); }
.prompt .path,    .input-line .path,    .input-row .path    { color: var(--path); }
.prompt .sigil,   .input-line .sigil,   .input-row .sigil   { color: var(--text-dim); }
.prompt .cmd,     .input-line .cmd,     .input-row .cmd     { color: var(--text); }

.computer-text, .output {
    color: var(--green);
    margin: 0 0 0.05em;
    white-space: pre-wrap;
}

.computer-text.last { margin-bottom: 0; }

/* ============================================================
   headings, meta
   ============================================================ */
h1, h2, h3 {
    font-weight: normal;
    line-height: 1.3;
    margin: 0;
    font-family: var(--font-mono);
}

.page-title {
    color: var(--green-bright);
    font-size: 1.55em;
    margin: 0.4em 0 0.1em;
    letter-spacing: -0.01em;
}

.page-tagline {
    color: var(--text-dim);
    font-size: 0.95em;
    margin: 0 0 1.5em;
}

h2 {
    font-size: 1.05em;
    color: var(--green-bright);
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.92em;
    margin: 0.15em 0 0;
}

.meta {
    color: var(--text-dim);
    font-size: 0.82em;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* ============================================================
   entries - designed cards (still terminal-flavored)
   ============================================================ */
.entry {
    background: var(--window-bg-soft);
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 1em 1.2em 1.1em;
    margin: 0 0 1.1em;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
    position: relative;
}

.entry:hover {
    border-color: rgba(2, 227, 92, 0.35);
    background: rgba(2, 227, 92, 0.03);
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.8em;
    flex-wrap: wrap;
    margin-bottom: 0.3em;
}

.entry-header h2 {
    color: var(--green-bright);
}

.entry p {
    color: var(--text);
    margin: 0.5em 0;
    line-height: 1.65;
}

/* ============================================================
   tags
   ============================================================ */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
    margin: 0.75em 0 0;
    padding: 0;
    list-style: none;
}

.tag {
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    color: var(--green);
    padding: 0.15em 0.6em;
    border-radius: 4px;
    font-size: 0.76em;
    letter-spacing: 0.04em;
    line-height: 1.6;
}

/* ============================================================
   links
   ============================================================ */
a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(92, 204, 255, 0.32);
    transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
    color: var(--green);
    border-bottom-color: var(--green);
}

.entry-links {
    margin-top: 0.7em;
    font-size: 0.88em;
    display: flex;
    gap: 1.2em;
    flex-wrap: wrap;
}

.backLink {
    display: inline-block;
    color: var(--text-dim);
    border-bottom: none;
    margin-bottom: 0.6em;
    font-size: 0.86em;
}

.backLink::before { content: "← "; }
.backLink:hover { color: var(--green); }

/* ============================================================
   footer (lives inside the terminal window)
   ============================================================ */
footer {
    margin-top: 2.2em;
    padding-top: 1em;
    border-top: 1px solid var(--rule);
    color: var(--text-dim);
    font-size: 0.83em;
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    justify-content: space-between;
    align-items: center;
}

footer a {
    color: var(--text-dim);
    border-bottom-color: rgba(138, 138, 138, 0.3);
}

footer a:hover { color: var(--green); border-bottom-color: var(--green); }

.footer-links {
    display: flex;
    gap: 1.4em;
    flex-wrap: wrap;
}

/* ============================================================
   selection
   ============================================================ */
::selection {
    background: rgba(2, 227, 92, 0.3);
    color: var(--text);
}

/* ============================================================
   scrollbar (webkit only - subtle)
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--page-bg); }
::-webkit-scrollbar-thumb { background: #2a2b30; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3a3b40; }

/* ============================================================
   mobile
   ============================================================ */
@media (max-width: 720px) {
    body {
        padding: 0;
        font-size: 14px;
        line-height: 1.55;
    }
    .window {
        border-radius: 0;
        border-left: none;
        border-right: none;
        min-height: 100vh;
        max-width: 100%;
    }
    .terminal { padding: 1em 1em 1.4em; }
    .titlebar { padding: 0.5em 0.7em; }
    .titlebar-title { font-size: 0.72em; padding: 0 4em; }
    .page-title { font-size: 1.3em; }
    .entry { padding: 0.9em 1em 1em; }
    .entry-header { flex-direction: column; gap: 0.1em; }
    footer { flex-direction: column; align-items: flex-start; gap: 0.6em; }
    .footer-links { gap: 1em; }
    .prompt, .input-line { font-size: 0.92em; }
}
