:root {
  --void: #080a0f;
  --deck: #10141e;
  --panel: #171d2b;
  --panel-hi: #1f2739;
  --ink: #edf1f7;
  --muted: #9aa8bf;
  --amber: #f09a3e;
  --amber-hi: #f6b267;
  --signal: #45d69b;
  --alert: #eb5e55;
  --edge: #253047;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --frame: 1140px;
  --r-sm: 4px;
  --r-md: 8px;
}

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

html {
  background: var(--void);
  color: var(--ink);
  scroll-behavior: smooth;
}

body.console-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--amber);
  text-decoration: none;
}

a:hover {
  color: var(--amber-hi);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--amber);
  color: var(--void);
  padding: 10px 16px;
  font-weight: 700;
  z-index: 100;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

.deck-frame {
  width: 100%;
  max-width: var(--frame);
  margin: 0 auto;
  padding: 0 20px;
}

.deck-main {
  flex: 1 0 auto;
}

/* Telemetry status strip */
.rec-strip {
  background: var(--deck);
  border-bottom: 1px solid var(--edge);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.rec-strip-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.rec-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--amber);
  font-weight: 700;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--alert);
}

.rec-note {
  color: var(--muted);
}

/* Header */
.console-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--void);
  border-bottom: 1px solid var(--edge);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-lockup:hover {
  text-decoration: none;
  color: var(--amber);
}

.brand-emblem {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--amber);
  border-radius: var(--r-sm);
  color: var(--amber);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  background: var(--panel);
  border-color: var(--edge);
  color: var(--amber);
  text-decoration: none;
}

/* Search console */
.search-console {
  position: relative;
  width: 260px;
  max-width: 100%;
}

.search-field {
  width: 100%;
  background: var(--deck);
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 8px 34px 8px 12px;
}

.search-field::placeholder {
  color: var(--muted);
}

.search-field:hover {
  border-color: var(--amber);
}

.search-hint {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--edge);
  background: var(--panel);
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
}

.search-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 340px;
  max-width: 92vw;
  background: var(--deck);
  border: 1px solid var(--amber);
  border-radius: var(--r-md);
  padding: 6px;
  z-index: 60;
}

.search-dropdown a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
}

.search-dropdown a:hover,
.search-dropdown a[data-active] {
  background: var(--panel-hi);
  color: var(--amber);
}

.bb-r-title {
  font-size: 14px;
  font-weight: 600;
}

.bb-r-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.bb-r-note {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

/* Telemetry kicker & titles */
.telemetry-kicker {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--signal);
}

.dossier-hero {
  background: var(--deck);
  border-bottom: 1px solid var(--edge);
  padding: 44px 0 48px;
}

.dossier-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 32px;
  align-items: start;
}

.dossier-h1 {
  margin: 0 0 14px;
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.dossier-summary {
  margin: 0 0 24px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cmd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.cmd-btn:hover {
  background: var(--panel-hi);
  border-color: var(--amber);
  color: var(--amber);
  text-decoration: none;
}

.cmd-btn-amber {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--void);
}

.cmd-btn-amber:hover {
  background: var(--amber-hi);
  border-color: var(--amber-hi);
  color: var(--void);
}

/* Hero telemetry box */
.telemetry-box {
  background: var(--void);
  border: 1px solid var(--edge);
  border-top: 3px solid var(--amber);
  border-radius: var(--r-md);
  overflow: hidden;
}

.telemetry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--edge);
  font-family: var(--font-mono);
  font-size: 12px;
}

.telemetry-code {
  color: var(--ink);
  font-weight: 700;
}

.telemetry-live {
  color: var(--signal);
  font-weight: 700;
}

.telemetry-visual {
  margin: 0;
  border-bottom: 1px solid var(--edge);
  background: var(--deck);
}

.telemetry-visual img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.telemetry-specs {
  margin: 0;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.telemetry-specs div {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 8px;
}

.telemetry-specs div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.telemetry-specs dt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.telemetry-specs dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}

/* Band sections */
.band-section {
  padding-top: 40px;
  padding-bottom: 10px;
}

.band-header {
  margin-bottom: 18px;
}

.band-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  color: var(--ink);
}

/* Numbered Emergency Briefing Checklist */
.checklist-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  counter-reset: briefing;
}

.checklist-row {
  counter-increment: briefing;
}

.checklist-link {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 16px;
  background: var(--deck);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--amber);
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
  height: 100%;
}

.checklist-link:hover {
  background: var(--panel);
  border-color: var(--amber);
  text-decoration: none;
}

.step-tag {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  background: var(--panel);
  border: 1px solid var(--edge);
  padding: 3px 7px;
  border-radius: 3px;
}

.step-tag::after {
  content: " 0" counter(briefing);
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-name {
  font-size: 16px;
  color: var(--ink);
}

.step-desc {
  font-size: 14px;
  color: var(--muted);
}

/* Archive folder directory */
.archive-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.archive-folder {
  background: var(--deck);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  padding: 20px;
}

.folder-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.folder-name {
  margin: 0;
  font-size: 20px;
}

.folder-name a {
  color: var(--ink);
}

.folder-name a:hover {
  color: var(--amber);
}

.folder-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--signal);
  background: var(--panel);
  border: 1px solid var(--edge);
  padding: 3px 9px;
  border-radius: 99px;
}

.folder-summary {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
}

.folder-links {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 14px;
}

/* Log matrix cards */
.log-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.log-card {
  display: flex;
  flex-direction: column;
  background: var(--deck);
  border: 1px solid var(--edge);
  border-top: 2px solid var(--edge);
  border-radius: var(--r-md);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
}

