/* Modern Vercel-inspired Theme */
:root {
  --bg-primary: #000000;
  --bg-secondary: #111111;
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --accent-primary: #0070f3;
  --accent-hover: #0761d1;
  --border-color: #333333;
  --code-bg: #111111;
  --sidebar-width: 300px;
  --content-width: 900px;
  --header-height: 60px;
}

/* Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: var(--bg-primary);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-secondary) transparent;
  backdrop-filter: blur(10px);
}

.sidebar-header {
  padding: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.site-title {
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.sidebar-content {
  padding: 1.5rem;
}

.sidebar-content a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  border-radius: 5px;
  margin: 2px 0;
}

.sidebar-content a:hover,
.sidebar-content a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  padding-left: 10px;
}

/* Content Area */
.content-wrapper {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 4rem;
  width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p, ul, ol {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

strong {
  font-weight: 600;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
}

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

/* Code Blocks */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background: var(--code-bg);
  border-radius: 5px;
  color: #fff;
}

pre {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2rem 0;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

pre code {
  padding: 0;
  background: transparent;
  border-radius: 0;
  font-size: inherit;
}

/* Syntax Highlighting */
.highlight {
  background: var(--code-bg);
}

.highlight .k, .highlight .kd { color: #ff79c6; } /* Keywords */
.highlight .s, .highlight .s1, .highlight .s2 { color: #f1fa8c; } /* Strings */
.highlight .c, .highlight .c1 { color: #6272a4; } /* Comments */
.highlight .o { color: #ff79c6; } /* Operators */
.highlight .nf { color: #50fa7b; } /* Function names */

/* Post Header */
.post-header {
  margin-bottom: 3rem;
}

.post-title {
  margin-top: 0;
  margin-bottom: 1rem;
}

.post-date {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Post Navigation */
.post-nav {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.post-nav-item {
  flex: 1;
}

.post-nav-item.next {
  text-align: right;
}

.nav-label {
  display: block;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

/* Footer */
.site-footer {
  padding: 2rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .content-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .content {
    padding: 2rem 1.5rem;
  }

  .post-nav {
    flex-direction: column;
    gap: 1.5rem;
  }

  .post-nav-item,
  .post-nav-item.next {
    text-align: left;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
}

/* Selection */
::selection {
  background: var(--accent-primary);
  color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
  padding: 2em 0;
  margin-top: 3em;
  border-top: 1px solid #333;
  flex-wrap: wrap;
}
.chapter-nav a {
  flex: 1 1 30%;
  padding: 0.75em 1em;
  text-decoration: none;
  border: 1px solid #333;
  border-radius: 4px;
  transition: border-color 0.15s;
}
.chapter-nav a:hover { border-color: #00ff9d; }
.chapter-nav-prev { text-align: left; }
.chapter-nav-home { text-align: center; flex: 0 0 auto; }
.chapter-nav-next { text-align: right; }

.chapter-toc {
  margin: 2em 0;
  padding: 1em;
  background: rgba(0, 255, 157, 0.05);
  border-left: 3px solid #00ff9d;
  border-radius: 4px;
}
.chapter-toc summary { cursor: pointer; font-weight: 600; }
.chapter-toc-body {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  margin-top: 1em;
}
.chapter-toc-body a { text-decoration: none; padding: 0.2em 0; }
.chapter-toc-body a.toc-h3 { padding-left: 1.5em; font-size: 0.95em; }
.chapter-toc-body a:hover { color: #00ff9d; }

/* Sidebar primary nav */
.sidebar .sb-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 0.8em;
  padding: 0.6em 0 1em 0;
  margin-bottom: 0.8em;
  border-bottom: 1px solid rgba(0, 255, 157, 0.15);
}
.sidebar .sb-primary a {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(136, 136, 136, 0.3);
  border-radius: 3px;
  color: #bbb;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.sidebar .sb-primary a:hover {
  color: #00ff9d;
  border-color: #00ff9d;
}
.sidebar .sb-primary a.active {
  color: #00ff9d;
  border-color: #00ff9d;
  background: rgba(0, 255, 157, 0.08);
}

/* Sidebar act groups */
.sidebar .sb-group {
  margin: 0.5em 0;
}
.sidebar .sb-group > summary {
  cursor: pointer;
  padding: 0.4em 0;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #888;
  text-transform: uppercase;
  font-size: 0.85em;
  user-select: none;
}
.sidebar .sb-group > summary:hover { color: #00ff9d; }
.sidebar .sb-group[open] > summary { color: #00ff9d; }
.sidebar .sb-group > a {
  display: block;
  padding: 0.3em 0 0.3em 1em;
  border-left: 2px solid transparent;
  font-size: 0.9em;
}
.sidebar .sb-group > a:hover { border-left-color: #00ff9d; }
.sidebar .sb-group > a.active { border-left-color: #00ff9d; color: #00ff9d; font-weight: 600; }
