/* ═══════════════════════════════════════════
   PHOSPHOR — Terminal Noir Documentation
   ═══════════════════════════════════════════ */

:root {
  --bg-deep: #080c14;
  --bg-surface: #0e1320;
  --bg-raised: #151c2c;
  --bg-hover: #1a2338;
  --accent: #22d3a7;
  --accent-dim: #1a9e7e;
  --accent-glow: rgba(34, 211, 167, 0.08);
  --accent-glow-strong: rgba(34, 211, 167, 0.18);
  --accent-warm: #f0a500;
  --accent-warm-dim: rgba(240, 165, 0, 0.08);
  --accent-red: #f47067;
  --accent-blue: #58a6ff;
  --accent-purple: #bc8cff;
  --text: #aab4c5;
  --text-bright: #e2e8f2;
  --text-dim: #6b7a8f;
  --border: #1a2236;
  --border-bright: #253048;
  --code-bg: #0a1018;
  --sidebar-w: 260px;
  --header-h: 0px;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) var(--bg-deep);
}

body {
  font-family: 'Nunito Sans', system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  overflow-x: hidden;
}

/* Dot grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--bg-deep);
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  padding-left: 38px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-nav .nav-group {
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-nav .nav-group-label {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  padding: 12px 12px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s ease;
  position: relative;
}

.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-bright);
}

.sidebar-nav a.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-nav a .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 1.5;
}

/* ── Sidebar Search ── */
.sidebar-search {
  padding: 12px 12px 0;
  position: relative;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  pointer-events: none;
  stroke-width: 1.5;
}

.search-input {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  padding: 8px 32px 8px 30px;
  background: var(--code-bg);
  color: var(--text-bright);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease;
}

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

.search-input:focus {
  border-color: var(--accent-dim);
}

.search-shortcut {
  position: absolute;
  right: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.search-input:focus ~ .search-shortcut {
  opacity: 0;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 12px;
  right: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  overflow: hidden;
  z-index: 110;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.search-results.visible {
  display: block;
}

.search-result {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
  cursor: pointer;
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover,
.search-result.active {
  background: var(--bg-hover);
  text-decoration: none;
}

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 2px;
}

.search-result-title mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}

.search-result-section {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-dim);
}

.search-no-results {
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
}

/* ── Mobile Toggle ── */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-bright);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-toggle svg { width: 20px; height: 20px; }

