:root {
    --gap: 24px;
    --content-gap: 20px;
    --nav-width: 1024px;
    --main-width: 720px;
    --header-height: 60px;
    --footer-height: 60px;
    --radius: 8px;
    --theme: rgb(255, 255, 255);
    --entry: rgb(255, 255, 255);
    --primary: rgb(30, 30, 30);
    --secondary: rgb(108, 108, 108);
    --tertiary: rgb(214, 214, 214);
    --content: rgb(31, 31, 31);
    --code-block-bg: rgb(245, 245, 245);
    --code-bg: rgb(255, 255, 255);
    --border: rgb(238, 238, 238);
}

.dark {
    --theme: rgb(29, 30, 32);
    --entry: rgb(46, 46, 51);
    --primary: rgb(218, 218, 219);
    --secondary: rgb(155, 156, 157);
    --tertiary: rgb(65, 66, 68);
    --content: rgb(196, 196, 197);
    --code-block-bg: rgb(46, 46, 51);
    --code-bg: rgb(55, 56, 62);
    --border: rgb(51, 51, 51);
}

*,
::after,
::before {
    box-sizing: border-box;
}

html {
    tab-size: 4;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    word-break: break-word;
    background: var(--theme);
    color: var(--primary);
    margin: 0;
}

a {
    text-decoration: none;
    color: var(--secondary);
}

a:hover {
    color: var(--primary);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    margin-bottom: 0;
    color: var(--primary);
    line-height: 1.2;
}

ul {
    padding-left: 20px;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* Header */
.header {
    background: var(--theme);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 99;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--nav-width);
    margin: 0 auto;
    height: var(--header-height);
    padding: 0 var(--gap);
}

.logo a {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.menu {
    display: flex;
    list-style: none;
    gap: 20px;
    margin: 0;
    padding: 0;
}

#theme-toggle {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
}

/* Layout */
.main {
    max-width: var(--nav-width);
    margin: 40px auto;
    padding: 0 var(--gap);
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - 80px);
}

.content-wrapper {
    display: flex;
    gap: 40px;
}

.posts-list, .post-single, .page-single {
    flex: 1;
    min-width: 0; /* Prevent overflow */
}

/* Sidebar */
.sidebar {
    width: 300px;
    flex-shrink: 0;
}

.sidebar-widget {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--entry);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.widget-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin-bottom: 10px;
    font-size: 14px;
}

.sidebar-link {
    display: block;
    color: var(--secondary);
    transition: color 0.2s;
}

.sidebar-link:hover {
    color: var(--primary);
}

/* Post Entry (List) */
.post-entry {
    margin-bottom: 40px;
    padding: var(--gap);
    background: var(--entry);
    border-radius: var(--radius);
    transition: transform 0.1s;
    border: 1px solid var(--border);
}

.post-entry:hover {
    transform: scale(1.01);
    background: var(--code-block-bg);
}

.entry-header h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.entry-content {
    color: var(--secondary);
    margin-bottom: 10px;
}

.entry-footer {
    color: var(--tertiary);
    font-size: 14px;
}

/* Post Single */
.post-title {
    font-size: 36px;
    margin-bottom: 20px;
}

.post-meta {
    color: var(--secondary);
    margin-bottom: 40px;
}

.post-content {
    font-size: 18px;
    line-height: 1.8;
}

.post-content h2 {
    font-size: 28px;
    margin: 40px 0 20px;
}

/* Page footer */
.footer {
    padding: 20px;
    text-align: center;
    color: var(--secondary);
    border-top: 1px solid var(--border);
}

/* Mobile */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }
}
