/* ===================================================
   HyperVenom — Dark Gray Theme
   =================================================== */

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

:root {
  /* Grays */
  --bg-base:       #111214;
  --bg-surface:    #18191d;
  --bg-elevated:   #1f2025;
  --bg-hover:      #26272d;
  --border:        #2a2b31;
  --border-subtle: #222328;

  /* Text */
  --text-primary:  #e2e4ea;
  --text-secondary:#9295a0;
  --text-muted:    #5a5d68;

  /* Accent — electric blue-violet */
  --accent:        #7c8cff;
  --accent-dim:    #4a56c4;
  --accent-glow:   rgba(124,140,255,0.12);

  /* Code */
  --code-bg:       #14151a;
  --code-border:   #2a2b35;

  /* Sidebar */
  --sidebar-w:     260px;

  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ===================================================
   Sidebar
   =================================================== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* ===================================================
   Tabs
   =================================================== */
.sidebar-tabs {
  display: flex;
  gap: 0;
  padding: 12px 12px 0;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  border-bottom: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  position: relative;
  letter-spacing: 0.02em;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.tab-btn.active {
  color: var(--accent);
  background: var(--bg-elevated);
  border-color: var(--border);
  border-bottom-color: var(--bg-elevated);
}

.tab-btn .tab-icon {
  font-size: 13px;
  opacity: 0.7;
}

/* Tab panels */
.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  margin: 0 12px;
  border-radius: 0 0 8px 8px;
}

.tab-panel.active {
  display: flex;
}

.toc-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 14px 6px;
  flex-shrink: 0;
}

/* ===================================================
   TOC
   =================================================== */
.toc {
  overflow-y: auto;
  padding: 4px 8px 16px;
  flex: 1;
}

.toc::-webkit-scrollbar { width: 3px; }
.toc::-webkit-scrollbar-track { background: transparent; }
.toc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.toc-item {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
  line-height: 1.4;
  transition: color 0.15s, background 0.15s;
  position: relative;
}

.toc-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.toc-item.active-section {
  color: var(--accent);
  background: var(--accent-glow);
}

.toc-item.active-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 60%;
  background: var(--accent);
  border-radius: 99px;
}

.toc-h1 { font-weight: 500; }
.toc-h2 { padding-left: 16px; font-size: 12px; }
.toc-h3 { padding-left: 28px; font-size: 11.5px; color: var(--text-muted); }

.toc-h3:hover, .toc-h3.active-section { color: var(--accent); }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ===================================================
   Mobile toggle
   =================================================== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 38px;
  height: 38px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.sidebar-toggle:hover { background: var(--bg-hover); }

/* ===================================================
   Main content area
   =================================================== */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 56px 64px 80px;
  max-width: 860px;
  min-width: 0;
}

/* ===================================================
   Post header
   =================================================== */
.post-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-subtle);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.post-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.post-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.post-byline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.dot { color: var(--text-muted); }

/* ===================================================
   Article body typography
   =================================================== */
.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
  scroll-margin-top: 32px;
}

.post-body h1 {
  font-size: 1.6rem;
  margin: 2.8em 0 0.8em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.post-body h2 {
  font-size: 1.25rem;
  margin: 2.2em 0 0.6em;
}

.post-body h3 {
  font-size: 1.05rem;
  margin: 1.8em 0 0.5em;
  color: var(--text-secondary);
}

.post-body h4 {
  font-size: 0.95rem;
  margin: 1.4em 0 0.4em;
}

.post-body > h1:first-child,
.post-body > h2:first-child {
  margin-top: 0;
}

.post-body p {
  margin-bottom: 1.2em;
  color: var(--text-primary);
  font-size: 0.975rem;
}

.post-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.post-body a:hover { border-bottom-color: var(--accent); }

.post-body strong { color: var(--text-primary); font-weight: 600; }
.post-body em { color: var(--text-secondary); }

/* Lists */
.post-body ul,
.post-body ol {
  padding-left: 1.4em;
  margin-bottom: 1.2em;
}

.post-body li {
  margin-bottom: 0.35em;
  font-size: 0.975rem;
}

/* ===================================================
   Blockquotes
   =================================================== */
.post-body blockquote {
  margin: 1.6em 0;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}

.post-body blockquote p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.post-body blockquote strong {
  color: var(--accent);
}

/* ===================================================
   Code
   =================================================== */
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: 1px 5px;
  color: #c9d1ff;
}

.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 10px;
  padding: 20px 22px;
  overflow-x: auto;
  margin: 1.6em 0;
  font-size: 0.8rem;
  line-height: 1.65;
  position: relative;
}

.post-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.post-body pre::-webkit-scrollbar { height: 4px; }
.post-body pre::-webkit-scrollbar-track { background: transparent; }
.post-body pre::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ===================================================
   Tables
   =================================================== */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.88rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.post-body thead {
  background: var(--bg-elevated);
}

.post-body th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.post-body td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.post-body tbody tr:last-child td { border-bottom: none; }

.post-body tbody tr:hover { background: var(--bg-elevated); }

.post-body td code {
  font-size: 0.78em;
}

/* ===================================================
   Horizontal rule
   =================================================== */
.post-body hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 2.4em 0;
}

/* ===================================================
   Images
   =================================================== */
.post-body img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 1.2em 0;
}

/* ===================================================
   Responsive
   =================================================== */
@media (max-width: 900px) {
  .content {
    padding: 56px 28px 60px;
  }
  .post-title { font-size: 1.5rem; }
}

@media (max-width: 700px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }
  .sidebar-toggle {
    display: flex;
  }
  .content {
    margin-left: 0;
    padding: 64px 20px 60px;
  }
}

/* ===================================================
   Overlay (mobile)
   =================================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* ===================================================
   Scrollbar global
   =================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