/* ── Main Content ── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.content {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 40px 120px;
}

/* ── Hero ── */
.hero {
  padding: 60px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(34, 211, 167, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  font-size: 40px;
  color: var(--text-bright);
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero h1 .accent { color: var(--accent); }

.hero p {
  font-size: 17px;
  color: var(--text);
  max-width: 560px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.hero-btn {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.hero-btn.primary {
  background: var(--accent);
  color: var(--bg-deep);
}
.hero-btn.primary:hover {
  background: #2eeabc;
  box-shadow: 0 0 20px var(--accent-glow-strong);
}

.hero-btn.secondary {
  background: var(--bg-raised);
  color: var(--text-bright);
  border: 1px solid var(--border-bright);
}
.hero-btn.secondary:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* ── Terminal Demo ── */
.terminal {
  background: var(--code-bg);
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  overflow: hidden;
  margin: 32px 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.terminal-dot.red { background: #f47067; }
.terminal-dot.yellow { background: #f0a500; }
.terminal-dot.green { background: #22d3a7; }

.terminal-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
}

.terminal-body {
  padding: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.8;
  overflow-x: auto;
}

.terminal-body .prompt {
  color: var(--accent);
  user-select: none;
}

.terminal-body .cmd { color: var(--text-bright); }
.terminal-body .comment { color: var(--text-dim); font-style: italic; }
.terminal-body .output { color: var(--text); opacity: 0.7; }
.terminal-body .flag { color: var(--accent-warm); }
.terminal-body .arg { color: var(--accent-blue); }
.terminal-body .string { color: var(--accent-purple); }

/* ── Section ── */
.section {
  padding-top: 40px;
  margin-bottom: 40px;
}

.section-anchor {
  display: block;
  position: relative;
  top: -24px;
  visibility: hidden;
}

/* ── Typography ── */
h2 {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--text-bright);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 12px;
}

h2 .section-icon {
  width: 22px;
  height: 22px;
  opacity: 0.8;
  stroke-width: 1.5;
}

.section > .section-rule {
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 32px;
  border: none;
}

h3 {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 19px;
  color: var(--text-bright);
  margin: 36px 0 12px;
  line-height: 1.35;
}

h4 {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-bright);
  margin: 24px 0 8px;
  line-height: 1.4;
}

p { margin: 0 0 14px; }

strong { color: var(--text-bright); font-weight: 600; }

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

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ── Code ── */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92em;
  background: var(--bg-raised);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border-bright);
  border-left: 3px solid var(--border-bright);
  border-radius: 8px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 16px 0 20px;
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

pre .hl-comment { color: var(--text-dim); }
pre .hl-cmd { color: var(--text-bright); }
pre .hl-flag { color: var(--accent-warm); }
pre .hl-string { color: var(--accent-purple); }
pre .hl-keyword { color: var(--accent); }
pre .hl-path { color: var(--accent-blue); }

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 20px;
  border-radius: 8px;
  border: 1px solid var(--border-bright);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  background: var(--bg-raised);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-bright);
}

tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

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

tbody tr:hover { background: rgba(34, 211, 167, 0.04); }

/* ── Cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  transition: all 0.2s ease;
}

.card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 0 24px var(--accent-glow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.card-icon.teal { background: rgba(34, 211, 167, 0.12); }
.card-icon.amber { background: rgba(240, 165, 0, 0.12); }
.card-icon.blue { background: rgba(88, 166, 255, 0.12); }
.card-icon.purple { background: rgba(188, 140, 255, 0.12); }
.card-icon.red { background: rgba(244, 112, 103, 0.12); }

/* Card left-border accent via :has() */
.card:has(.card-icon.teal) { border-left: 3px solid rgba(34, 211, 167, 0.4); }
.card:has(.card-icon.amber) { border-left: 3px solid rgba(240, 165, 0, 0.4); }
.card:has(.card-icon.blue) { border-left: 3px solid rgba(88, 166, 255, 0.4); }
.card:has(.card-icon.purple) { border-left: 3px solid rgba(188, 140, 255, 0.4); }
.card:has(.card-icon.red) { border-left: 3px solid rgba(244, 112, 103, 0.4); }

.card-title {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-bright);
}

.card-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
}

.card p {
  font-size: 13.5px;
  color: var(--text);
  margin: 0;
}

.card-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 12px;
}

.card-tag.teal { background: rgba(34,211,167,0.1); color: var(--accent); border: 1px solid rgba(34,211,167,0.2); }
.card-tag.amber { background: var(--accent-warm-dim); color: var(--accent-warm); border: 1px solid rgba(240,165,0,0.2); }
.card-tag.blue { background: rgba(88,166,255,0.1); color: var(--accent-blue); border: 1px solid rgba(88,166,255,0.2); }

/* ── Pipeline Diagram ── */
.pipeline-flow {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 28px 0;
  overflow-x: auto;
  padding: 12px 0;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pipeline-node {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-bright);
  border: 1px solid var(--border-bright);
  background: var(--bg-surface);
  transition: all 0.25s ease;
  position: relative;
  text-align: center;
  overflow-wrap: break-word;
  word-wrap: break-word;
  padding: 4px 8px;
  box-sizing: border-box;
}

.pipeline-node:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow-strong);
  transform: scale(1.03);
}

.pipeline-node .stage-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  opacity: 0.7;
}

.pipeline-node .stage-icon { width: 22px; height: 22px; stroke-width: 1.5; }

.pipeline-arrow {
  color: var(--text-dim);
  padding: 0 6px;
  flex-shrink: 0;
  margin-bottom: 24px;
}

.pipeline-arrow svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.pipeline-artifact {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
}

/* ── Decision Tree ── */
.decision-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0;
  margin: 20px 0;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13.5px;
}

.decision-grid .dg-header {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  background: var(--bg-raised);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-bright);
}

.decision-grid .dg-cell {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}

