:root {
  /* zone colors — used consistently everywhere a zone is referenced */
  --wd:      #E8A33D;
  --staging: #4FB0C6;
  --local:   #8B7FD6;
  --remote:  #E8654E;

  --wd-soft:      rgba(232, 163, 61, 0.14);
  --staging-soft: rgba(79, 176, 198, 0.14);
  --local-soft:   rgba(139, 127, 214, 0.14);
  --remote-soft:  rgba(232, 101, 78, 0.14);

  /* dark (default) surface */
  --bg: #0A0D13;
  --bg-raised: #0F1319;
  --surface: #131826;
  --surface-2: #1A2033;
  --border: #262C40;
  --text: #E9ECF4;
  --text-muted: #8B93A9;
  --text-faint: #5A6178;

  --font-display: "Space Grotesk", ui-sans-serif, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 12px 32px rgba(0,0,0,0.35);
}

[data-theme="light"] {
  --bg: #EEF1F6;
  --bg-raised: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #F1F3F9;
  --border: #DBE0EA;
  --text: #161A24;
  --text-muted: #565F75;
  --text-faint: #8891A5;
  --shadow: 0 12px 28px rgba(30,40,60,0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* faint commit-graph texture in the background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  background-image:
    radial-gradient(circle at 40px 30px, var(--text-faint) 1.6px, transparent 1.6px),
    radial-gradient(circle at 110px 90px, var(--text-faint) 1.6px, transparent 1.6px),
    linear-gradient(var(--text-faint) 1px, transparent 1px);
  background-size: 140px 140px, 140px 140px, 140px 140px;
}

a { color: inherit; }
button { font-family: inherit; }

code, .mono { font-family: var(--font-mono); }

::selection { background: var(--staging); color: #06121A; }

/* focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--staging);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- LAYOUT */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ------------------------------------------------------------- SIDEBAR */

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-raised);
  padding: 20px 14px 40px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  text-decoration: none;
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--wd), var(--staging) 35%, var(--local) 68%, var(--remote));
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  color: #0A0D13;
  flex-shrink: 0;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-text small {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 1px;
}

.nav-category { margin-bottom: 4px; }

.nav-category-label {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 8px 6px;
  cursor: pointer;
}

.nav-category-label .chevron {
  transition: transform 0.18s ease;
  color: var(--text-faint);
  font-size: 10px;
}

.nav-category.collapsed .chevron { transform: rotate(-90deg); }
.nav-category.collapsed .nav-list { display: none; }

.nav-list { list-style: none; margin: 0; padding: 0 0 6px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 20px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13.5px;
  position: relative;
}

.nav-link:hover { background: var(--surface); color: var(--text); }

.nav-link.active {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 6px; top: 50%;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--staging);
  transform: translateY(-50%);
}

.nav-link.soon {
  color: var(--text-faint);
  cursor: default;
}

.nav-link .soon-tag {
  margin-left: auto;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 6px;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* ------------------------------------------------------------- MAIN */

.main { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.search-wrap svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

#search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 8px 14px 8px 34px;
  font-family: var(--font-mono);
  font-size: 13.5px;
}

#search-input::placeholder { color: var(--text-faint); }

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 7px 13px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-faint); }

/* mini persistent pipeline strip in the topbar */
.mini-line {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 28px 10px;
}

.mini-station {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  padding: 3px 8px 3px 6px;
  border-radius: 20px;
  transition: background 0.2s, color 0.2s;
}

.mini-station .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}

.mini-station.on {
  color: var(--zone-color);
  background: var(--zone-soft);
}
.mini-station.on .dot { opacity: 1; }

.mini-rail {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--border) 0 5px, transparent 5px 9px);
  margin: 0 2px;
}

/* ------------------------------------------------------------ CONTENT */

.content { padding: 26px 28px 90px; max-width: 880px; }

.category-header {
  padding: 40px 0 8px;
}

.category-header h1 {
  font-family: var(--font-display);
  font-size: 30px;
  margin: 0 0 8px;
}

.category-header p { color: var(--text-muted); max-width: 60ch; }

.soon-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  gap: 8px;
}
.soon-list li {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 14px;
}

/* home hero */
.home-hero { padding: 30px 0 10px; }
.home-hero .kicker {
  font-family: var(--font-mono);
  color: var(--staging);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.home-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 12px 0 14px;
  max-width: 16ch;
}
.home-hero p { color: var(--text-muted); max-width: 56ch; font-size: 16.5px; }

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 30px;
}
.home-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.15s, transform 0.15s;
}
.home-card:hover { border-color: var(--staging); transform: translateY(-2px); }
.home-card .cmd { font-family: var(--font-mono); font-size: 14.5px; }
.home-card .sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-top: 4px; }

/* ------------------------------------------------------------ CMD PAGE */

.cmd-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 24px;
}

.cmd-title {
  font-family: var(--font-mono);
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 700;
  margin: 6px 0 12px;
}

.cmd-summary {
  font-size: 17.5px;
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0 0 30px;
}

section.block { margin: 40px 0; }

