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

:root {
  /* Color */
  --bg: #181d25;
  --bg-alt: #1c222b;
  --panel: #232a34;
  --card: #262e39;
  --card-hover: #2d3542;
  --border: #3a4353;
  --border-soft: #2b323d;
  --text: #eef1f5;
  --text-dim: #b7bfcc;
  --muted: #7c8698;
  --accent: #4ee6a3;      /* LiDAR point-cloud green — from the Pilot 2 HUD telemetry text */
  --accent-dim: #2c8f66;
  --amber: #ff9d3d;        /* Pilot 2 status / highlight orange */
  --amber-dim: #a06a34;
  --danger: #ff6b6b;

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --sidebar-w: 272px;
  --content-w: 860px;
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; }

::selection { background: var(--accent-dim); color: #08110d; }

/* ---------- Layout shell ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-alt);
  border-right: 1px solid var(--border-soft);
  padding: 22px 18px 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scrollbar-width: thin;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

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

nav.toc { display: flex; flex-direction: column; gap: 2px; }

.toc-group { margin-bottom: 10px; }

.toc-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 4px;
}

.toc a {
  display: block;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 13.5px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.toc a.sub {
  font-size: 12.5px;
  padding-left: 22px;
  color: var(--muted);
}

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

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

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

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.6;
}

.sidebar-foot a { color: var(--text-dim); text-decoration: none; }
.sidebar-foot a:hover { color: var(--accent); }

/* Mobile topbar */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border-soft);
}

.topbar .brand { border: none; padding: 0; }

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

.menu-btn svg { width: 18px; height: 18px; }

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4,6,9,0.6);
  z-index: 30;
}

/* ---------- Main content ---------- */

main {
  min-width: 0;
  padding: 0 28px 90px;
}

.content {
  max-width: var(--content-w);
  margin: 0 auto;
}

/* Hero */

.hero {
  position: relative;
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 46px;
  overflow: hidden;
}

.hero canvas {
  position: absolute;
  inset: -20px -28px auto -28px;
  height: calc(100% + 20px);
  width: calc(100% + 56px);
  z-index: 0;
  opacity: 0.9;
}

.hero-inner { position: relative; z-index: 1; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px var(--accent);
}

h1.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

h1.hero-title em {
  font-style: normal;
  color: var(--accent);
}

.hero-desc {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 560px;
  margin: 0 0 22px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 100px;
}

/* Sections */

section.doc-section {
  margin-bottom: 64px;
  scroll-margin-top: 20px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

h2.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  margin: 0;
  letter-spacing: -0.005em;
}

.section-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 26px;
  max-width: 640px;
}

h3.subsection-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  margin: 38px 0 4px;
  display: flex;
  align-items: center;
  gap: 9px;
}

h3.subsection-title .tag {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 100px;
}

.subsection-desc {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 18px;
}

/* Step cards */

.step-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color .15s ease, background .15s ease;
}

.step-card:hover { border-color: var(--accent-dim); background: var(--card-hover); }

.step-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  background: rgba(78, 230, 163, 0.08);
  border: 1px solid var(--accent-dim);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-body p {
  margin: 0 0 12px;
  font-size: 14.5px;
  color: var(--text);
}

.step-card img {
  width: 100%;
  max-width: 460px;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #12161d;
  cursor: zoom-in;
  transition: filter .15s ease, border-color .15s ease;
}

.step-card img:hover {
  filter: brightness(1.06);
  border-color: var(--accent-dim);
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(8, 10, 13, 0.74);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.lightbox.open { opacity: 1; visibility: visible; }

.lightbox img {
  max-width: min(1100px, 90vw);
  max-height: 86vh;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 40px 90px -24px rgba(0, 0, 0, 0.65);
  transform: scale(0.96);
  transition: transform .22s ease;
  cursor: zoom-out;
}

.lightbox.open img { transform: scale(1); }

.lightbox-close {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox-close svg { width: 18px; height: 18px; }
.lightbox-close:hover { border-color: var(--accent-dim); color: var(--accent); }

@media (max-width: 600px) {
  .lightbox { padding: 20px; }
  .lightbox-close { top: 14px; right: 14px; }
}

/* Callouts */

.callout {
  display: flex;
  gap: 12px;
  background: rgba(255, 157, 61, 0.06);
  border: 1px solid var(--amber-dim);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 13.5px;
  color: var(--text-dim);
}

.callout.danger {
  background: rgba(255, 92, 92, 0.07);
  border-color: #8a3030;
  border-left-color: var(--danger);
}

.callout svg { flex-shrink: 0; width: 16px; height: 16px; margin-top: 2px; color: var(--amber); }
.callout.danger svg { color: var(--danger); }
.callout strong { color: var(--text); }

/* Resource links */

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.link-card {
  display: block;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.link-card:hover { border-color: var(--accent-dim); background: var(--card-hover); transform: translateY(-1px); }

.link-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.link-title svg { width: 12px; height: 12px; color: var(--muted); flex-shrink: 0; }

.link-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Checklist */

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  transition: border-color .15s ease, background .15s ease;
}

.check-item:hover { border-color: var(--accent-dim); }

.check-item.critical { border-left: 3px solid var(--danger); }

.check-item input {
  appearance: none;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}

.check-item input:checked {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.check-item input:checked::after {
  content: "";
  position: absolute;
  left: 5px; top: 1px;
  width: 4px; height: 8px;
  border: solid #08110d;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-item.done span.check-text { color: var(--muted); text-decoration: line-through; }

.checklist-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.checklist-foot button {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.checklist-foot button:hover { color: var(--accent); }

/* Spec table */

table.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 10px 0 4px;
}

table.spec-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

table.spec-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dim);
  vertical-align: top;
}

table.spec-table td:first-child {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}

table.spec-table tr.section-row td {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(78,230,163,0.04);
  padding-top: 14px;
}

table.spec-table td.led-green { color: var(--accent); }
table.spec-table td.led-yellow { color: var(--amber); }
table.spec-table td.led-red { color: var(--danger); }

.table-foot {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* Card grids: modes, routes */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.mini-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.mini-card h4 {
  font-family: var(--font-display);
  font-size: 14.5px;
  margin: 0 0 5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}

.mini-card h4 .swatch {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.mini-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }

/* Jump-back card (Data Processing) */

.jump-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.jump-card p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 420px; }

.jump-card h4 { margin: 0; font-family: var(--font-display); font-size: 16px; }

.jump-btn {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--bg);
  background: var(--accent);
  border: none;
  padding: 10px 16px;
  border-radius: 100px;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}

.jump-btn:hover { background: #6ef0b6; }

/* Footer */

.page-foot {
  border-top: 1px solid var(--border-soft);
  margin-top: 60px;
  padding-top: 22px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.page-foot a { color: var(--text-dim); text-decoration: none; }
.page-foot a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .link-grid, .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }

  .topbar { display: flex; }

  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 82%;
    max-width: 300px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 50;
  }

  .sidebar.open { transform: translateX(0); }

  .scrim.open { display: block; }

  main { padding: 0 16px 70px; }

  .hero { padding: 36px 0 28px; }

  .step-card { grid-template-columns: 32px 1fr; }

  .step-num { width: 26px; height: 26px; font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- Accessibility ---------- */

a:focus-visible,
button:focus-visible,
.check-item input:focus-visible,
.link-card:focus-visible,
.toc a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