.decision-grid .dg-row:nth-child(even) .dg-cell {
  background: rgba(255, 255, 255, 0.015);
}

.decision-grid .dg-row:last-child .dg-cell { border-bottom: none; }
.decision-grid .dg-row:hover .dg-cell { background: var(--accent-glow); }

.decision-grid .dg-row { display: contents; }

/* ── Callout Boxes ── */
.callout {
  border-radius: 8px;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 13.5px;
  border-left: 3px solid;
}

.callout.info {
  background: rgba(88, 166, 255, 0.08);
  border-color: var(--accent-blue);
}

.callout.tip {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.callout.warn {
  background: var(--accent-warm-dim);
  border-color: var(--accent-warm);
}

.callout-title {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.callout.info .callout-title { color: var(--accent-blue); }
.callout.tip .callout-title { color: var(--accent); }
.callout.warn .callout-title { color: var(--accent-warm); }

/* ── Lists ── */
ul, ol {
  padding-left: 20px;
  margin: 8px 0 16px;
}

li { margin-bottom: 6px; }

li code { font-size: 0.85em; }

/* ── Architecture Diagram ── */
.arch-diagram {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  gap: 0;
  align-items: start;
  margin: 28px 0;
}

.arch-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  padding: 20px;
}

.arch-box-title {
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 12px;
}

.arch-tree {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text);
}

.arch-tree .dir { color: var(--accent-blue); }
.arch-tree .file { color: var(--text); }
.arch-tree .desc { color: var(--text-dim); font-style: italic; }

.arch-arrows {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  padding-top: 40px;
  color: var(--accent-dim);
  font-size: 18px;
}

/* ── Command Block ── */
.cmd-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 24px 0;
  overflow: hidden;
}

.cmd-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}

.cmd-block-name {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
}

.cmd-block-tool {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-deep);
  padding: 3px 10px;
  border-radius: 4px;
}

.cmd-block-body { padding: 20px; }

.cmd-block-usage {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-bright);
  background: var(--code-bg);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.cmd-arg-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.cmd-arg-table th {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-align: left;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.cmd-arg-table td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.cmd-arg-table tr:last-child td { border-bottom: none; }

/* ── Troubleshooting Accordion ── */
.trouble-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.trouble-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  cursor: pointer;
  background: var(--bg-surface);
  font-weight: 600;
  color: var(--text-bright);
  font-size: 14px;
  list-style: none;
  transition: background 0.15s ease;
}

.trouble-summary:hover { background: var(--bg-raised); }

.trouble-summary::before {
  content: '>';
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  color: var(--accent);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

details[open] > .trouble-summary::before { transform: rotate(90deg); }

.trouble-body {
  padding: 4px 20px 20px 46px;
  font-size: 13.5px;
}

.trouble-body pre {
  margin: 10px 0;
}

/* ── Back to Top ── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--bg-raised);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top svg { width: 18px; height: 18px; }

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 48px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

.footer a { color: var(--accent-dim); }

/* ── Table of Contents (left sidebar) ── */
.toc {
  display: none;
}

.toc-label {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  padding-bottom: 10px;
}

.toc a {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc a.toc-h3 {
  padding-left: 24px;
  font-size: 12px;
}

.toc a:hover {
  color: var(--text);
}

.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

@media (min-width: 1200px) {
  .toc {
    display: block;
    position: fixed;
    top: 48px;
    left: calc(var(--sidebar-w) + 12px);
    width: 160px;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    scrollbar-width: none;
  }

  .toc::-webkit-scrollbar { display: none; }
}

@media (min-width: 1440px) {
  .toc {
    left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w) - 820px) / 4 - 70px);
    width: 180px;
  }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-toggle { display: flex; }
  .main { margin-left: 0; }
  .content { padding: 60px 20px 100px; }
  .hero h1 { font-size: 28px; }
  .card-grid { grid-template-columns: 1fr; }
  .pipeline-flow { justify-content: flex-start; }
  .arch-diagram { grid-template-columns: 1fr; gap: 16px; }
  .arch-arrows { flex-direction: row; padding: 0; justify-content: center; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .hero-btn { text-align: center; }
  .decision-grid { font-size: 12px; }
}