:root {
    --bg:       #0f0e0d;
    --surface:  #171614;
    --raised:   #1e1c1a;
    --border:   #272422;
    --text:     #c2bcb3;
    --dim:      #6a6560;
    --bright:   #e8e2d8;
    --accent:   #c8a050;
    --accent2:  #7a9e7e;
    --code-bg:  #1a1815;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    margin: 0;
    padding: 0;
    font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
    font-weight: 400;
    line-height: 1.85;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--bright);
    text-decoration: none;
}

/* ─── Header ─────────────────────────────────────── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 12px 40px rgba(0, 0, 0, 0.25);
}

.site-header-inner {
    max-width: 700px;
    margin: 0 auto;
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: lowercase;
    text-decoration: none;
    color: var(--bright);
    letter-spacing: 0.02em;
}

.site-title::before {
    content: '~/ ';
    color: var(--accent);
    font-weight: 300;
}

.site-nav {
    display: flex;
    gap: 1.5rem;
}

.site-nav a {
    font-size: 0.8rem;
    text-transform: lowercase;
    text-decoration: none;
    color: var(--dim);
    letter-spacing: 0.03em;
    transition: color 0.15s ease;
}

.site-nav a:hover {
    color: var(--text);
}

/* ─── Main ───────────────────────────────────────── */

.site-main {
    max-width: 700px;
    margin: 0 auto;
    padding: 0.5rem 1rem 3rem;
}

/* ─── Post cards (home accordion) ──────────────── */

.post {
    border-bottom: 1px dashed var(--border);
}

.post-summary {
    list-style: none;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.65rem 0;
    cursor: pointer;
    user-select: none;
}

.post-summary::-webkit-details-marker {
    display: none;
}

.post-summary:hover .post-title {
    color: var(--bright);
}

.post-summary-inner {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.post-date {
    font-size: 0.72rem;
    color: var(--accent);
    opacity: 0.65;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 300;
}

.post-title {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-transform: lowercase;
    transition: color 0.15s ease;
}

.post[open] .post-title {
    white-space: normal;
    color: var(--bright);
}

.post-toggle {
    font-size: 0.78rem;
    color: var(--dim);
    flex-shrink: 0;
    transition: color 0.15s ease;
    line-height: 1;
    letter-spacing: -0.05em;
}

.post-toggle::before {
    content: '[+]';
}

.post[open] .post-toggle::before {
    content: '[-]';
}

.post[open] .post-toggle {
    color: var(--accent);
}

.post-summary:hover .post-toggle {
    color: var(--text);
}

.post-tags {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    align-items: center;
}

.post-tag {
    font-size: 0.65rem;
    color: var(--dim);
    letter-spacing: 0.05em;
    text-transform: lowercase;
    border: 1px solid var(--border);
    padding: 0.1em 0.4em;
    white-space: nowrap;
}

.post-pin::before {
    content: '[*]';
}

.post-pinned[open] .post-pin::before {
    content: '[*]';
}

.post-pinned .post-title::before {
    content: '* ';
    color: var(--accent);
    font-weight: 300;
}

/* ─── Post body ─────────────────────────────────── */

.post-body {
    padding-bottom: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
    padding-top: 1rem;
}

/* ─── Feature image ─────────────────────────────── */

.post-feature-image {
    margin: 0 0 1.25rem;
}

.post-feature-image img {
    width: 100%;
    height: auto;
    display: block;
}

.post-feature-image figcaption {
    font-size: 0.7rem;
    color: var(--dim);
    margin-top: 0.35rem;
    font-style: italic;
}

/* ─── Post content ──────────────────────────────── */

.post-content {
    font-size: 0.95rem;
    line-height: 1.9;
    color: var(--text);
}

.post-content p {
    margin: 0 0 1rem;
}

.post-content p:last-child {
    margin-bottom: 0;
}

.post-content a {
    color: var(--accent);
    text-underline-offset: 3px;
}

.post-content a:hover {
    color: var(--bright);
    text-decoration: none;
}

.post-content img,
.post-content video {
    max-width: 100%;
    height: auto;
    display: block;
}

.post-content figure {
    margin: 1.5rem 0;
}

.post-content figcaption {
    font-size: 0.72rem;
    color: var(--dim);
    margin-top: 0.4rem;
    font-style: italic;
}

.post-content pre {
    overflow-x: auto;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    line-height: 1.65;
    margin: 1rem 0;
}

.post-content code {
    font-size: 0.88em;
    background: var(--raised);
    color: var(--accent2);
    padding: 0.1em 0.35em;
}

.post-content pre code {
    background: none;
    color: var(--text);
    padding: 0;
    font-size: inherit;
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1rem 0;
    padding-left: 1rem;
    color: var(--dim);
    font-style: italic;
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    font-weight: 500;
    line-height: 1.3;
    margin: 1.5rem 0 0.5rem;
    color: var(--bright);
}

.post-content h1 { font-size: 1.1rem; }
.post-content h2 { font-size: 1rem; }
.post-content h3 { font-size: 0.95rem; }
.post-content h4 { font-size: 0.85rem; color: var(--accent); text-transform: lowercase; }

.post-content h2::before { content: '## '; color: var(--dim); font-weight: 300; }
.post-content h3::before { content: '### '; color: var(--dim); font-weight: 300; }

.post-content hr {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 1.5rem 0;
}

.post-content ul,
.post-content ol {
    padding-left: 1.25rem;
    margin: 0 0 1rem;
}

.post-content li + li {
    margin-top: 0.2rem;
}

.post-content ul li::marker {
    color: var(--accent);
    content: '▸  ';
}

/* ─── Single post ───────────────────────────────── */

.post-single {
    padding-top: 1.5rem;
}

.post-single .post-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border);
}

