:root {
  --bg: #0e1210;
  --surface: #161c18;
  --panel: #1f2721;
  --line: #313e34;
  --ink: #edf2ea;
  --muted: #a8b8aa;
  --amber: #e5a93c;
  --amber-hi: #f2be5c;
  --amber-ink: #11100a;
  --signal: #5cd18f;
  --alert: #e06c58;
  --font-display: "Chakra Petch", system-ui, -apple-system, sans-serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 4px;
  --max-w: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color: var(--ink); scroll-behavior: smooth; }
body.sgw-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--amber); text-decoration: none; transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease; }
a:hover { color: var(--amber-hi); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.sgw-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sgw-skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 8px 14px;
  background: var(--amber);
  color: var(--amber-ink);
  font-weight: 700;
  z-index: 100;
}
.sgw-skip:focus { left: 12px; }

.sgw-shell {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
.sgw-frame { flex: 1 0 auto; }

/* Header */
.sgw-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.sgw-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.sgw-ident {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
}
.sgw-ident:hover { color: var(--amber); }
.sgw-reticle-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  color: var(--amber);
  background: var(--bg);
}
.sgw-menu-toggle {
  display: none;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.sgw-nav-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1 1 auto;
  justify-content: flex-end;
}
.sgw-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sgw-nav-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.sgw-nav-link:hover { background: var(--panel); color: var(--amber); }
.sgw-nav-link[aria-current="page"] { background: var(--panel); color: var(--amber); border: 1px solid var(--line); }

/* Search */
.sgw-search { position: relative; width: 250px; }
.sgw-search-input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
.sgw-search-input::placeholder { color: var(--muted); }
.sgw-search-input:focus { border-color: var(--amber); outline: none; }
.sgw-kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}
.sgw-search-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 340px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  z-index: 60;
}
.sgw-search-pop a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--ink);
}
.sgw-search-pop a:hover,
.sgw-search-pop a[data-active] { background: var(--panel); color: var(--amber); }
.sgw-r-title { font-size: 14px; font-weight: 600; }
.sgw-r-sec { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.sgw-r-note { margin: 0; padding: 10px; font-size: 13px; color: var(--muted); }

/* Hero Briefing */
.sgw-briefing {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 44px 0;
}
.sgw-briefing-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  align-items: center;
}
.sgw-telemetry-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.sgw-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
}
.sgw-hero-h1, .sgw-doc-h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.sgw-hero-h1 { font-size: 40px; }
.sgw-doc-h1 { font-size: 34px; }
.sgw-hero-lead, .sgw-doc-lead {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}
.sgw-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.sgw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
  border: 1px solid var(--line);
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.sgw-btn-primary {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: var(--amber);
}
.sgw-btn-primary:hover { background: var(--amber-hi); color: var(--amber-ink); border-color: var(--amber-hi); }
.sgw-btn-ghost { background: var(--panel); color: var(--ink); }
.sgw-btn-ghost:hover { border-color: var(--amber); color: var(--amber); }

.sgw-dossier-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 14px;
}
.sgw-hero-visual { margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sgw-stat-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.sgw-stat-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.sgw-stat-cell dt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.sgw-stat-cell dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

/* Bands & Headings */
.sgw-band { padding-top: 44px; padding-bottom: 12px; }
.sgw-band-head { margin-bottom: 18px; }
.sgw-kicker {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--signal);
}
.sgw-section-h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}
.sgw-inline-link { font-size: 14px; font-weight: 600; color: var(--amber); }
.sgw-inline-link:hover { color: var(--amber-hi); }

/* Ballistic Calculator Strip */
.sgw-calc-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.sgw-calc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.sgw-calc-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.sgw-field { display: flex; flex-direction: column; gap: 6px; }
.sgw-field label { font-size: 14px; color: var(--muted); }
.sgw-field label strong { color: var(--amber); font-family: var(--font-mono); }
.sgw-field select, .sgw-field input[type="range"] { width: 100%; }
.sgw-field select {
  padding: 9px 12px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}
.sgw-calc-readout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.sgw-readout-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.sgw-readout-item span { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sgw-readout-item strong { display: block; font-size: 15px; color: var(--ink); }

/* Numbered Mission Rows (Start Here) */
.sgw-mission-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.sgw-mission-link {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  height: 100%;
}
.sgw-mission-link:hover { border-color: var(--amber); background: var(--panel); color: var(--ink); }
.sgw-mission-num {
  flex: 0 0 auto;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
}
.sgw-mission-copy { display: flex; flex-direction: column; gap: 4px; }
.sgw-mission-title { font-family: var(--font-display); font-size: 17px; color: var(--ink); }
.sgw-mission-text { font-size: 14px; color: var(--muted); }

/* Sector Panels */
.sgw-sector-stack { display: flex; flex-direction: column; gap: 16px; }
.sgw-sector-panel {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 24px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sgw-sector-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sgw-sector-h3 { margin: 0; font-family: var(--font-display); font-size: 22px; }
.sgw-sector-h3 a { color: var(--ink); }
.sgw-sector-h3 a:hover { color: var(--amber); }
.sgw-badge {
  padding: 2px 8px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--signal);
}
.sgw-sector-desc { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.sgw-sector-entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sgw-sector-entries a {
  display: block;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.sgw-sector-entries a:hover { border-color: var(--amber); color: var(--amber); }

/* Cards */
.sgw-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.sgw-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 150ms ease;
}
.sgw-card:hover { border-color: var(--amber); }
.sgw-card-link { display: flex; flex-direction: column; height: 100%; color: var(--ink); }
.sgw-card-link:hover { color: var(--ink); }
.sgw-card-thumb { border-bottom: 1px solid var(--line); background: var(--bg); }
.sgw-card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; flex: 1 1 auto; }
.sgw-card-heading { margin: 0; font-family: var(--font-display); font-size: 19px; line-height: 1.3; color: var(--ink); }
.sgw-card-desc { margin: 0; font-size: 14px; color: var(--muted); flex: 1 1 auto; }
.sgw-card-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 12px; }
.sgw-card-date { color: var(--muted); }
.sgw-card-go { color: var(--amber); }

