:root {
  --bg-primary: #0a0c10;
  --bg-sidebar: #0f1219;
  --bg-card: #151a24;
  --border: #232a3b;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #545d68;
  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.15);
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

/* CUSTOM SCROLLBAR (MATCH DARK THEME) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #232a3b;
  border-radius: 999px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #38bdf8;
}

/* Firefox scrollbar support */
* {
  scrollbar-width: thin;
  scrollbar-color: #232a3b var(--bg-primary);
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow: hidden;
  height: 100vh;
}

.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge-img {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-badge-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.logo-badge {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #050811;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.25);
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.subdomain {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-secondary);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  font-family: var(--font-sans);
  width: 100%;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.topic-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topic-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.topic-list li:hover {
  background: var(--bg-card);
  color: #fff;
}

.topic-list li.active {
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  font-weight: 600;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot.all { background: var(--accent-cyan); }
.dot.edge-systems { background: #38bdf8; }
.dot.stream-thoughts { background: #a855f7; }
.dot.tools { background: #10b981; }

.count {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--font-mono);
  opacity: 0.6;
}

.status-legend {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.badge.seedling { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.badge.budding { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge.evergreen { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.bio-snippet {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bio-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.bio-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.portfolio-link {
  font-size: 11.5px;
}

.portfolio-link a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
}

.portfolio-link a:hover {
  text-decoration: underline;
}

/* READING PANE */
.reading-pane {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-primary);
}

.top-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 48px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.breadcrumbs {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.theme-switch {
  cursor: pointer;
  font-size: 16px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.theme-switch:hover {
  opacity: 1;
}

.article-content {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 80px 24px;
}

.article-header {
  margin-bottom: 32px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 24px;
}

.article-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.article-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.article-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 12px;
}

.article-tags {
  display: flex;
  gap: 6px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.article-body {
  line-height: 1.8;
  font-size: 15.5px;
  color: #c9d1d9;
}

.article-body p {
  margin-bottom: 18px;
}

.article-body h2 {
  font-size: 20px;
  color: #fff;
  margin: 32px 0 14px 0;
  letter-spacing: -0.3px;
}

.article-body blockquote {
  border-left: 3px solid var(--accent-cyan);
  background: rgba(56, 189, 248, 0.05);
  padding: 14px 18px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #93c5fd;
}

.article-body code {
  font-family: var(--font-mono);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13.5px;
  color: #38bdf8;
}

.article-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
  position: relative;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-code-btn:hover {
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
}

.connected-notes {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.connected-title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.connected-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.connected-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.connected-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.connected-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.connected-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* RIGHT GRAPH PANE */
.graph-pane {
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  overflow: hidden;
}

.graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.graph-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.graph-hint {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.graph-container {
  height: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.recent-thoughts {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.recent-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.recent-item:hover {
  background: var(--bg-card);
  border-color: rgba(56, 189, 248, 0.4);
}

.recent-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.recent-item-date {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* MOBILE TOGGLE BUTTONS & ACTIONS */
.mobile-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
}

.mobile-toggle-btn:hover {
  background: var(--bg-card);
}

.top-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 40;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 260px 1fr;
  }
  .graph-pane {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    height: 100vh;
    z-index: 50;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  }
  .graph-pane.open {
    right: 0;
  }
  .mobile-toggle-btn#graphToggle {
    display: flex;
  }
}

@media (max-width: 768px) {
  .app-layout {
    display: block;
    height: 100vh;
    position: relative;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -290px;
    width: 280px;
    height: 100vh;
    z-index: 50;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-toggle-btn {
    display: flex;
  }

  .backdrop.open {
    display: block;
  }

  .top-nav-bar {
    padding: 14px 18px;
    gap: 12px;
  }

  .breadcrumbs {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .article-content {
    padding: 24px 18px 80px 18px;
  }

  .article-title {
    font-size: 24px;
    letter-spacing: -0.5px;
  }

  .connected-grid {
    grid-template-columns: 1fr;
  }

  .graph-pane {
    right: -100%;
    width: 85%;
    max-width: 340px;
  }
}