.post-single .post-title {
    margin: 0 0 0.4rem;
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--bright);
    text-transform: lowercase;
    line-height: 1.3;
}

.post-single .post-date {
    font-size: 0.72rem;
    color: var(--accent);
    opacity: 0.65;
    font-weight: 300;
}

/* ─── Pagination ─────────────────────────────────── */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border);
    font-size: 0.78rem;
    color: var(--dim);
}

.pagination a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

.pagination a:hover {
    color: var(--bright);
}

/* ─── Footer ─────────────────────────────────────── */

.site-footer {
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--dim);
}

.site-footer a {
    color: var(--dim);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--text);
}

/* ─── Error page ─────────────────────────────────── */

.error-page {
    padding: 3rem 0;
}

.error-code {
    font-size: 1.5rem;
    color: var(--accent);
    margin: 0 0 0.5rem;
}

.error-message {
    color: var(--dim);
    margin: 0 0 1.5rem;
}

.error-page a {
    font-size: 0.85rem;
    color: var(--accent2);
}

/* ─── Ghost Koenig cards ─────────────────────────── */

.kg-image {
    max-width: 100%;
    height: auto;
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
    margin: 1rem 0;
}

.kg-gallery-row {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.kg-gallery-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kg-embed-card {
    margin: 1rem 0;
}

.kg-embed-card iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
}

.kg-bookmark-card {
    border: 1px solid var(--border);
    padding: 0.75rem;
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
    background: var(--raised);
    text-decoration: none;
}

.kg-bookmark-content { flex: 1; }
.kg-bookmark-title { font-size: 0.9rem; font-weight: 500; color: var(--bright); }
.kg-bookmark-description { font-size: 0.8rem; color: var(--dim); margin-top: 0.2rem; }
.kg-bookmark-url { font-size: 0.72rem; color: var(--accent); margin-top: 0.3rem; }

.kg-callout-card {
    background: var(--raised);
    border-left: 3px solid var(--accent2);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.kg-toggle-card details summary {
    cursor: pointer;
    font-weight: 500;
    list-style: none;
    color: var(--accent);
}

.kg-video-card video {
    max-width: 100%;
}