/* Article & Page Layouts */
.sgw-page-wrap { padding-top: 28px; padding-bottom: 56px; }
.sgw-narrow { max-width: 820px; }
.sgw-article-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 36px;
  padding-top: 28px;
  padding-bottom: 64px;
  align-items: start;
}
.sgw-rail {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sgw-infobox, .sgw-toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.sgw-rail-label {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--signal);
  text-transform: uppercase;
}
.sgw-dl { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.sgw-dl-row { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sgw-dl-row:last-child { padding-bottom: 0; border-bottom: 0; }
.sgw-dl-row dt { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.sgw-dl-row dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--ink); }

.sgw-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sgw-toc-list a {
  display: block;
  font-size: 13px;
  color: var(--muted);
  padding: 3px 0 3px 8px;
  border-left: 2px solid var(--line);
}
.sgw-toc-list a:hover,
.sgw-toc-list a[data-active] { color: var(--amber); border-left-color: var(--amber); }
.sgw-toc-sub { padding-left: 12px; }

.sgw-article-body { min-width: 0; max-width: 72ch; }
.sgw-crumbs { margin-bottom: 14px; }
.sgw-crumbs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}
.sgw-crumbs-list li + li::before { content: "/"; margin-right: 8px; color: var(--line); }
.sgw-doc-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.sgw-tag {
  padding: 3px 9px;
  background: var(--panel);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
}
.sgw-meta-text { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

.sgw-callout {
  margin: 20px 0 24px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--signal);
  border-radius: var(--radius);
}
.sgw-callout-label {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--signal);
  text-transform: uppercase;
}
.sgw-callout-text { margin: 0; font-size: 15px; color: var(--ink); }

.sgw-hero-fig {
  margin: 0 0 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.sgw-hero-fig figcaption {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* Prose */
.sgw-prose { font-size: 16px; line-height: 1.72; color: var(--ink); }
.sgw-manual-prose { max-width: 78ch; }
.sgw-prose h2 {
  margin: 34px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}
.sgw-prose h3 {
  margin: 24px 0 10px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--amber);
}
.sgw-prose p { margin: 0 0 16px; }
.sgw-prose ul, .sgw-prose ol { margin: 0 0 18px; padding-left: 22px; }
.sgw-prose li { margin-bottom: 8px; }
.sgw-prose strong { color: var(--ink); }
.sgw-prose blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  background: var(--surface);
  border-left: 3px solid var(--amber);
  color: var(--muted);
}
.sgw-prose img {
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sgw-scroll { overflow-x: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.sgw-prose table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
.sgw-prose th, .sgw-prose td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.sgw-prose th { background: var(--panel); font-family: var(--font-display); color: var(--amber); font-weight: 700; }

/* Filter & Timeline & FAQ */
.sgw-filter-bar { margin: 20px 0 24px; }
.sgw-filter-input {
  width: 100%;
  max-width: 420px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 15px;
}
.sgw-group-block { margin-bottom: 32px; }
.sgw-timeline { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.sgw-timeline-link {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
}
.sgw-timeline-link:hover { border-color: var(--amber); color: var(--ink); }
.sgw-timeline-date { font-family: var(--font-mono); font-size: 13px; color: var(--signal); }
.sgw-timeline-body { display: flex; flex-direction: column; gap: 4px; }
.sgw-timeline-title { font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.sgw-timeline-desc { font-size: 14px; color: var(--muted); }

.sgw-doc-faq, .sgw-related { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.sgw-faq-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.sgw-faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.sgw-faq-q { cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink); }
.sgw-faq-q:hover { color: var(--amber); }
.sgw-faq-a { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.sgw-notfound { padding-top: 64px; padding-bottom: 64px; }

/* Footer */
.sgw-footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 36px 0;
}
.sgw-footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 28px;
}
.sgw-footer-brand { margin: 0 0 8px; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); }
.sgw-footer-note, .sgw-footer-copy { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.sgw-footer-label { margin: 0 0 10px; font-family: var(--font-mono); font-size: 12px; color: var(--signal); text-transform: uppercase; letter-spacing: 0.08em; }
.sgw-footer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sgw-footer-list a { font-size: 14px; color: var(--muted); }
.sgw-footer-list a:hover { color: var(--amber); }

@media (max-width: 900px) {
  .sgw-briefing-grid,
  .sgw-sector-panel,
  .sgw-article-layout,
  .sgw-calc-controls,
  .sgw-calc-readout,
  .sgw-footer-grid { grid-template-columns: 1fr; }
  .sgw-rail { position: static; order: 2; }
  .sgw-article-body { order: 1; }
}

@media (max-width: 640px) {
  .sgw-shell { padding-left: 16px; padding-right: 16px; }
  .sgw-menu-toggle { display: inline-flex; }
  .sgw-topbar-row { flex-wrap: wrap; }
  .sgw-nav-wrap {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }
  .sgw-nav-wrap.is-open { display: flex; }
  .sgw-nav { flex-direction: column; align-items: stretch; }
  .sgw-search { width: 100%; }
  .sgw-hero-h1 { font-size: 30px; }
  .sgw-doc-h1 { font-size: 26px; }
  .sgw-mission-list, .sgw-card-grid { grid-template-columns: 1fr; }
  .sgw-timeline-link { grid-template-columns: 1fr; gap: 6px; }
}