.log-card:hover {
  background: var(--panel);
  border-color: var(--amber);
  border-top-color: var(--amber);
  text-decoration: none;
}

.log-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--edge);
}

.log-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-stamp {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--signal);
}

.log-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.log-excerpt {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

/* Homepage dossier prose shell */
.manual-shell {
  background: var(--deck);
  border: 1px solid var(--edge);
  border-left: 4px solid var(--signal);
  border-radius: var(--r-md);
  padding: 28px 30px;
  margin-bottom: 36px;
}

/* Article reading desk */
.reading-desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 32px;
  padding-top: 26px;
  padding-bottom: 56px;
  align-items: start;
}

.reading-primary {
  min-width: 0;
}

.reading-rail {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 18px;
}

.section-shell {
  padding-top: 26px;
  padding-bottom: 56px;
}

.narrow-shell {
  max-width: 820px;
  padding-top: 26px;
  padding-bottom: 56px;
}

.trail-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.trail-sep {
  color: var(--edge);
}

.trail-here {
  color: var(--ink);
}

.entry-header,
.section-banner {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--edge);
}

.page-h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.page-subtitle {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

.entry-meta-strip {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--signal);
}

.meta-sep {
  color: var(--muted);
}

.entry-cover {
  margin: 0 0 24px;
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--deck);
}

/* Quick Answer Mission Brief */
.brief-callout {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 4px solid var(--amber);
  border-radius: var(--r-sm);
  padding: 16px 18px;
  margin-bottom: 24px;
}

.brief-tag {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
}

.brief-copy {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
}

/* Rail cards */
.rail-card {
  background: var(--deck);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  padding: 16px;
}

.rail-title {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--edge);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.rail-specs {
  margin: 0;
  display: grid;
  gap: 10px;
}

.rail-spec-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--edge);
}

.rail-spec-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.rail-spec-row dt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.rail-spec-row dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.toc-list a {
  display: block;
  font-size: 13px;
  color: var(--muted);
  padding: 3px 0 3px 10px;
  border-left: 2px solid transparent;
}

.toc-list a:hover,
.toc-list a[data-active] {
  color: var(--amber);
  border-left-color: var(--amber);
  text-decoration: none;
}

.toc-sub a {
  padding-left: 20px;
  font-size: 12px;
}

/* Prose styling */
.manual-prose h2 {
  margin: 30px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--edge);
  font-size: 23px;
  line-height: 1.3;
  color: var(--ink);
}

.manual-prose h3 {
  margin: 22px 0 8px;
  font-size: 18px;
  line-height: 1.35;
  color: var(--amber-hi);
}

.manual-prose p {
  margin: 0 0 14px;
  color: var(--ink);
}

.manual-prose ul,
.manual-prose ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.manual-prose li {
  margin-bottom: 6px;
}

.manual-prose code {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--edge);
  color: var(--signal);
  padding: 1px 6px;
  border-radius: 3px;
}

.manual-prose blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  background: var(--panel);
  border-left: 3px solid var(--amber);
  border-radius: var(--r-sm);
  color: var(--ink);
}

.manual-prose blockquote p:last-child {
  margin-bottom: 0;
}

.bb-scroll {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
}

.manual-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--deck);
}

.manual-prose th,
.manual-prose td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
}

.manual-prose th {
  background: var(--panel);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Filter bar */
.filter-bar {
  margin-bottom: 20px;
}

.filter-input {
  width: 100%;
  max-width: 380px;
  background: var(--deck);
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 14px;
  padding: 10px 14px;
}

.filter-input::placeholder {
  color: var(--muted);
}

/* FAQ & Related */
.faq-block,
.related-block {
  margin-top: 38px;
  padding-top: 24px;
  border-top: 1px solid var(--edge);
}

.faq-stack {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.faq-item {
  background: var(--deck);
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  padding: 12px 16px;
}

.faq-q {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.faq-q:hover {
  color: var(--amber);
}

.faq-a {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.related-block .log-matrix {
  margin-top: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Timeline feed (/recent) */
.timeline-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.timeline-link {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background: var(--deck);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  color: var(--ink);
  text-decoration: none;
}

.timeline-link:hover {
  background: var(--panel);
  border-color: var(--amber);
  text-decoration: none;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--signal);
  padding-top: 2px;
}

.timeline-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-title {
  font-size: 17px;
  color: var(--ink);
}

.timeline-desc {
  font-size: 14px;
  color: var(--muted);
}

/* Footer */
.console-footer {
  margin-top: auto;
  background: var(--deck);
  border-top: 1px solid var(--edge);
  padding: 36px 0;
}

.footer-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 0.8fr);
  gap: 28px;
}

.footer-brand {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.footer-note,
.footer-copy {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.footer-heading {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.footer-col-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.footer-col-links a {
  color: var(--muted);
}

.footer-col-links a:hover {
  color: var(--amber);
}

@media (max-width: 920px) {
  .dossier-grid,
  .reading-desk,
  .footer-columns {
    grid-template-columns: 1fr;
  }

  .reading-rail {
    position: static;
  }

  .log-matrix {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .header-bar {
    flex-wrap: wrap;
  }

  .search-console {
    width: 100%;
  }

  .rec-note {
    display: none;
  }

  .dossier-h1 {
    font-size: 30px;
  }

  .page-h1 {
    font-size: 27px;
  }

  .checklist-grid,
  .log-matrix,
  .related-block .log-matrix,
  .timeline-link {
    grid-template-columns: 1fr;
  }

  .manual-shell {
    padding: 20px 18px;
  }
}
