/* hackish — terminal-inspired blog theme */

:root {
    --bg: #0b0f0a;
    --bg-elev: #0f1410;
    --fg: #c8e6c9;
    --fg-dim: #7aa07e;
    --green: #39ff14;
    --green-soft: #5fd97a;
    --amber: #ffb000;
    --red: #ff5555;
    --cyan: #56b6c2;
    --border: #1f2a1f;
    --link: #5fd97a;
    --link-hover: #39ff14;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --max-w: 820px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--mono);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    background-image:
        radial-gradient(ellipse at top, rgba(57,255,20,0.05), transparent 60%),
        radial-gradient(ellipse at bottom, rgba(57,255,20,0.03), transparent 60%);
    min-height: 100vh;
}

/* subtle CRT scanlines */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0,0,0,0) 0px,
        rgba(0,0,0,0) 2px,
        rgba(0,0,0,0.06) 3px,
        rgba(0,0,0,0) 4px
    );
    z-index: 9999;
    mix-blend-mode: multiply;
}

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.25rem;
}

a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    transition: color .15s ease, border-color .15s ease;
}
a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }

.muted { color: var(--fg-dim); }

/* ---------- Header ---------- */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 2.5rem 0 1.25rem;
    background: linear-gradient(180deg, rgba(57,255,20,0.04), transparent);
}

.prompt {
    display: inline-block;
    font-size: 1.05rem;
    color: var(--green);
    border: none;
    text-shadow: 0 0 6px rgba(57,255,20,0.35);
}
.prompt:hover { border: none; color: var(--green); }
.prompt-user { color: var(--amber); }
.prompt-at { color: var(--fg-dim); }
.prompt-host { color: var(--cyan); }
.prompt-colon { color: var(--fg-dim); }
.prompt-path { color: var(--green-soft); }
.prompt-sigil { color: var(--red); margin: 0 .35em; }
.prompt-cmd { color: var(--fg); }

.site-tagline {
    margin: .5rem 0 1rem;
    color: var(--fg-dim);
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.site-nav a {
    color: var(--green-soft);
    font-size: .95rem;
}

/* ---------- Main ---------- */
.site-main { padding: 2.5rem 0 3rem; }

.section-title {
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0 0 1.5rem;
    color: var(--fg);
    border-bottom: 1px dashed var(--border);
    padding-bottom: .5rem;
}

/* ---------- Post list ---------- */
.post-list { display: flex; flex-direction: column; gap: 2rem; }

.post-item {
    padding: 1rem 1.25rem;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-left: 3px solid var(--green);
    border-radius: 2px;
    transition: border-color .15s ease, transform .15s ease;
}
.post-item:hover {
    border-left-color: var(--amber);
    transform: translateX(2px);
}

.post-meta {
    font-size: .85rem;
    color: var(--fg-dim);
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: .5rem;
}

.post-title {
    font-size: 1.4rem;
    margin: 0 0 .5rem;
    line-height: 1.3;
}
.post-title a { color: var(--fg); border-bottom: none; }
.post-title a:hover { color: var(--green); }

.post-excerpt {
    margin: 0 0 .75rem;
    color: var(--fg);
}

.read-more {
    font-size: .9rem;
    color: var(--green-soft);
}

.tag {
    display: inline-block;
    font-size: .8rem;
    color: var(--cyan);
    background: rgba(86,182,194,0.08);
    padding: .1rem .4rem;
    border-radius: 2px;
    border: 1px solid rgba(86,182,194,0.25);
}
.tag:hover { color: var(--cyan); border-color: var(--cyan); }

/* ---------- Post full ---------- */
.post-full {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 2rem;
}

.post-full-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px dashed var(--border); }
.post-full-title { font-size: 2rem; line-height: 1.2; margin: .5rem 0 1rem; color: var(--fg); }
.filename { color: var(--amber); }
.post-byline { font-size: .9rem; color: var(--fg-dim); margin-bottom: .75rem; }
.post-byline .author { color: var(--green-soft); }
.post-tags { display: flex; gap: .5rem; flex-wrap: wrap; }

