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

:root {
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-card: #1c2128;
  --border: #30363d;
  --border-subtle: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-subtle: #6e7681;
  --accent: #238636;
  --accent-hover: #2ea043;
  --accent-light: #56d364;
  --purple: #8957e5;
  --blue: #1f6feb;
  --blue-light: #58a6ff;
  --orange: #d29922;
  --red: #da3633;
  --terminal: #0d1117;
  --terminal-green: #56d364;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--blue-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== OS Tabs ===== */
.tab-group {
  margin: 1.2em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tab-bar {
  display: flex;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  margin-bottom: -1px;
  font-weight: 500;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--blue-light); border-bottom-color: var(--blue-light); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel pre {
  margin: 0;
  border-radius: 0;
  border: none;
  border-top: none;
}
.tab-panel pre code {
  border-radius: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none !important;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-elevated); border-color: var(--text-subtle); }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(180deg, #0d1117 0%, #0d1117 60%, #0a0e13 100%);
  border-bottom: 1px solid var(--border);
  padding: 72px 24px 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(35,134,54,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(35,134,54,0.15);
  border: 1px solid rgba(35,134,54,0.4);
  color: var(--accent-light);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}
.hero h1 {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #e6edf3 30%, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.stats {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--border-subtle);
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ===== Terminal Preview ===== */
.terminal-preview {
  background: var(--terminal);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 560px;
  margin: 40px auto 0;
  text-align: left;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.terminal-bar {
  background: #1c2128;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.terminal-dot { width: 12px; height: 12px; border-radius: 50%; }
.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }
.terminal-title { font-size: 12px; color: var(--text-muted); margin-left: auto; font-family: var(--font-mono); }
.terminal-body { padding: 20px; font-family: var(--font-mono); font-size: 13px; line-height: 1.8; }
.terminal-line { display: flex; gap: 10px; }
.terminal-prompt { color: var(--terminal-green); }
.terminal-cmd { color: var(--text); }
.terminal-output { color: var(--text-muted); padding-left: 20px; }
.terminal-blink { animation: blink 1s step-end infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ===== Section ===== */
.section { padding: 64px 24px; }
.section-alt { background: var(--bg-elevated); border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.container { max-width: 1100px; margin: 0 auto; }
.section-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.section-copy { color: var(--text-muted); margin-bottom: 32px; font-size: 15px; }

/* ===== Features Grid ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.15s;
}
.feature-card:hover { border-color: var(--accent); }
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.feature-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ===== Parts List ===== */
.parts-list { display: flex; flex-direction: column; gap: 10px; }
.part-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all 0.15s;
  color: var(--text);
  text-decoration: none !important;
}
.part-card:hover {
  border-color: var(--accent);
  background: rgba(35,134,54,0.05);
  transform: translateX(4px);
}
.part-number {
  width: 40px; height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-light);
  flex-shrink: 0;
}
.part-content { flex: 1; }
.part-content h3 { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.part-content p { font-size: 13px; color: var(--text-muted); }
.part-time { font-size: 12px; color: var(--text-subtle); white-space: nowrap; font-family: var(--font-mono); }

/* ===== Prereqs ===== */
.prereqs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.prereq-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
}
.prereq-check {
  color: var(--accent-light);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

/* ===== Footer ===== */
footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
}
.footer-links { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.footer-links a { font-size: 13px; color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.footer-credit { font-size: 13px; color: var(--text-subtle); }

/* ===== Step Page ===== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-header a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none !important;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-header a:hover { color: var(--accent-light); }
.sidebar-title {
  padding: 16px 16px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 16px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.step-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none !important;
  transition: all 0.1s;
  border-left: 2px solid transparent;
}
.step-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.step-link.active {
  color: var(--accent-light);
  background: rgba(35,134,54,0.08);
  border-left-color: var(--accent);
}
.step-num {
  width: 22px; height: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-subtle);
  flex-shrink: 0;
}
.step-link.active .step-num {
  background: rgba(35,134,54,0.2);
  border-color: var(--accent);
  color: var(--accent-light);
}
.step-link.done .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-name { flex: 1; }
.step-dur { font-size: 11px; color: var(--text-subtle); font-family: var(--font-mono); }

/* === Section jump subnav (shown under active step) === */
.step-subnav {
  margin: 0 0 6px 36px;
  padding: 0;
  border-left: 1px solid var(--border-subtle);
}
.subnav-item {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 8px;
}
.subnav-item > a {
  flex: 1;
  font-size: 11.5px;
  color: var(--text-subtle);
  text-decoration: none !important;
  padding: 3px 0 3px 10px;
  line-height: 1.3;
  transition: color 0.15s;
  cursor: pointer;
  display: block;
}
.subnav-item > a:hover { color: var(--text); text-decoration: none !important; }
.subnav-item.done > a {
  color: var(--accent-light);
  opacity: 0.65;
}
.subnav-h3 > a {
  padding-left: 20px;
  font-size: 11px;
}
.subnav-done-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--text-subtle);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.4;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
  font-family: var(--font-mono);
}
.subnav-done-btn:hover {
  opacity: 1;
  border-color: var(--border);
  color: var(--text);
}
.subnav-done-btn.done {
  opacity: 1;
  color: var(--accent-light);
  border-color: var(--accent);
  background: rgba(35,134,54,0.15);
}
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-subtle);
}
.progress-bar-track { height: 4px; background: var(--border); border-radius: 2px; margin-top: 6px; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }

/* Main content */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.content-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(13,17,23,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-title { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.nav-buttons { display: flex; gap: 8px; }
.nav-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none !important;
}
.nav-btn:hover { border-color: var(--text-subtle); color: var(--text); }
.nav-btn.next { background: var(--accent); border-color: var(--accent); color: #fff; }
.nav-btn.next:hover { background: var(--accent-hover); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.content-body {
  flex: 1;
  padding: 40px 48px;
  max-width: 860px;
}
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 12px;
  color: var(--text-muted);
}
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Markdown rendering ===== */
.markdown h1 { font-size: 28px; font-weight: 700; margin: 0 0 24px; letter-spacing: -0.02em; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.markdown h2 { font-size: 20px; font-weight: 600; margin: 32px 0 12px; letter-spacing: -0.01em; }
.markdown h3 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; color: var(--text-muted); }
.markdown p { margin: 0 0 16px; line-height: 1.75; }
.markdown ul, .markdown ol { margin: 0 0 16px 24px; }
.markdown li { margin-bottom: 6px; line-height: 1.7; }
.markdown li p { margin: 0; }
.markdown strong { font-weight: 600; color: var(--text); }
.markdown em { color: var(--text-muted); }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.markdown a { color: var(--blue-light); }
.markdown a:hover { text-decoration: underline; }
.markdown blockquote {
  border-left: 3px solid var(--accent);
  background: rgba(35,134,54,0.07);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}
.markdown blockquote p { margin: 0; }
.markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}
.markdown th {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.markdown td { border: 1px solid var(--border); padding: 10px 14px; vertical-align: top; }
.markdown tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.markdown code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--terminal-green);
}
.markdown pre {
  background: var(--terminal);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}
.markdown pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--terminal-green);
  line-height: 1.6;
}
.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-subtle); }
.copy-btn.copied { color: var(--accent-light); border-color: var(--accent); }

/* Checklist items */
.markdown input[type=checkbox] {
  accent-color: var(--accent);
  width: 16px; height: 16px;
  cursor: pointer;
  vertical-align: middle;
  margin-right: 8px;
}
.task-item { list-style: none; }
.task-item label { cursor: pointer; }

/* ===== Completion bar (bottom of step content) ===== */
.completion-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.completion-bar.completed {
  border-color: var(--accent);
  background: rgba(35,134,54,0.06);
}
.completion-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.completion-msg {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-light);
}
.completion-done-btn,
.completion-next-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ===== Mobile ===== */
.menu-toggle { display: none; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0; bottom: 0;
    z-index: 100;
    transition: left 0.25s ease;
  }
  .sidebar.open { left: 0; }
  .menu-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
  }
  .content-body { padding: 24px 20px; }
  .hero { padding: 48px 20px; }
  .section { padding: 48px 20px; }
  .stats { gap: 24px; }
  .overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
  }
  .overlay.active { display: block; }
}
