/* MCP UI — tech-green-dark-mode-modern design system
   Matte black surfaces, emerald signal accent, mono system labels, framed cards. */

:root {
  --bg: #05070a;
  --bg-deep: #020305;
  --surface: #0a0e13;
  --surface-2: #0f151c;
  --surface-3: #141c25;
  --line: #1c2833;
  --line-soft: #16202a;

  --accent: #2ee88f;
  --accent-hot: #7cffc4;
  --accent-dim: #1a7a52;
  --accent-ghost: rgba(46, 232, 143, 0.09);
  --warn: #f5b942;
  --danger: #ff6b6b;
  --info: #58a6ff;

  --text: #e6edf3;
  --text-2: #b6c3cf;
  --muted: #7d8c99;
  --muted-2: #56636e;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SF Mono", Consolas, monospace;

  --rail: 232px;
  --top: 56px;
  --pad: 28px;
  --radius: 3px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 24px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- global framing: grid + vignette ---------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(46, 232, 143, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 232, 143, 0.028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 60% 40% at 50% -10%, rgba(46, 232, 143, 0.05), transparent 70%);
}

.shell { position: relative; z-index: 1; }

/* ---------- top bar ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--pad);
  background: rgba(5, 7, 10, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}

.brand__mark {
  width: 9px;
  height: 9px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 22px rgba(46, 232, 143, 0.5);
}

.brand__ver {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 1px 6px;
  letter-spacing: 0.08em;
}

.search {
  margin-left: auto;
  position: relative;
  width: min(360px, 42vw);
}

.search input {
  width: 100%;
  height: 30px;
  padding: 0 54px 0 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

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

.search input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 1px rgba(46, 232, 143, 0.22), 0 0 18px rgba(46, 232, 143, 0.12);
}

.search__icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 12px;
  pointer-events: none;
}

.search__kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 5px;
  pointer-events: none;
}

.search__count {
  position: absolute;
  right: 34px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  pointer-events: none;
}

/* ---------- layout ---------- */

.layout { display: flex; padding-top: var(--top); }

.rail {
  position: fixed;
  top: var(--top);
  left: 0;
  bottom: 0;
  width: var(--rail);
  padding: 26px 0 var(--pad);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: rgba(5, 7, 10, 0.55);
}

.rail__label,
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.rail__label { padding: 0 var(--pad) 12px; }

.rail a {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 7px var(--pad);
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.rail a:hover { color: var(--text-2); background: rgba(46, 232, 143, 0.03); }

.rail a.on {
  color: var(--text);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(46, 232, 143, 0.08), transparent);
}

.rail__num { font-family: var(--mono); font-size: 10px; color: var(--muted-2); }
.rail a.on .rail__num { color: var(--accent); }

.rail__foot {
  margin: 26px var(--pad) 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.9;
  color: var(--muted-2);
  letter-spacing: 0.05em;
}

.main {
  margin-left: var(--rail);
  width: calc(100% - var(--rail));
  /* Flex items default to min-width:auto, which lets wide <pre> and tables
     push the whole column past the viewport. Kill that. */
  min-width: 0;
  padding: 0 var(--pad) 120px;
  max-width: 1120px;
}

/* ---------- hero ---------- */

.hero { position: relative; min-height: 92vh; display: flex; align-items: center; }

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* width:100% matters — as a flex item of .hero it would otherwise size to
   max-content and push copy past the viewport on narrow screens. */
.hero__inner { position: relative; z-index: 2; width: 100%; max-width: 620px; padding: 60px 0; }

.hero h1 {
  margin: 14px 0 0;
  font-size: clamp(34px, 5.6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(46, 232, 143, 0.35);
}

.hero__lede {
  margin: 20px 0 0;
  font-size: 16px;
  color: var(--text-2);
  max-width: 52ch;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 26px;
  max-width: 470px;
  margin-top: 30px;
}

.stat__k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.stat__v { font-family: var(--mono); font-size: 15px; color: var(--accent); }

.scroll-hint {
  position: absolute;
  left: var(--pad);
  bottom: 26px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted-2);
  text-transform: uppercase;
  animation: breathe 3.4s ease-in-out infinite;
}

@keyframes breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ---------- 3D annotation pins ---------- */

.pin {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}

.pin.in { opacity: 1; }

.pin__box {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  padding: 4px 9px;
  background: rgba(10, 14, 19, 0.82);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-2);
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pin__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.pin__sub { color: var(--muted); text-transform: none; letter-spacing: 0.02em; }

/* ---------- sections ---------- */

section.block { padding: 76px 0 8px; border-top: 1px solid var(--line-soft); }

section.block > header { margin-bottom: 30px; }

.sec-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.2em;
}

h2 {
  margin: 8px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.02em;
  font-weight: 600;
}

h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p { margin: 0 0 14px; color: var(--text-2); max-width: 76ch; }
p strong { color: var(--text); font-weight: 600; }
p a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-dim); }
p a:hover { border-bottom-color: var(--accent); }

.lede { font-size: 16px; color: var(--text-2); }