.block-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.block-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* syntax */
.syntax-list { display: grid; gap: 10px; }
.syntax-row {
  display: grid;
  grid-template-columns: minmax(160px, auto) 1fr;
  gap: 4px 18px;
  align-items: baseline;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.syntax-cmd {
  font-family: var(--font-mono);
  font-size: 14.5px;
  color: var(--staging);
  white-space: nowrap;
}
.syntax-note { color: var(--text-muted); font-size: 14px; }

.copy-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  margin-left: 10px;
}
.copy-btn:hover { color: var(--text); border-color: var(--staging); }
.copy-btn.copied { color: var(--staging); border-color: var(--staging); }

/* scenario */
.scenario-box {
  border-left: 3px solid var(--local);
  background: var(--local-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  font-size: 15.5px;
  color: var(--text);
}
.scenario-box::before {
  content: "SCENARIO";
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--local);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

/* errors */
.error-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 10px;
  overflow: hidden;
}
.error-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 13px 14px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
}
.error-toggle .bang {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 5px;
  background: var(--remote-soft);
  color: var(--remote);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.error-toggle .err-text { flex: 1; color: var(--text-muted); }
.error-toggle .chevron { color: var(--text-faint); transition: transform 0.18s; font-size: 11px; }
.error-item.open .chevron { transform: rotate(180deg); }

.error-body {
  display: none;
  padding: 0 16px 16px 42px;
  font-family: var(--font-body);
}
.error-item.open .error-body { display: block; }
.error-body dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 10px;
}
.error-body dd { margin: 4px 0 0; color: var(--text); font-size: 14.5px; }

/* related */
.related-row { display: flex; flex-wrap: wrap; gap: 8px; }
.related-chip {
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-muted);
}
.related-chip:hover { border-color: var(--staging); color: var(--text); }

/* --------------------------------------------------------- THE PIPELINE */

.pipeline {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px 22px 20px;
  position: relative;
}

.pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
  flex-wrap: wrap;
}

.pipeline-state-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.pipeline-state-label b { color: var(--staging); font-weight: 600; }

.run-btn {
  background: linear-gradient(135deg, var(--staging), var(--local));
  border: none;
  color: #06121A;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.run-btn:hover { filter: brightness(1.08); }
.run-btn:active { transform: translateY(1px); }
.run-btn .icon { font-size: 12px; }

.track-wrap { position: relative; padding-top: 6px; }

.track-rail {
  position: absolute;
  left: 60px; right: 60px; top: 32px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.stations {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  position: relative;
  z-index: 1;
}

.station {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.station-node {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid var(--zone-color);
  background: var(--bg-raised);
  transition: box-shadow 0.25s;
}

.station.active .station-node {
  box-shadow: 0 0 0 6px var(--zone-soft);
}

.station-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--zone-color);
  letter-spacing: 0.04em;
}
.station-name {
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 12ch;
}

.station-chips {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 26px;
  align-items: center;
}

.file-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid var(--zone-color);
  color: var(--zone-color);
  background: var(--zone-soft);
  white-space: nowrap;
  animation: chip-in 0.32s ease both;
}

@keyframes chip-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.runner {
  position: absolute;
  top: 26px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 4px var(--bg-raised), 0 0 14px 2px var(--staging);
  z-index: 2;
  opacity: 0;
  transition: left 0.7s cubic-bezier(.65,.05,.36,1), opacity 0.2s;
  pointer-events: none;
}
.runner.visible { opacity: 1; }

.action-label {
  text-align: center;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
}
.action-label b { color: var(--text); }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .runner { transition: none; }
  .file-chip { animation: none; }
  html { scroll-behavior: auto; }
}

/* static (no-op) pipeline pill, e.g. git config / git remote listing */

.static-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  border: 1px dashed var(--border);
  padding: 7px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

/* title variant for non-command pages (Worked Examples) */

.cmd-title.prose-title {
  font-family: var(--font-display);
  text-transform: none;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------- WALKTHROUGH */

.walkthrough {
  display: grid;
  margin: 26px 0 36px;
}

.wt-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}
.wt-step:first-child { border-top: none; padding-top: 6px; }

.wt-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.wt-cmd-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wt-cmd {
  font-size: 14.5px;
  color: var(--staging);
  background: var(--staging-soft);
  padding: 5px 10px;
  border-radius: 6px;
}

.wt-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap;
  margin: 10px 0 0;
}

.wt-why {
  color: var(--text);
  font-size: 14.5px;
  margin: 10px 0 0;
  max-width: 68ch;
}

.walkthrough-outro {
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 4px;
  font-size: 15px;
  max-width: 68ch;
}

/* --------------------------------------------------------------- FOOTER */

.page-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding-top: 20px;
  color: var(--text-faint);
  font-size: 12.5px;
  font-family: var(--font-mono);
}

/* -------------------------------------------------------- SEARCH RESULTS */

.search-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 340px;
  overflow-y: auto;
  z-index: 20;
  display: none;
}
.search-panel.open { display: block; }
.search-result {
  display: block;
  padding: 11px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--surface-2); }
.search-result .cmd {
  font-family: var(--font-mono);
  color: var(--staging);
  font-size: 13.5px;
}
.search-result .ctx {
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 2px;
}
.search-empty {
  padding: 16px;
  color: var(--text-faint);
  font-size: 13px;
  font-family: var(--font-mono);
}

/* ------------------------------------------------------------ MOBILE */

.menu-btn {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 270px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 30;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 25;
  }
  .scrim.open { display: block; }
  .content { padding: 20px 16px 70px; }
  .track-rail { left: 30px; right: 30px; }
  .syntax-row { grid-template-columns: 1fr; }
}
