/* Borg landing — brutalist, filesystem-native (matches borg-docs-site) */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #000000;
  font-family: "Times New Roman", Times, serif;
  font-size: 17px;
  line-height: 1.5;
}

a { color: #0000ee; text-decoration: underline; }
a:visited { color: #551a8b; }
a:hover { background: #ffffcc; }

hr { border: 0; border-top: 1px solid #999; margin: 0; }

/* TOP BAR */
#topbar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 6px 12px;
  background: #eeeeee;
  border-bottom: 1px solid #999;
  position: sticky;
  top: 0;
  z-index: 100;
}
#topbar #title a {
  font-weight: bold;
  text-decoration: none;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 17px;
}
#topbar #title a:hover { background: transparent; text-decoration: underline; }
#breadcrumbs {
  flex: 1;
  font-size: 15px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#breadcrumbs .sep { color: #999; margin: 0 4px; }
#actions { font-size: 15px; }
#actions a { margin-left: 12px; }

/* LAYOUT */
#layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 40px);
}

#tree-pane {
  background: #f5f5f5;
  border-right: 1px solid #999;
  padding: 8px 6px;
  overflow-y: auto;
  max-height: calc(100vh - 40px);
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
}
.visitor-tally {
  margin-top: auto;
  padding: 10px 8px 4px;
  text-align: center;
  background: transparent;
  font-family: "Courier New", Courier, monospace;
}
.visitor-tally .visitor-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
  margin-bottom: 4px;
}
.visitor-tally .counter {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: #1a4fa8;
  font-size: 18px;
  letter-spacing: 2px;
  font-weight: bold;
}
.pane-header {
  font-weight: bold;
  font-size: 14px;
  text-transform: uppercase;
  color: #555;
  padding: 4px 6px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 6px;
}

#tree, #tree ul {
  list-style: none;
  margin: 0;
  padding-left: 14px;
}
#tree { padding-left: 4px; }
#tree li { margin: 0; padding: 0; font-size: 16px; }
#tree .dir > .label,
#tree .file {
  display: flex;
  align-items: baseline;
}
#tree .dir > .label { user-select: none; font-weight: bold; }
#tree .chevron {
  cursor: pointer;
  display: inline-block;
  width: 14px;
  flex: 0 0 14px;
  color: #666;
  text-align: center;
  user-select: none;
}
#tree .chevron::before { content: "\25B8"; }
#tree .dir.open > .label .chevron::before { content: "\25BE"; }
#tree .dir:not(.open) > ul { display: none; }
#tree a {
  display: inline-block;
  flex: 1;
  padding: 1px 4px;
  text-decoration: none;
  color: #0000ee;
}
#tree a:hover { background: #ffffcc; text-decoration: underline; }
#tree a.current { background: #d0d8ff; color: #000; font-weight: bold; }
#tree .file::before {
  content: "\2022";
  display: inline-block;
  width: 14px;
  flex: 0 0 14px;
  color: #999;
  text-align: center;
}

/* sidebar extras */
.sidebar-aside { margin-top: 18px; padding: 0 4px; }
.sb-box {
  border: 1px solid #999;
  background: #ffffff;
  margin-bottom: 12px;
  font-size: 15px;
}
.sb-box-title {
  background: #d0d8ff;
  color: #000;
  border-bottom: 1px solid #999;
  padding: 3px 6px;
  font-weight: bold;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sb-box-body { padding: 6px 8px; }
.sb-box-body > div { margin: 2px 0; }
.sb-box-body.ring a { font-size: 14px; }
.green { color: #008000; font-weight: bold; }
.counter {
  font-family: "Courier New", Courier, monospace;
  font-size: 18px;
  font-weight: bold;
  background: #000;
  color: #0f0;
  padding: 4px 8px;
  text-align: center;
  letter-spacing: 2px;
  margin: 6px 8px;
  border: 1px inset #666;
}

/* DOC PANE */
#doc-pane { padding: 16px 28px 32px 28px; min-width: 0; }
#doc { max-width: 820px; }

#doc-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  max-width: 820px;
  margin-bottom: 8px;
}
#doc-actions button {
  font-family: inherit;
  font-size: 13px;
  padding: 2px 8px;
  background: #f0f0f0;
  border: 1px solid #666;
  cursor: pointer;
}
#doc-actions button:hover { background: #ffffcc; }
#doc-actions button.copied { background: #d0ffd0; }

