/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --sidebar-bg:   #0f172a;
  --sidebar-w:    260px;
  --header-h:     60px;
  --accent:       #3b82f6;
  --accent-light: #dbeafe;
  --cyan:         #06b6d4;
  --cyan-light:   #cffafe;
  --green:        #10b981;
  --green-light:  #d1fae5;
  --amber:        #f59e0b;
  --amber-light:  #fef3c7;
  --red:          #ef4444;
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --code-bg:      #0f172a;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Header ────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
}
.header-badge {
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  padding: .2em .55em;
  border-radius: 4px;
}
.header-title {
  color: #f1f5f9;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.header-subtitle {
  color: #64748b;
  font-size: .8rem;
  margin-left: .5rem;
}
.header-links {
  display: flex;
  gap: 1.5rem;
}
.header-links a {
  color: #94a3b8;
  font-size: .85rem;
  font-weight: 500;
  transition: color .15s;
}
.header-links a:hover { color: #f1f5f9; text-decoration: none; }

/* ── Layout ────────────────────────────────────────────────── */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 1.5rem 0 2rem;
  border-right: 1px solid rgba(255,255,255,.06);
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

.nav-section {
  margin-bottom: .25rem;
}
.nav-section-label {
  color: #475569;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .9rem 1.25rem .4rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem 1.25rem;
  color: #94a3b8;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .1s, color .1s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-link:hover {
  background: rgba(255,255,255,.04);
  color: #e2e8f0;
  text-decoration: none;
}
.nav-link.active {
  color: var(--accent);
  background: rgba(59,130,246,.08);
  border-left-color: var(--accent);
}
.nav-link .nav-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 700;
  background: #1e293b;
  color: #64748b;
  flex-shrink: 0;
}
.nav-link.active .nav-step-num {
  background: var(--accent);
  color: #fff;
}
.nav-badge {
  margin-left: auto;
  font-size: .62rem;
  font-weight: 700;
  padding: .1em .45em;
  border-radius: 3px;
  letter-spacing: .04em;
}
.nav-badge.auto  { background: rgba(16,185,129,.15); color: #10b981; }
.nav-badge.manual { background: rgba(245,158,11,.15); color: #f59e0b; }

/* ── Main Content ──────────────────────────────────────────── */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2.5rem 3rem;
  max-width: calc(100% - var(--sidebar-w));
}
.content-inner {
  max-width: 860px;
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  border-radius: 12px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  color: #f1f5f9;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero-tag {
  display: inline-block;
  background: rgba(59,130,246,.2);
  color: #93c5fd;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .3em .8em;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid rgba(59,130,246,.3);
}
.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: .75rem;
  background: linear-gradient(135deg, #f1f5f9, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  color: #94a3b8;
  font-size: 1rem;
  max-width: 580px;
  margin-bottom: 1.5rem;
}
.hero-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.hero-meta-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: #64748b;
}
.hero-meta-item span { color: #94a3b8; }

/* ── Pipeline Diagram ──────────────────────────────────────── */
.pipeline-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
}
.pipeline-section h3 {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}
/*
 * Pipeline — split into two horizontal rows:
 *   .pipeline-nodes  → all circles + arrows on one line
 *   .pipeline-labels → all label+badge cells below, matching column widths
 */
