:root {
  color-scheme: dark;
  --bg: #070b16; --panel: #0d1424; --panel-2: #111a2e; --line: #1f2b45;
  --text: #e6ecf7; --muted: #a9b6cf; --accent: #22d3ee; --accent-ink: #04202a;
  --blue: #5b9cff; --warn: #fbbf24; --radius: 14px; --side: 290px; --top: 64px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 16px; padding: 0 20px; background: rgba(7, 11, 22, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue), var(--accent)); color: #04121c; font-weight: 800; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-sub { color: var(--muted); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--line); }
.brand-sub:hover { color: var(--text); }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input { width: 100%; height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: 16px; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.results { position: absolute; top: 48px; left: 0; right: 0; max-height: 60vh; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .5); }
.results a { display: block; padding: 10px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); font-size: 15px; }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a:focus { background: #16223c; outline: none; }
.results small { display: block; color: var(--muted); }
.results .none { padding: 12px 14px; color: var(--muted); }
.cta { padding: 9px 16px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.menu-btn { display: none; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 20px; cursor: pointer; }

.layout { display: flex; align-items: flex-start; }
.sidebar { position: sticky; top: var(--top); width: var(--side); flex: none; height: calc(100vh - var(--top)); overflow-y: auto; padding: 18px 12px 40px; border-right: 1px solid var(--line); background: var(--bg); }
.nav-group { margin-bottom: 18px; }
.nav-label { padding: 6px 12px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.sidebar a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15.5px; line-height: 1.35; }
.sidebar a:hover { color: var(--text); background: var(--panel); }
.sidebar a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }

.content { flex: 1; min-width: 0; max-width: 980px; padding: 36px 40px 80px; margin: 0 auto; }
.hero { padding: 8px 0 28px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0 0 10px; font-size: clamp(30px, 4vw, 42px); line-height: 1.15; text-wrap: balance; }
.lead { margin: 0; color: var(--muted); font-size: 19px; max-width: 62ch; }
.part-title { margin: 56px 0 0; padding: 10px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); font-weight: 700; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
section { padding-top: 34px; }
h2 { margin: 0 0 12px; font-size: 28px; line-height: 1.2; }
h2 a { color: inherit; text-decoration: none; }
h2 a:hover::after { content: " #"; color: var(--muted); }
h3 { margin: 30px 0 8px; font-size: 21px; line-height: 1.3; }
p { margin: 0 0 14px; max-width: 72ch; }
ul, ol { margin: 0 0 16px; padding-left: 24px; max-width: 72ch; }
li { margin-bottom: 7px; }
strong { color: #fff; }
code { padding: 2px 6px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); font-size: .9em; overflow-wrap: anywhere; }

ol.steps { list-style: none; padding-left: 0; counter-reset: step; }
ol.steps li { position: relative; padding: 2px 0 2px 46px; margin-bottom: 12px; counter-increment: step; }
ol.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

.note { margin: 18px 0; padding: 14px 18px; border-radius: 12px; background: rgba(34, 211, 238, .08); border: 1px solid rgba(34, 211, 238, .35); max-width: 72ch; }

.table-wrap { overflow-x: auto; margin: 14px 0 22px; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--panel-2); color: var(--muted); font-size: 13.5px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { min-width: 130px; }

figure { margin: 20px 0 26px; }
.shot { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #000; cursor: zoom-in; }
.shot:hover, .shot:focus-visible { border-color: var(--accent); outline: none; }
figcaption { margin-top: 8px; color: var(--muted); font-size: 15px; }

.foot { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }

.lightbox { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(2, 5, 12, .93); cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; border: 1px solid var(--line); }
.lb-close { position: absolute; top: 14px; right: 18px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 24px; cursor: pointer; }

@media (max-width: 900px) {
  .menu-btn { display: block; }
  .brand-sub, .cta { display: none; }
  .sidebar { position: fixed; top: var(--top); left: 0; z-index: 25; transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 40px rgba(0, 0, 0, .5); }
  .sidebar.open { transform: none; }
  .content { padding: 24px 16px 60px; }
  h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .sidebar { transition: none; } }
@media print {
  .topbar, .sidebar, .lightbox { display: none !important; }
  body { background: #fff; color: #000; }
  .content { max-width: none; padding: 0; }
  strong { color: #000; } .part-title, th, .note, code { background: #f2f2f2; color: #000; }
  figure, table { break-inside: avoid; }
}

.open { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; color: var(--muted); }
.open strong { color: var(--muted); font-weight: 600; }
.open a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: rgba(34, 211, 238, .12); border: 1px solid rgba(34, 211, 238, .45); color: var(--accent); font-weight: 600; text-decoration: none; }
.open a::after { content: "\2197"; font-size: .9em; }
.open a:hover, .open a:focus-visible { background: var(--accent); color: var(--accent-ink); outline: none; }
@media print { .open a { border: 0; padding: 0; } .open a::after { content: " (" attr(href) ")"; } }
