:root {
    --bg-color: #1a1b1e;
    --text-color: #e2e2e2;
    --accent-color: #9d86e9;
    --code-bg: #2d2d2d;
    --border-color: #333;
    --sidebar-bg: #2f3136;
    --search-bg: #202225;
    --card-bg: #2a2b2e;
    --link-color: #b197fc;
    --mono-font: 'JetBrains Mono', 'Fira Code', 'IBM Plex Mono', 'Consolas', monospace;
    --system-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base styles */
html {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--system-font);
    font-size: 16px;
    line-height: 1.6;
    background: var(--bg-color);
    color: var(--text-color);
    display: flex;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 300px;
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

/* Search */
.search-container {
    margin-bottom: 2rem;
}

#search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--search-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    font-family: var(--mono-font);
}

.search-result-item {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--search-bg);
}

/* Table of Contents */
.table-of-contents {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--search-bg);
    border-radius: 4px;
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin: 0.5rem 0;
}

.table-of-contents a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

.table-of-contents a:hover {
    color: var(--accent-color);
}

.toc-h1 { margin-left: 0; }
.toc-h2 { margin-left: 1rem; }
.toc-h3 { margin-left: 2rem; }
.toc-h4 { margin-left: 3rem; }

/* Main content area */
.site-main {
    margin-left: 300px;
    width: calc(100% - 300px);
    min-height: 100vh;
}

/* Header */
.site-header {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.site-title {
    font-size: 1.4rem;
    text-decoration: none;
    color: var(--accent-color);
    font-family: var(--mono-font);
}

/* Posts */
.post-card {
    margin: 2rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 800px;
    width: 90%;
}

.post-card-title {
    font-size: 1.8rem;
    margin: 0 0 1rem;
    font-family: var(--mono-font);
}

.post-card-title a {
    color: var(--accent-color);
    text-decoration: none;
}

.post-card-title a:hover {
    color: var(--link-color);
}

.post-card-meta {
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.9rem;
}

.post-card-excerpt {
    margin-top: 1rem;
    color: var(--text-color);
    line-height: 1.6;
}

/* Single Post */
.post-full {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--sidebar-bg);
    border-radius: 4px;
}

.post-full-title {
    font-size: 2.2rem;
    margin: 0 0 1rem;
    color: var(--accent-color);
    font-family: var(--mono-font);
}

.post-full-content {
    font-family: var(--system-font);
}

.post-full-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Code blocks */
pre {
    background: var(--code-bg);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

code {
    font-family: var(--mono-font);
}

:not(pre) > code {
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 4px;
    background: var(--accent-color);
    color: var(--text-color);
    border-radius: 3px;
    font-size: 0.8rem;
}

/* Koenig Editor Styles */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: auto calc(50% - 50vw);
    transform: translateX(calc(50vw - 50%));
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

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

/* Gallery Card */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    margin: 1.5em auto;
    max-width: 1040px;
    width: 100vw;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.kg-gallery-image img {
    display: block;
    margin: 0;
    width: 100%;
    height: 100%;
}

.kg-gallery-row:not(:first-of-type) {
    margin: 0.75em 0 0 0;
}

.kg-gallery-image:not(:first-of-type) {
    margin: 0 0 0 0.75em;
}

/* Bookmark Card */
.kg-bookmark-card {
    width: 100%;
    background: var(--sidebar-bg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin: 1.5em 0;
}

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: var(--text-color);
}

.kg-bookmark-content {
    flex-grow: 1;
    padding: 20px;
}

.kg-bookmark-title {
    font-weight: 600;
}

.kg-bookmark-description {
    overflow-y: hidden;
    margin-top: 12px;
    max-height: 48px;
    color: #999;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    margin-top: 14px;
    color: #999;
    font-size: 0.9em;
}

.kg-bookmark-icon {
    width: 22px;
    height: 22px;
    margin-right: 8px;
}

.kg-bookmark-thumbnail {
    position: relative;
    min-width: 33%;
    max-height: 100%;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 3px 3px 0;
}

/* Navigation */
.site-nav {
    margin-top: 2rem;
}

.site-nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.site-nav a:hover {
    background-color: var(--card-bg);
    color: var(--accent-color);
}

/* Footer */
.site-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    color: #666;
    font-size: 0.9rem;
}