.pipeline {
  display: flex;
  flex-direction: column;
  min-width: 720px;
  gap: 0;
}
.pipeline-nodes {
  display: flex;
  align-items: center;
}
.pipeline-labels {
  display: flex;
  align-items: flex-start;
}
/* Each step occupies the same flex proportion in both rows */
.pipe-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pipe-node {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.pipe-node.phase1 { background: var(--accent); }
.pipe-node.phase2 { background: var(--cyan); }
.pipe-node.phase3 { background: var(--green); }
.pipe-node.phase-acad { background: #b45309; }
/* In nodes row, step just shows the node */
.pipeline-nodes .pipe-step { justify-content: center; }
/* In labels row, step shows label + badge */
.pipeline-labels .pipe-step {
  gap: .3rem;
  padding-top: .4rem;
}
.pipe-label {
  font-size: .67rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
  max-width: 76px;
}
.pipe-badge {
  font-size: .58rem;
  font-weight: 700;
  padding: .1em .4em;
  border-radius: 3px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pipe-badge.auto   { background: var(--green-light);  color: var(--green); }
.pipe-badge.manual { background: var(--amber-light);  color: var(--amber); }
/* Arrow sits between steps — same width in both rows */
.pipe-arrow {
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* In the labels row the arrow column is a blank spacer */
.pipeline-labels .pipe-arrow { visibility: hidden; }
.pipe-arrow svg { color: #cbd5e1; }

/* ── Section Headings ──────────────────────────────────────── */
.section { margin-bottom: 3rem; scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.section-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--border);
}
.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3em .75em;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.phase-badge.p1 { background: var(--accent-light); color: #1d4ed8; }
.phase-badge.p2 { background: var(--cyan-light);   color: #0e7490; }
.phase-badge.p-acad { background: #fef3c7; color: #92400e; }
.phase-badge.p3 { background: var(--green-light);  color: #065f46; }
.phase-badge.intro { background: #f1f5f9; color: var(--text-muted); }

.section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}

/* ── Step Cards ────────────────────────────────────────────── */
.steps { display: flex; flex-direction: column; gap: 1.25rem; }

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.step-card:hover { box-shadow: var(--shadow-md); }

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}
.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 800;
  color: #fff;
  margin-top: .1rem;
}
.step-num.p1 { background: var(--accent); }
.step-num.p2 { background: var(--cyan); }
.step-num.p-acad { background: #b45309; }
.step-num.p3 { background: var(--green); }

.step-meta { flex: 1; }
.step-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .2rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.step-desc {
  font-size: .88rem;
  color: var(--text-muted);
}
.mode-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: .15em .55em;
  border-radius: 3px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.mode-badge.auto   { background: var(--green-light);  color: #065f46; }
.mode-badge.manual { background: var(--amber-light);  color: #92400e; }

.step-body {
  padding: 0 1.5rem 1.25rem 4.5rem;
}
.step-body p { font-size: .9rem; color: var(--text); margin-bottom: .75rem; }
.step-body p:last-child { margin-bottom: 0; }

.step-body ol, .step-body ul {
  padding-left: 1.25rem;
  font-size: .9rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: .75rem;
}

/* ── Callouts ──────────────────────────────────────────────── */
.callout {
  display: flex;
  gap: .75rem;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  font-size: .87rem;
  margin: .75rem 0;
  border-left: 3px solid;
}
.callout-icon { flex-shrink: 0; font-size: 1rem; line-height: 1.5; }
.callout-body { flex: 1; }
.callout-body strong { display: block; font-weight: 700; margin-bottom: .2rem; }

.callout.tip    { background: var(--accent-light); border-color: var(--accent); color: #1d4ed8; }
.callout.note   { background: #f8fafc;             border-color: #94a3b8;       color: #475569; }
.callout.warn   { background: var(--amber-light);  border-color: var(--amber);  color: #92400e; }
.callout.auto   { background: var(--green-light);  border-color: var(--green);  color: #065f46; }

/* ── Code Blocks ───────────────────────────────────────────── */
.code-block {
  background: var(--code-bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin: .75rem 0;
  box-shadow: var(--shadow-md);
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}
.code-lang {
  font-size: .72rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.code-file {
  font-size: .72rem;
  color: #475569;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.code-block pre {
  padding: 1.25rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: .82rem;
  line-height: 1.65;
  color: #e2e8f0;
}
.code-block code { font-family: inherit; }
/* Syntax colors */
.kw  { color: #c084fc; }
.fn  { color: #60a5fa; }
.st  { color: #86efac; }
.cm  { color: #475569; font-style: italic; }
.nb  { color: #f9a8d4; }
.nu  { color: #fbbf24; }

/* ── Value Tags (settings display) ────────────────────────── */
.setting {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .5em;
  font-size: .82rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}
.setting .label { color: var(--text-muted); font-size: .75rem; }

/* ── Prereqs Grid ──────────────────────────────────────────── */
.prereq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: .5rem;
}
.prereq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.prereq-card h4 {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .35rem;
  color: var(--text);
}
.prereq-card p {
  font-size: .8rem;
  color: var(--text-muted);
}
.prereq-card .version {
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: .3rem;
  display: block;
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  margin-left: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #475569;
  font-size: .8rem;
  text-align: center;
  padding: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ── Utilities ─────────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* ── Mobile hamburger button ───────────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  padding: .4rem .5rem;
  cursor: pointer;
  color: #94a3b8;
  margin-left: auto;
}
.mobile-menu-btn:hover { border-color: rgba(255,255,255,.3); color: #f1f5f9; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 90;
}
.sidebar-overlay.active { display: block; }

/* ── Mobile layout ─────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Show hamburger */
  .mobile-menu-btn { display: flex; align-items: center; }

  /* Hide header nav links, show hamburger */
  .header-links { display: none; }

  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 95;
  }
  .sidebar.open {
    transform: translateX(0);
    display: block;
  }

  /* Content fills full width */
  .content {
    margin-left: 0;
    max-width: 100%;
    padding: 1.5rem 1rem;
  }

  /* Pipeline scrolls horizontally */
  .pipeline-section {
    padding: 1rem;
  }
  .pipeline-section > div {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Hero adjustments */
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: .95rem; }
  .hero-meta { gap: .75rem; flex-wrap: wrap; }
  .hero-meta-item { font-size: .75rem; }

  /* Step cards */
  .step-body { padding-left: 1rem; }
  .step-header { gap: .75rem; padding: 1rem; }
  .step-body { padding: 0 1rem 1rem 1rem; }

  /* Code blocks */
  .code-block pre { font-size: .75rem; padding: 1rem; }

  /* Footer */
  .footer { margin-left: 0; }
}

@media (max-width: 480px) {
  .content { padding: 1rem .75rem; }
  .section { margin-bottom: 2rem; }
  .prereq-grid { grid-template-columns: 1fr; }
}