/* ---------- framed cards ---------- */

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.card:hover {
  border-color: rgba(46, 232, 143, 0.32);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(46, 232, 143, 0.08);
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-color: var(--accent);
  opacity: 0.5;
  transition: opacity 0.18s;
}

.card::before { top: -1px; left: -1px; border-top: 1px solid; border-left: 1px solid; }
.card::after { bottom: -1px; right: -1px; border-bottom: 1px solid; border-right: 1px solid; }
.card:hover::before, .card:hover::after { opacity: 1; }

.card__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.card__tag b { color: var(--accent); font-weight: 500; }

.card p:last-child { margin-bottom: 0; }

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  vertical-align: middle;
}

.chip--live { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-ghost); }
.chip--dep { color: var(--warn); border-color: rgba(245, 185, 66, 0.32); background: rgba(245, 185, 66, 0.07); }
.chip--new { color: var(--info); border-color: rgba(88, 166, 255, 0.32); background: rgba(88, 166, 255, 0.07); }

/* ---------- architecture diagram (static 2D) ---------- */

.diag {
  display: grid;
  grid-template-columns: 1fr 92px 1fr 92px 1fr;
  align-items: stretch;
  gap: 0;
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(46, 232, 143, 0.022), transparent),
    var(--surface);
}

.node {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-3);
  min-width: 0;
}

.node h4 {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.node small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }

.hop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.hop::before { content: ""; width: 100%; height: 1px; background: linear-gradient(90deg, transparent, var(--accent-dim)); }

.fanout { display: grid; gap: 10px; }

.fanout .node { padding: 10px 12px; }

/* ---------- code ---------- */

.code {
  position: relative;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-deep);
  overflow: hidden;
}

.code__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(46, 232, 143, 0.03);
}

.code__name { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }

.copy {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.copy:hover { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-ghost); }
.copy.done { color: var(--accent); border-color: var(--accent); }

pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  tab-size: 2;
}

pre .c { color: var(--muted-2); }
pre .k { color: var(--accent); }
pre .s { color: #9ad9ff; }
pre .n { color: var(--warn); }
pre .p { color: var(--text); }

/* ---------- tables ---------- */

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 500;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(46, 232, 143, 0.025);
  white-space: nowrap;
}

td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); color: var(--text-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(46, 232, 143, 0.022); }

td code, li code, p code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-ghost);
  border: 1px solid rgba(46, 232, 143, 0.16);
  border-radius: 2px;
  padding: 1px 5px;
}

td .meth { font-family: var(--mono); color: var(--text); font-size: 12.5px; }

.dir {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  white-space: nowrap;
}

.dir--c { color: var(--info); border-color: rgba(88, 166, 255, 0.3); }
.dir--s { color: var(--accent); border-color: var(--accent-dim); }

/* ---------- lists ---------- */

ul.clean { margin: 0 0 14px; padding: 0; list-style: none; }

ul.clean li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 7px;
  color: var(--text-2);
}

ul.clean li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 11px;
  width: 5px;
  height: 1px;
  background: var(--accent);
}

.steps { counter-reset: s; margin: 0; padding: 0; list-style: none; }

.steps > li {
  counter-increment: s;
  position: relative;
  padding: 0 0 18px 40px;
  margin: 0;
  border-left: 1px solid var(--line);
  margin-left: 9px;
}

.steps > li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute;
  left: -10px;
  top: 0;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--accent-dim);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent);
}

.steps > li > b { display: block; color: var(--text); margin-bottom: 3px; font-weight: 600; }

/* ---------- callouts ---------- */

.note {
  position: relative;
  margin: 16px 0;
  padding: 13px 16px 13px 44px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--text-2);
}

.note::before {
  content: "i";
  position: absolute;
  left: 16px;
  top: 14px;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent-dim);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent);
}

.note--warn { border-left-color: var(--warn); }
.note--warn::before { content: "!"; color: var(--warn); border-color: rgba(245, 185, 66, 0.35); }

/* ---------- search filtering ---------- */

[data-searchable] { transition: opacity 0.18s, display 0.18s; }
[data-searchable].hid { display: none !important; }

/* ---------- footer ---------- */

.foot {
  margin-top: 80px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  text-transform: uppercase;
}

/* ---------- responsive ---------- */

@media (max-width: 1040px) {
  :root { --rail: 0px; }
  .rail { display: none; }
  .main { margin-left: 0; width: 100%; }
  .diag { grid-template-columns: 1fr; gap: 0; }
  .hop { padding: 14px 0; }
  .hop::before { width: 1px; height: 22px; background: linear-gradient(180deg, transparent, var(--accent-dim)); }
}

@media (max-width: 720px) {
  :root { --pad: 18px; }
  .hero { min-height: 78vh; }
  .hero__stats { max-width: none; }
  /* The wireframe shares the column with the copy on narrow screens, so drop
     it to a background texture instead of a foreground object. */
  #scene { opacity: 0.28; }
  .scroll-hint { display: none; }
  .search { width: 100%; }
  .brand span:not(.brand__mark) { display: none; }
  .pin { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}