@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --sidebar-bg: #1B2437;
  --sidebar-bg-alt: #232E45;
  --sidebar-text: #B7C0D6;
  --sidebar-text-dim: #6E7A96;
  --sidebar-active: #D8A24A;
  --content-bg: #EEF0F2;
  --card-bg: #FFFFFF;
  --ink: #1C2331;
  --ink-dim: #5B6472;
  --border: #D7DAE0;
  --accent: #D8A24A;
  --accent-ink: #6B4A16;
  --code-bg: #1B2437;
  --code-text: #DCE3F0;
  --done: #4C8B6B;
  --radius: 4px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background: var(--content-bg);
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h1 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.sidebar-header .subtitle {
  font-size: 12.5px;
  color: var(--sidebar-text-dim);
  margin: 0 0 14px;
  line-height: 1.4;
}

.progress-track {
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 11.5px;
  color: var(--sidebar-text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.search-wrap {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.search-wrap input {
  width: 100%;
  background: var(--sidebar-bg-alt);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
}

.search-wrap input::placeholder {
  color: var(--sidebar-text-dim);
}

.search-wrap input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

nav.topics {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 20px;
}

.topic-group {
  margin-bottom: 2px;
}

.topic-group-title {
  width: 100%;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 10px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Inter', sans-serif;
}

.topic-group-title:hover {
  color: #fff;
}

.topic-group-title .chevron {
  font-size: 10px;
  color: var(--sidebar-text-dim);
  transition: transform 0.15s ease;
}

.topic-group.open .chevron {
  transform: rotate(90deg);
}

.subtopic-list {
  display: none;
  padding: 0 10px 6px 14px;
}

.topic-group.open .subtopic-list {
  display: block;
}

.subtopic-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--sidebar-text);
  border-left: 2px solid transparent;
}

.subtopic-item:hover {
  background: rgba(255,255,255,0.05);
}

.subtopic-item.active {
  background: rgba(216,162,74,0.12);
  border-left-color: var(--accent);
  color: #fff;
}

.subtopic-check {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--sidebar-text-dim);
  flex: none;
  cursor: pointer;
  position: relative;
}

.subtopic-check.done {
  background: var(--done);
  border-color: var(--done);
}

.subtopic-check.done::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.subtopic-title {
  flex: 1;
  line-height: 1.3;
}

.no-results {
  padding: 12px 20px;
  font-size: 12.5px;
  color: var(--sidebar-text-dim);
}

/* ---------- Content ---------- */

main {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 48px 32px 80px;
}

.content-inner {
  width: 100%;
  max-width: 720px;
}

.breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 18px;
}

.article h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.article h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  margin: 30px 0 10px;
  color: var(--ink);
}

.article p {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 14px;
}

.article ul, .article ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.article li {
  font-size: 15.5px;
  line-height: 1.65;
  margin-bottom: 7px;
  color: var(--ink);
}

.article strong { color: var(--ink); font-weight: 600; }

.article code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: #E4E7EC;
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--accent-ink);
}

.article pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 20px;
  border-left: 3px solid var(--accent);
}

.article pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.mark-done-row {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.mark-done-btn {
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--done);
  background: transparent;
  color: var(--done);
  cursor: pointer;
}

.mark-done-btn.done {
  background: var(--done);
  color: #fff;
}

.welcome {
  max-width: 560px;
}

.welcome h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  margin-bottom: 14px;
}

.welcome p {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-dim);
}

@media (max-width: 780px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-width: 0;
    height: auto;
    position: relative;
    max-height: 45vh;
  }
  main { padding: 28px 18px 60px; }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