#doc h1, #doc h2, #doc h3, #doc h4 {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#doc h1 {
  font-size: 30px;
  border-bottom: 1px solid #999;
  padding-bottom: 4px;
  margin-top: 0;
  margin-bottom: 10px;
  font-weight: bold;
}
#doc h2 {
  font-size: 22px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 2px;
  margin-top: 28px;
  font-weight: bold;
}
#doc h2 .h2-sub {
  font-weight: normal;
  color: #666;
  font-size: 15px;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}
#doc h3 { font-size: 18px; margin-top: 22px; font-weight: bold; }
#doc h4 { font-size: 16px; margin-top: 18px; font-weight: bold; }
#doc p { margin: 10px 0; }
#doc ul, #doc ol { padding-left: 24px; }
#doc li { margin: 3px 0; }

#doc code {
  font-family: Menlo, Consolas, "Courier New", monospace;
  font-size: 13px;
  background: #f0f0f0;
  padding: 1px 4px;
  border: 1px solid #ddd;
}
#doc pre {
  background: #f0f0f0;
  border: 1px solid #ccc;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.4;
  font-family: "Courier New", Courier, monospace;
}
#doc pre code { background: transparent; border: 0; padding: 0; font-size: 13px; }

#doc blockquote { margin: 10px 0; padding: 4px 12px; border-left: 4px solid #999; background: #f9f9f9; color: #333; }

#doc table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 16px;
  width: 100%;
  max-width: 780px;
}
#doc th, #doc td {
  border: 1px solid #666;
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
#doc th { background: #eee; font-weight: bold; }
#doc img { max-width: 100%; }