.post-feature-image { margin: 0 0 2rem; }
.post-feature-image img { max-width: 100%; height: auto; display: block; border: 1px solid var(--border); }

.post-full-content {
    font-size: 1rem;
    line-height: 1.75;
}
.post-full-content h1,
.post-full-content h2,
.post-full-content h3,
.post-full-content h4 {
    color: var(--green-soft);
    margin-top: 2rem;
    margin-bottom: .75rem;
}
.post-full-content h2::before { content: "## "; color: var(--fg-dim); }
.post-full-content h3::before { content: "### "; color: var(--fg-dim); }
.post-full-content p { margin: 0 0 1.25rem; }
.post-full-content a { color: var(--link); border-bottom: 1px dashed var(--link); }
.post-full-content blockquote {
    margin: 1.5rem 0;
    padding: .5rem 1rem;
    border-left: 3px solid var(--amber);
    background: rgba(255,176,0,0.05);
    color: var(--fg);
}
.post-full-content code {
    background: #000;
    color: var(--green);
    padding: .15rem .4rem;
    border-radius: 2px;
    border: 1px solid var(--border);
    font-size: .92em;
}
.post-full-content pre {
    background: #000;
    color: var(--green-soft);
    padding: 1rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--green);
    border-radius: 2px;
    overflow-x: auto;
    line-height: 1.5;
    font-size: .92rem;
}
.post-full-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}
.post-full-content img { max-width: 100%; height: auto; border: 1px solid var(--border); }
.post-full-content hr { border: none; border-top: 1px dashed var(--border); margin: 2rem 0; }
.post-full-content ul, .post-full-content ol { padding-left: 1.5rem; }
.post-full-content li { margin-bottom: .35rem; }
.post-full-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    font-size: .92rem;
}
.post-full-content th, .post-full-content td {
    border: 1px solid var(--border);
    padding: .4rem .6rem;
    text-align: left;
}
.post-full-content th { background: rgba(57,255,20,0.05); color: var(--green-soft); }

/* ---------- Post nav ---------- */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}
.post-nav a {
    flex: 1 1 300px;
    padding: .75rem 1rem;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--fg);
}
.post-nav a:hover { border-color: var(--green); color: var(--green); }
.post-nav .next { text-align: right; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2.5rem 0 0;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
    font-size: .9rem;
    color: var(--fg-dim);
}
.pagination a { color: var(--green-soft); }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0 2.5rem;
    margin-top: 3rem;
    color: var(--fg-dim);
    font-size: .85rem;
}
.site-footer p { margin: .25rem 0; }

/* blinking cursor */
.cursor {
    display: inline-block;
    width: .55ch;
    color: var(--green);
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Error / Archive ---------- */
.error-pre {
    background: #000;
    color: var(--red);
    padding: 1rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--red);
    border-radius: 2px;
}
.archive-header { margin-bottom: 2rem; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
    body { font-size: 15px; }
    .post-full { padding: 1.25rem; }
    .post-full-title { font-size: 1.5rem; }
    .prompt { font-size: .95rem; }
}

/* ---------- Koenig wide/full width cards ---------- */
.kg-width-wide {
    margin-left: -2rem;
    margin-right: -2rem;
    max-width: none;
}
.kg-width-wide img { width: 100%; display: block; }

.kg-width-full {
    position: relative;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: 100vw;
}
.kg-width-full img { width: 100%; display: block; border: none; }

/* ---------- Category index ---------- */
.category-group {
    margin-bottom: 2.5rem;
}
.category-title {
    display: flex;
    align-items: baseline;
    gap: .6rem;
}
.category-title a { color: var(--cyan); border-bottom: none; }
.category-title a:hover { color: var(--green); }
.category-count { font-size: .85rem; }
.category-post-list { gap: .75rem; }
.category-post-item {
    padding: .6rem 1rem;
    border-left-width: 2px;
}
.category-post-item .post-title {
    font-size: 1.05rem;
    margin: 0;
}

