:root {
  --bg-color: #0d0d10;
  --sidebar-bg: #141418;
  --card-bg: #18181f;
  --text-color: #e4e4e7;
  --text-muted: #a1a1aa;
  --border-color: #27272a;
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Fira Code', Menlo, Monaco, Consolas, "Courier New", monospace;
  --sidebar-width: 260px;
  --header-height: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  color: var(--accent-hover);
}

/* Layout */
.site-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand a {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.025em;
}

.sidebar-subtitle {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: 8px;
}

.nav-link {
  display: block;
  padding: 8px 12px;
  color: var(--text-muted);
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-color);
  background-color: var(--card-bg);
}

.nav-link.active {
  border-left: 3px solid var(--accent-color);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Header (Mobile) */
.site-header {
  display: none;
  height: var(--header-height);
  background-color: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 0 16px;
}

.header-container {
  display: flex;
  align-items: center;
  height: 100%;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 8px;
  margin-right: 12px;
}

.site-title-mobile {
  font-weight: 700;
  color: var(--text-color);
  font-size: 1.1rem;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 48px;
  max-width: 1000px;
}

.content-wrapper {
  max-width: 760px;
  margin: 0 auto;
}

/* Footer */
.site-footer {
  margin-left: var(--sidebar-width);
  padding: 32px 48px;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 760px;
  margin: 0 auto;
}

.social-icons {
  display: flex;
  gap: 16px;
}

.social-icons a {
  color: var(--text-muted);
}

.social-icons a:hover {
  color: var(--text-color);
}

/* Typography and Markdown Content */
.page-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 32px;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.post-section-badge {
  background-color: var(--card-bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.post-section-badge a {
  color: var(--text-muted);
}

.post-section-badge a:hover {
  color: var(--text-color);
}

.post-tags .tag {
  color: var(--text-muted);
  background-color: var(--card-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Post list */
.post-list {
  list-style: none;
}

.post-item {
  padding: 24px 0;
  border-bottom: 1px solid var(--border-color);
}

.post-item:last-child {
  border-bottom: none;
}

.post-title-link a {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.3;
}

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

/* Post Single */
.post-header {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
}

.post-toc {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 32px;
}

.toc-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.post-toc ul {
  list-style: none;
  padding-left: 12px;
}

.post-toc li {
  margin: 4px 0;
}

.post-toc a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.post-toc a:hover {
  color: var(--text-color);
}

.post-content h2, .post-content h3, .post-content h4 {
  color: var(--text-color);
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.post-content h2 { font-size: 1.75rem; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.post-content h3 { font-size: 1.4rem; }
.post-content h4 { font-size: 1.2rem; }

.post-content p {
  margin-bottom: 16px;
  font-size: 1.05rem;
  color: #d4d4d8;
}

.post-content ul, .post-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 6px;
  color: #d4d4d8;
}

.post-content blockquote {
  border-left: 4px solid var(--accent-color);
  background-color: var(--card-bg);
  padding: 16px;
  margin: 24px 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

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

/* Code Syntax Styling */
.post-content pre {
  background-color: #1e1e24 !important;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 24px 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.post-content code {
  font-family: var(--font-mono);
  background-color: var(--card-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: #f43f5e;
}

.post-content pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}

.post-content th, .post-content td {
  padding: 12px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.post-content th {
  background-color: var(--card-bg);
  font-weight: 600;
}

.post-content tr:nth-child(even) {
  background-color: #121217;
}

/* 404 & Error Container */
.error-container {
  text-align: center;
  padding: 80px 0;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 16px;
}

.error-message {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.error-description {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.back-home {
  display: inline-block;
  background-color: var(--accent-color);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
}

.back-home:hover {
  background-color: var(--accent-hover);
  color: #fff;
}

/* Responsive design */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 240px;
  }
  
  .site-header {
    display: block;
  }
  
  .sidebar {
    transform: translateX(-100%);
    top: var(--header-height);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 24px 16px;
    margin-top: var(--header-height);
  }
  
  .site-footer {
    margin-left: 0;
    padding: 24px 16px;
  }
  
  .page-title {
    font-size: 1.75rem;
  }
  
  .post-title-link a {
    font-size: 1.25rem;
  }
}