.lede { font-size: 17px; font-style: italic; color: #333; border-left: 3px solid #0000ee; padding-left: 10px; background: #f8f8ff; padding-top: 6px; padding-bottom: 6px; }

.caption { font-size: 13px; color: #666; font-style: italic; }

/* install pull-quote */
blockquote.pull { background: #fffce8; border-left: 4px solid #b8a800; padding: 8px 12px; }
.pull-kicker { font-size: 11px; font-weight: bold; letter-spacing: 0.12em; text-transform: uppercase; color: #806000; margin-bottom: 4px; }
.pull-foot { font-size: 12px; color: #666; margin-top: 4px; }
#role-rotator {
  color: #1a4fa8;
  background: #eaf1fb;
  padding: 0 8px;
  border-radius: 3px;
  border-bottom: 2px solid #1a4fa8;
}

.install-wrap { position: relative; }
#doc pre.install {
  background: #ffffe0;
  color: #000;
  border: 1px solid #b8a800;
  box-shadow: 2px 2px 0 #999;
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  padding-right: 88px;
}
#doc pre.install code {
  color: #000;
  font-family: "Courier New", Courier, monospace;
  background: transparent;
}
.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #fffce8;
  color: #000;
  border: 1px solid #b8a800;
  box-shadow: 1px 1px 0 #999;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  padding: 2px 10px;
  cursor: pointer;
  letter-spacing: 0.06em;
}
.copy-btn:hover { background: #b8a800; color: #fff; }
.copy-btn.copied { background: #b8a800; color: #fff; }
.copy-btn:active { transform: translate(1px, 1px); box-shadow: 0 0 0 #999; }

blockquote.pull.cta { background: #eef7ee; border-left-color: #2a7a2a; }
blockquote.pull.cta .pull-kicker { color: #2a5a2a; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cta-btn {
  display: inline-block;
  padding: 4px 12px;
  background: #f0f0f0;
  border: 1px solid #666;
  color: #000;
  font-size: 13px;
  text-decoration: none;
}
.cta-btn:hover { background: #e4e4e4; text-decoration: underline; }
.cta-btn.primary { background: #2a7a2a; border-color: #1a5a1a; color: #fff; font-weight: bold; }
.cta-btn.primary:hover { background: #1a5a1a; }

/* feature table */
.feature-table th { width: 220px; background: #eef; }
.feature-table td { background: #fff; }

/* stages table */
.stages th { background: #ffe9cc; }
.stages td:first-child { width: 50px; text-align: center; font-family: "Courier New", monospace; font-weight: bold; }

/* xp table */
.xp-table th { background: #e0ffe0; }
.xp-table td { font-family: "Times New Roman", serif; }
.xp-table td:nth-child(2), .xp-table td:nth-child(3) { font-family: "Courier New", monospace; width: 100px; text-align: center; }
.dim { color: #999; }

/* bond table */
.bond-table { max-width: 320px; }
.bond-table td:first-child { font-family: "Courier New", monospace; width: 100px; }

/* compare */
.compare th:first-child { width: 180px; }
.compare td:nth-child(2) { background: #f0f8f0; font-weight: 500; }

/* 3 col */
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin: 12px 0; }
.three-col .col { border: 1px solid #999; padding: 8px 12px 12px; background: #fafafa; }
.three-col h4 { margin: 0 0 6px; border-bottom: 1px solid #ccc; padding-bottom: 3px; }
ul.plain { list-style: none; padding-left: 0; }
ul.plain li { padding: 2px 0; border-bottom: 1px dotted #ccc; font-size: 14px; }
ul.plain li:last-child { border-bottom: 0; }
.tag { font-size: 10px; background: #ffe; border: 1px solid #cc9; padding: 0 4px; font-family: "Courier New", monospace; color: #660; vertical-align: middle; }

/* faq */
dl.faq dt { font-weight: bold; margin-top: 12px; }
dl.faq dd { margin: 3px 0 8px 16px; color: #333; }

#docfoot { margin-top: 40px; color: #666; }
#docfoot small { font-size: 15px; }

/* ============ ARCHETYPE CAROUSEL ============ */
.arch-wrap {
  border: 1px solid #999;
  background: #fafafa;
  margin: 12px 0;
  max-width: 820px;
}
.arch-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #d0d8ff;
  border-bottom: 1px solid #999;
  padding: 3px 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: bold;
}
.arch-head .spacer { flex: 1; }
.arch-head button {
  font-family: inherit;
  font-size: 12px;
  background: #eee;
  border: 1px solid #666;
  padding: 1px 10px;
  cursor: pointer;
  margin-left: 4px;
}
.arch-head button:hover { background: #ffffcc; }
.arch-head .counter-inline { font-family: "Courier New", monospace; color: #000; margin-right: 8px; }

.arch-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 260px;
}
.arch-tabs {
  border-right: 1px solid #999;
  background: #f0f0f0;
  padding: 4px 0;
  font-size: 14px;
}
.arch-tab {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 10px;
  cursor: pointer;
  border-left: 3px solid transparent;
  font-family: "Times New Roman", serif;
}
.arch-tab:hover { background: #ffffcc; }
.arch-tab.active {
  background: #fff;
  border-left-color: #0000ee;
  font-weight: bold;
}
.arch-tab .tab-idx {
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: #888;
}
.arch-tab.active .tab-idx { color: #0000ee; }

.arch-card { padding: 14px 18px; }
.arch-card-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.arch-card-head h3 {
  margin: 0;
  font-size: 22px;
  font-weight: bold;
}
.arch-card-head .arch-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  font-family: "Courier New", monospace;
}
.arch-card-head .arch-idx {
  margin-left: auto;
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: #666;
}
.arch-domain { font-style: italic; color: #444; margin: 0 0 10px; }
.arch-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-size: 14px;
}
.arch-split h5 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #555;
  margin: 0 0 4px;
  border-bottom: 1px dotted #999;
  padding-bottom: 2px;
}
.arch-split ul.plain li { font-size: 13px; border-bottom: 1px dotted #ddd; }
.arch-example-name { font-weight: bold; font-family: "Times New Roman", serif; }
.arch-example-line { font-size: 13px; color: #333; margin: 2px 0; }
.arch-example-line code { font-size: 11px; }

/* ============ CARD ============ */
.card-wrap {
  border: 1px solid #999;
  background: #fff;
  max-width: 820px;
  margin: 12px 0;
  font-family: "Times New Roman", serif;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: #eeeeee;
  border-bottom: 1px solid #999;
  padding: 4px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "Courier New", monospace;
}
.card-head .card-head-l { font-weight: bold; }
.card-head .card-head-r { color: #555; }

.card-identity {
  padding: 0 18px 12px;
  border-bottom: 1px solid #ccc;
}
.card-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
  font-family: "Courier New", monospace;
  margin-bottom: 2px;
}
.card-name {
  font-size: 34px;
  font-weight: bold;
  margin: 0;
  padding-top: 0;
  letter-spacing: -0.01em;
}
.card-desc {
  margin: 4px 0 0;
  font-style: italic;
  color: #333;
  font-size: 15px;
}
.card-example {
  margin: 4px 0 0;
  font-size: 13px;
  color: #444;
  font-family: "Courier New", monospace;
}
.card-example b { color: #000; }

.card-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 14px;
  row-gap: 2px;
  margin: 10px 0 0;
  font-size: 14px;
}
.card-meta dt {
  font-family: "Courier New", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  align-self: baseline;
  padding-top: 2px;
}
.card-meta dd {
  margin: 0;
  font-weight: bold;
  color: #000;
}

.card-vitals {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid #ccc;
}
.card-vital {
  padding: 8px 12px;
  border-right: 1px dotted #ccc;
}
.card-vital:last-child { border-right: 0; }
.card-vital-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
  font-family: "Courier New", monospace;
}
.card-vital-num {
  font-size: 24px;
  font-weight: bold;
  margin: 2px 0 4px;
}
.vital-bar {
  height: 8px;
  border: 1px solid #666;
  background: #fff;
  position: relative;
  overflow: hidden;
}
.vital-bar-fill { height: 100%; background: #0000ee; }

.card-bars { padding: 10px 18px; border-bottom: 1px dashed #999; }
.card-bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 140px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  margin: 4px 0;
}
.card-bar-row .bar-label {
  font-weight: bold;
  font-family: "Courier New", monospace;
  font-size: 13px;
  text-transform: uppercase;
}
.card-bar-row .bar-num {
  text-align: right;
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: #555;
}
.big-bar {
  height: 16px;
  border: 1px solid #666;
  background: #ffffff;
  position: relative;
  overflow: hidden;
}
.big-bar-fill { height: 100%; background: #0000ee; }
.big-bar-fill.bond { background: #000; }
.big-bar-fill.xp { background: #cc2222; }

.card-rail {
  position: relative;
  border-bottom: 1px solid #ccc;
  height: 220px;
  overflow: hidden;
  background: #fafafa;
}
.rail-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: 360px;
  background: #ffffe0;
  border: 1px solid #b8a800;
  box-shadow: 2px 2px 0 #999;
  padding: 8px 14px;
  font-family: "Times New Roman", serif;
  font-size: 14px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  justify-content: space-between;
  animation: rail-rise 3.2s ease-out forwards;
  pointer-events: none;
}
.rail-card .rail-action { color: #000; flex: 1; }
.rail-card .rail-action code { font-size: 12px; background: #f4f4f4; border: 1px solid #e4e4e4; padding: 0 3px; }
.rail-card .rail-xp {
  font-family: "Courier New", Courier, monospace;
  font-size: 18px;
  font-weight: bold;
  color: #0a0;
}
.rail-card .rail-xp.zero { color: #bbb; font-weight: normal; font-size: 14px; }
.rail-card.neg {
  background: #fdecec;
  border-color: #c04242;
  animation: rail-fling 5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.rail-card.neg .rail-xp,
.rail-card .rail-xp.neg {
  color: #c00;
}
@keyframes rail-rise {
  0%   { transform: translate(-50%, 20px); opacity: 0; }
  12%  { transform: translate(-50%, 0); opacity: 1; }
  80%  { transform: translate(-50%, -180px); opacity: 1; }
  100% { transform: translate(-50%, -220px); opacity: 0; }
}
@keyframes rail-fling {
  0%   { transform: translate(-50%, 20px) rotate(0); opacity: 0; }
  8%   { transform: translate(-50%, 0) rotate(0); opacity: 1; }
  40%  { transform: translate(-50%, -90px) rotate(0); opacity: 1; }
  60%  { transform: translate(-50%, -90px) rotate(-2deg); opacity: 1; }
  100% { transform: translate(420px, -140px) rotate(22deg); opacity: 0; }
}

.card-log {
  border-bottom: 1px solid #ccc;
  max-height: 260px;
  overflow-y: auto;
}
.log-row {
  display: grid;
  grid-template-columns: 90px 1fr 70px;
  gap: 10px;
  padding: 4px 18px;
  border-bottom: 1px dotted #ddd;
  align-items: baseline;
  font-size: 14px;
  cursor: pointer;
  background: #fff;
}
.log-row:hover { background: #ffffcc; }
.log-row.sel { background: #eef; }
.log-row.sel:hover { background: #ffffcc; }
.log-time {
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: #333;
}
.log-action { color: #000; }
.log-action code { font-size: 12px; background: #f4f4f4; border: 1px solid #e4e4e4; padding: 0 3px; }
.log-xp {
  text-align: right;
  font-family: "Courier New", Courier, monospace;
  font-size: 18px;
  font-weight: bold;
  color: #0a0;
  text-shadow: 0 0 0 #0a0, 1px 1px 0 rgba(0, 80, 0, 0.25);
  letter-spacing: 0.02em;
}
.log-xp.zero { color: #bbb; font-weight: normal; font-size: 14px; text-shadow: none; }

.card-inspector {
  padding: 10px 18px;
  background: #f8f8ff;
  border-bottom: 1px solid #ccc;
  font-size: 13px;
  font-family: "Courier New", monospace;
  color: #000;
  min-height: 62px;
}
.card-inspector .ins-label {
  display: inline-block;
  width: 72px;
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.card-inspector .ins-empty { color: #888; font-style: italic; font-family: "Times New Roman", serif; }
.card-inspector .ins-xp-pos { color: #0000ee; font-weight: bold; }

.card-actions {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #fafafa;
  border-top: 1px solid #ccc;
}
.card-actions button {
  font-family: "Courier New", Courier, monospace;
  font-size: 15px;
  background: #2a7a2a;
  color: #fff;
  border: 1px solid #1a5a1a;
  border-radius: 3px;
  box-shadow: 0 2px 0 #1a5a1a;
  padding: 10px 28px;
  cursor: pointer;
  font-weight: bold;
  letter-spacing: 0.04em;
}
.card-actions button:hover { background: #1a5a1a; }
.card-actions button:active {
  background: #1a5a1a;
  transform: translateY(1px);
  box-shadow: 0 1px 0 #1a5a1a;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #ffffe0;
  border: 1px solid #b8a800;
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: 2px 2px 0 #999;
  z-index: 1000;
  font-family: "Times New Roman", serif;
  max-width: 280px;
}
.toast b { color: #b8a800; }

/* responsive */
@media (max-width: 720px) {
  #layout { grid-template-columns: 1fr; }
  #tree-pane { position: static; max-height: none; border-right: 0; border-bottom: 1px solid #999; }
  .arch-body { grid-template-columns: 1fr; }
  .arch-tabs { border-right: 0; border-bottom: 1px solid #999; display: flex; overflow-x: auto; }
  .arch-tab { white-space: nowrap; }
  .arch-split { grid-template-columns: 1fr; }
  .card-vitals { grid-template-columns: repeat(5, 1fr); }
  .card-vital-num { font-size: 18px; }
  .three-col { grid-template-columns: 1fr; }
  #doc-pane { padding: 12px 14px; }
}
