/* systembunker.com — Interactive Engineering IDE & Telemetry Workbench
 * Distinct identity from digitalxbunker.com: pure monospace + Swiss technical sans,
 * multi-pane IDE shell (activity rail + file explorer + tabbed editor + live terminal).
 * Zero Big Shoulders Display, zero game-menu layout, zero cookies, zero external CDNs.
 */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/brand/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/brand/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/brand/fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #080a0e;
  --bg-chrome: #0c0f15;
  --bg-panel: #0f131b;
  --bg-elev: #141a24;
  --border: #1d2431;
  --border-hi: #303d52;
  --text: #eef2f7;
  --text-2: #9aa7b8;
  --muted: #606e82;
  --emerald: #2dd4a8;
  --emerald-dim: rgba(45, 212, 168, 0.12);
  --amber: #f5a524;
  --amber-dim: rgba(245, 165, 36, 0.13);
  --blue: #68b5ff;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r: 3px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img, video { display: block; max-width: 100%; }
code, pre, kbd { font-family: var(--mono); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 999; background: var(--emerald); color: #05080a; padding: 6px 10px; font-family: var(--mono); font-size: 12px; }

/* ---- IDE TITLEBAR (SHARED ACROSS ALL PAGES) ---- */
.titlebar {
  position: sticky; top: 0; z-index: 80;
  height: 42px;
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 460px) minmax(0, 1fr);
  align-items: center;
  padding: 0 14px; gap: 12px;
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: #ffffff;
  white-space: nowrap;
}
.tb-brand svg { height: 17px; width: auto; color: var(--emerald); }
.tb-crumb {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-crumb span { color: var(--text-2); }

.tb-search {
  width: 100%; height: 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
}
.tb-search:hover { border-color: var(--border-hi); color: var(--text); }
.tb-search kbd {
  font-size: 10px; padding: 1px 5px; border: 1px solid var(--border);
  border-radius: 2px; color: var(--emerald); background: var(--bg-chrome);
}

.tb-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.status-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; color: var(--emerald);
  background: var(--emerald-dim); border: 1px solid rgba(45, 212, 168, 0.25);
  border-radius: var(--r); padding: 3px 8px; white-space: nowrap;
}
.status-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--emerald);
}
.tb-link {
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
  padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--r);
  white-space: nowrap;
}
.tb-link:hover { color: #ffffff; border-color: var(--border-hi); }

/* ---- WORKBENCH APP SHELL (HOME PAGE FULL VIEWPORT) ---- */
.ide-shell {
  height: calc(100vh - 42px - 26px);
  min-height: 620px;
  display: grid;
  grid-template-columns: 46px 264px minmax(0, 1fr);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

/* Activity Bar */
.actbar {
  background: var(--bg-chrome);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 8px 0;
}
.actbar__group { display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center; }
.actbtn {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r); color: var(--muted);
  transition: color 0.12s, background 0.12s;
}
.actbtn:hover, .actbtn.is-on { color: #ffffff; background: var(--bg-elev); }
.actbtn.is-on::before {
  content: ""; position: absolute; left: -5px; top: 7px; bottom: 7px;
  width: 2px; background: var(--emerald);
}
.actbtn svg { width: 18px; height: 18px; }

/* Left Explorer Tree */
.explorer {
  background: var(--bg-chrome);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.explorer__head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--muted);
}
.explorer__tree {
  flex: 1; overflow-y: auto; padding: 8px 6px 14px 6px;
  font-family: var(--mono); font-size: 12px;
}
.tree-group { margin-bottom: 10px; }
.tree-dir {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; color: var(--text-2); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tree-dir small { color: var(--muted); font-size: 10px; }
.tree-file {
  width: 100%; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 5px 8px 5px 16px; border-radius: 2px;
  color: var(--text-2); font-size: 12px;
  transition: background 0.1s, color 0.1s;
}
.tree-file:hover { background: var(--bg-panel); color: #ffffff; }
.tree-file.is-active {
  background: var(--emerald-dim); color: #ffffff;
  box-shadow: inset 2px 0 0 var(--emerald);
}
.tree-file__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-file__tag {
  font-size: 9.5px; padding: 1px 5px; border-radius: 2px;
  background: var(--bg); border: 1px solid var(--border); color: var(--muted); flex-shrink: 0;
}
.tree-file.is-active .tree-file__tag { color: var(--emerald); border-color: rgba(45, 212, 168, 0.35); }
.ext-dot { display: inline-block; width: 6px; height: 6px; border-radius: 1px; margin-right: 6px; flex-shrink: 0; }
.ext-md { background: var(--emerald); }
.ext-prof { background: var(--amber); }
.ext-json { background: var(--blue); }
.ext-spec { background: #b794f6; }
.ext-sys { background: #718096; }

/* Center Workspace Column (Tabs + Editor + Terminal) */
.workspace {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--bg);
}

/* Editor Tabs Bar */
.tabs {
  height: 35px; background: var(--bg-chrome); border-bottom: 1px solid var(--border);
  display: flex; align-items: stretch; overflow-x: auto; flex-shrink: 0;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 14px; border-right: 1px solid var(--border);
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  white-space: nowrap; position: relative;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.02); }
.tab.is-active {
  background: var(--bg); color: #ffffff;
}
.tab.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--emerald);
}

/* Main Editor Viewport */
.editor-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 20px 24px 24px 24px;
  background-image:
    linear-gradient(rgba(148, 175, 215, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 175, 215, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
}
.ed-pane[hidden] { display: none; }

/* Release View Inside IDE */
.ed-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.ed-path { font-family: var(--mono); font-size: 11px; color: var(--emerald); letter-spacing: 0.06em; margin-bottom: 4px; }
.ed-title { font-family: var(--mono); font-size: 22px; font-weight: 500; color: #ffffff; letter-spacing: -0.02em; line-height: 1.25; }
.ed-sub { font-size: 13.5px; color: var(--text-2); max-width: 720px; margin-top: 4px; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-solid {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r);
  background: var(--emerald); color: #05110d;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
}
.btn-solid:hover { background: #4be3ba; }
.btn-line {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r);
  border: 1px solid var(--border-hi); background: var(--bg-panel); color: var(--text);
  font-family: var(--mono); font-size: 11.5px;
}
.btn-line:hover { border-color: var(--emerald); color: #ffffff; }

.split-stage {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.95fr);
  gap: 16px; margin-bottom: 16px;
}
.stage-card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; display: flex; flex-direction: column;
}
.stage-card__bar {
  padding: 7px 11px; background: var(--bg-chrome); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
}
.stage-card__bar strong { color: var(--text); font-weight: 500; }
.stage-video video { width: 100%; aspect-ratio: 16 / 9; background: #000; }

.spec-list { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.spec-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding-bottom: 8px; border-bottom: 1px dashed var(--border);
  font-family: var(--mono); font-size: 12px;
}
.spec-row:last-child { border-bottom: none; padding-bottom: 0; }
.spec-k { color: var(--muted); }
.spec-v { color: #ffffff; font-weight: 500; text-align: right; }
.spec-v--ok { color: var(--emerald); }
.spec-v--amber { color: var(--amber); }

.bento-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.bento-thumb {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; transition: border-color 0.15s; cursor: zoom-in;
}
.bento-thumb:hover { border-color: var(--emerald); }
.bento-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.bento-thumb__cap {
  padding: 7px 10px; font-family: var(--mono); font-size: 11px; color: var(--text-2);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between;
}

/* Profiler Bars (benchmarks.prof tab) */
.prof-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.prof-card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.prof-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-family: var(--mono); }
.prof-metric { font-size: 24px; font-weight: 500; color: var(--emerald); }
.prof-ceil { font-size: 11px; color: var(--muted); }
.prof-bar { height: 8px; background: #070a0f; border: 1px solid var(--border); border-radius: 2px; overflow: hidden; }
.prof-fill { height: 100%; background: linear-gradient(90deg, var(--emerald), #64e8c4); }
.prof-fill--amber { background: linear-gradient(90deg, var(--amber), #ffd074); }
.prof-note { font-size: 12.5px; color: var(--text-2); }

/* Registry Table (systems_registry.json tab & /systems/ page) */
.filter-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-panel); font-family: var(--mono); font-size: 11px; color: var(--text-2);
}
.pill.is-on, .pill:hover { border-color: var(--emerald); color: #ffffff; background: var(--emerald-dim); }
.filter-in {
  padding: 5px 10px; min-width: 220px; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: var(--r);
  font-family: var(--mono); font-size: 12px; color: #ffffff;
}
.filter-in:focus { outline: none; border-color: var(--emerald); }

.reg-table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-panel); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px;
}
.reg-table th {
  text-align: left; padding: 8px 12px; background: var(--bg-chrome);
  border-bottom: 1px solid var(--border); color: var(--muted);
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
}
.reg-table td {
  padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-2);
}
.reg-table tr:hover td { background: var(--bg-elev); color: #ffffff; }
.reg-table tr[hidden] { display: none; }
.tag-tier {
  font-size: 10px; padding: 2px 6px; border-radius: 2px; border: 1px solid var(--border);
  white-space: nowrap;
}
.tag-tier--fab { color: var(--emerald); border-color: rgba(45, 212, 168, 0.35); background: var(--emerald-dim); }
.tag-tier--core { color: var(--amber); border-color: rgba(245, 165, 36, 0.35); background: var(--amber-dim); }

/* Code Spec Blocks (architecture.spec) */
.code-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.code-card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
}
.code-card__k { font-family: var(--mono); font-size: 11px; color: var(--amber); }
.code-card__t { font-family: var(--mono); font-size: 15px; font-weight: 500; color: #ffffff; }
.code-card__d { font-size: 13px; color: var(--text-2); line-height: 1.55; }

/* Bottom Interactive Terminal */
.terminal {
  height: 128px; flex-shrink: 0;
  background: #06080c; border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.terminal.is-collapsed { height: 28px; }
.term__bar {
  height: 28px; padding: 0 12px; background: var(--bg-chrome); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
}
.term__chips { display: flex; gap: 6px; align-items: center; }
.term__chip {
  padding: 1px 7px; border: 1px solid var(--border); border-radius: 2px;
  font-family: var(--mono); font-size: 10px; color: var(--text-2); background: var(--bg);
}
.term__chip:hover { border-color: var(--emerald); color: var(--emerald); }
.term__out {
  flex: 1; overflow-y: auto; padding: 6px 12px;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2); line-height: 1.45;
}
.term__line--ok { color: var(--emerald); }
.term__line--cmd { color: #ffffff; }
.term__prompt {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 6px 12px; border-top: 1px solid #131822;
  font-family: var(--mono); font-size: 12px;
}
.term__prompt span { color: var(--emerald); white-space: nowrap; }
.term__input {
  flex: 1; background: none; border: none; color: #ffffff;
  font-family: var(--mono); font-size: 12px;
}
.term__input:focus { outline: none; }

/* Bottom IDE Statusbar */
.statusbar {
  height: 26px; background: #0a1412; border-top: 1px solid rgba(45, 212, 168, 0.24);
  padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-family: var(--mono); font-size: 10.5px; color: var(--text-2);
}
.statusbar__seg { display: flex; align-items: center; gap: 14px; }
.statusbar a:hover { color: var(--emerald); }

/* ---- STANDALONE SUBPAGES (ARTICLES, SYSTEMS, LEGAL) ---- */
.page-wrap { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px 24px; }
.art-cover { width: 100%; border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 22px; }
.art-h1 { font-family: var(--mono); font-size: 32px; font-weight: 500; line-height: 1.2; color: #ffffff; margin-bottom: 12px; letter-spacing: -0.02em; }
.art-tldr {
  background: var(--bg-panel); border: 1px solid var(--border); border-left: 3px solid var(--emerald);
  border-radius: var(--r); padding: 16px 18px; font-size: 15px; color: #e8f1f8; margin-bottom: 24px;
}
.art-sec { margin-bottom: 38px; }
.art-sec h2 { font-family: var(--mono); font-size: 20px; font-weight: 500; color: #ffffff; margin: 6px 0 14px 0; }
.art-card { width: 100%; border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 14px; cursor: zoom-in; }
.art-ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.art-ul li { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r); padding: 13px 15px; color: var(--text-2); font-size: 14px; }
.art-ul li strong { color: #ffffff; }

.legal-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; margin-bottom: 16px; }
.legal-card h2 { font-family: var(--mono); font-size: 13px; color: var(--emerald); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.legal-card p { color: var(--text-2); font-size: 14px; line-height: 1.65; margin-bottom: 8px; }
.legal-card a { color: var(--emerald); text-decoration: underline; }

.page-foot {
  border-top: 1px solid var(--border); background: var(--bg-chrome);
  padding: 22px 24px; font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.page-foot__in {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.page-foot__links { display: flex; gap: 16px; flex-wrap: wrap; }
.page-foot__links a:hover { color: var(--emerald); }

/* Command Palette & Lightbox */
.cmdk-bg {
  position: fixed; inset: 0; z-index: 200; background: rgba(4, 6, 10, 0.78); backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 24px 16px;
}
.cmdk-bg[hidden] { display: none; }
.cmdk {
  width: 100%; max-width: 600px; background: var(--bg-panel);
  border: 1px solid var(--border-hi); border-radius: var(--r);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.75); overflow: hidden;
}
.cmdk__top { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-family: var(--mono); color: var(--emerald); }
.cmdk__in { flex: 1; background: none; border: none; color: #ffffff; font-family: var(--mono); font-size: 13.5px; }
.cmdk__in:focus { outline: none; }
.cmdk__list { max-height: 360px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.cmdk__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 11px; border-radius: 2px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.cmdk__row.is-hi, .cmdk__row:hover { background: var(--emerald-dim); color: #ffffff; }
.cmdk__row small { font-size: 10px; color: var(--muted); }

.lightbox { position: fixed; inset: 0; z-index: 220; background: rgba(3, 5, 8, 0.94); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 96vw; max-height: 92vh; border: 1px solid var(--border-hi); border-radius: var(--r); }

@media (max-width: 1020px) {
  .titlebar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tb-crumb, .status-dot { display: none; }
  .ide-shell { height: auto; grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .actbar { display: none; }
  .explorer { border-right: none; border-bottom: 1px solid var(--border); max-height: 240px; }
  .split-stage { grid-template-columns: minmax(0, 1fr); }
  .bento-strip { grid-template-columns: minmax(0, 1fr); }
  .prof-grid, .code-grid { grid-template-columns: minmax(0, 1fr); }
  .terminal { height: 150px; }
}
@media (max-width: 640px) {
  .titlebar { padding: 0 10px; gap: 8px; }
  .tb-link { display: none; }
  .editor-body { padding: 14px; }
  .ed-title { font-size: 18px; }
  .art-h1 { font-size: 24px; }
  .statusbar { font-size: 9.5px; padding: 0 10px; }
  .term__chips { display: none; }
}