/* ---------- Social links (About) ---------- */
.social-links {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border);
}
.social-list {
    list-style: none;
    margin: .5rem 0 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.social-list a { color: var(--green-soft); }
.social-list a:hover { color: var(--green); }
.social-list li::before { content: "\2192  "; color: var(--fg-dim); }

/* ---------- Category jump nav ---------- */
.category-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 0 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px dashed var(--border);
    font-size: .9rem;
}
.category-jump a { color: var(--cyan); }
.category-jump a:hover { color: var(--green); }

.category-view-all {
    display: inline-block;
    margin-top: .75rem;
}

/* ---------- Post preview thumbnail ---------- */
.post-item {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 1.25rem;
}
.post-item-body {
    flex: 1 1 auto;
    min-width: 0;
}
.post-item-image {
    flex: 0 0 160px;
    display: block;
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    align-self: center;
}
.post-item-image img {
    display: block;
    width: 160px;
    height: 110px;
    object-fit: cover;
    filter: grayscale(35%) contrast(1.05);
    transition: filter .15s ease;
}
.post-item:hover .post-item-image img {
    filter: grayscale(0%) contrast(1);
}

@media (max-width: 600px) {
    .post-item-image { flex-basis: 96px; }
    .post-item-image img { width: 96px; height: 72px; }
}

/* ---------- Tools ---------- */
.tool-panel {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}
.tool-field { margin-bottom: 1rem; }
.tool-field label {
    display: block;
    margin-bottom: .4rem;
    color: var(--fg-dim);
    font-size: .9rem;
}
.tool-textarea, .tool-input {
    width: 100%;
    background: #000;
    color: var(--green-soft);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: .75rem;
    font-family: var(--mono);
    font-size: .9rem;
    resize: vertical;
}
.tool-textarea:focus, .tool-input:focus {
    outline: none;
    border-color: var(--green);
}
.tool-btn {
    background: transparent;
    border: 1px solid var(--green);
    color: var(--green);
    padding: .5rem 1rem;
    font-family: var(--mono);
    font-size: .9rem;
    cursor: pointer;
    border-radius: 2px;
    margin-top: .5rem;
    margin-right: .5rem;
}
.tool-btn:hover { background: rgba(57,255,20,0.1); }
.tool-output { margin-top: 1rem; }
.tool-output pre {
    background: #000;
    color: var(--green-soft);
    padding: 1rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--green);
    border-radius: 2px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: .88rem;
}
.tool-error { color: var(--red); margin-top: .75rem; font-size: .9rem; }
.tool-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.tool-row > div { flex: 1 1 280px; }
.tool-hint { color: var(--fg-dim); font-size: .85rem; margin-top: .5rem; }
.tool-item { display: block; }

/* ---------- Games ---------- */
.game-canvas {
    background: #000;
    border: 1px solid var(--border);
    display: block;
    margin: 1.5rem auto;
    max-width: 100%;
}
.game-score {
    text-align: center;
    font-size: 1.2rem;
    color: var(--green);
}
.game-hint {
    text-align: center;
    color: var(--fg-dim);
    font-size: .85rem;
    margin-top: .5rem;
}
.game-controls { text-align: center; margin-top: 1rem; }

.g2048-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 340px;
    max-width: 100%;
    margin: 1.5rem auto;
    background: var(--bg-elev);
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}
.g2048-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--green);
    border-radius: 2px;
    transition: background .1s ease;
}

/* ---------- Home tools/games hint ---------- */
.home-tools-hint {
    margin: -1rem 0 1.5rem;
    font-size: .9rem;
}
.home-tools-hint a { color: var(--cyan); }
.home-tools-hint a:hover { color: var(--green); }
