/* tool-reference.css — the searchable MCP tool reference, as a component.
 *
 * WHY IT IS ITS OWN FILE. It started life inside product-line.css, for the
 * FeatureBoard page. Then NativeCAD needed the same thing — 83 MCP tools that
 * deserve the same treatment as FeatureBoard's 271 — and its products page is
 * light-by-default and theme-aware rather than dark. Duplicating the component
 * would have meant two copies drifting apart within a release.
 *
 * So, like family.css: this defines its OWN --tr-* tokens with a light variant
 * keyed off html[data-theme="light"], styles nothing outside .tr-*, and defines
 * no global tokens. It drops into any page on the site.
 *
 * Two knobs the host page may set:
 *   --tr-accent      tint (defaults to the page's --accent, else the site cyan)
 *   --tr-sticky-top  where the filter bar sticks (80px under the fixed site
 *                    nav; 0 on a page whose nav scrolls away)
 */

.tr {
  --tr-panel: #22272b;
  --tr-panel-hi: #2c333a;
  --tr-bg: #1a1a1a;
  --tr-bg2: #101214;
  --tr-line: #38414a;
  --tr-text: #b6c2cf;
  --tr-text-hi: #e8edf2;
  --tr-muted: #6b778c;
  --tr-accent: var(--accent, #00d5ff);
  --tr-green: #20c997;
  --tr-amber: #fd7e14;
  --tr-red: #e06c75;
  --tr-on: rgba(0, 213, 255, .1);
  --tr-sticky-top: 0px;
  --tr-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --tr-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-family: var(--tr-sans);
}

html[data-theme="light"] .tr {
  --tr-panel: #ffffff;
  --tr-panel-hi: #f5f8fb;
  --tr-bg: #ffffff;
  --tr-bg2: #f5f8fb;
  --tr-line: #e3e7ee;
  --tr-text: #14171c;
  --tr-text-hi: #000000;
  --tr-muted: #5b6472;
  --tr-green: #0f9d76;
  --tr-amber: #b45309;
  --tr-red: #b91c1c;
  --tr-on: rgba(52, 152, 219, .12);
}

.tr-toolbar {
  position: sticky;
  top: var(--tr-sticky-top);
  z-index: 20;
  background: var(--tr-bg);
  padding: 12px 0;
  border-bottom: 1px solid var(--tr-line);
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}
.tr-search {
  flex: 1 1 260px;
  min-width: 200px;
  background: var(--tr-bg2);
  border: 1px solid var(--tr-line);
  border-radius: 8px;
  color: var(--tr-text-hi);
  font-family: var(--tr-sans);
  font-size: .92rem;
  padding: 9px 12px;
}
.tr-search:focus { outline: 2px solid var(--tr-accent); outline-offset: -1px; }

.tr-chip {
  background: transparent;
  border: 1px solid var(--tr-line);
  border-radius: 999px;
  color: var(--tr-text);
  font-family: var(--tr-sans);
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.tr-chip:hover { border-color: var(--tr-accent); color: var(--tr-text-hi); }
.tr-chip[aria-pressed="true"] { border-color: var(--tr-accent); color: var(--tr-text-hi); background: var(--tr-on); }
.tr-count { font-size: .8rem; color: var(--tr-muted); font-family: var(--tr-mono); margin-left: auto; }

.tr-group { margin-top: 26px; }
.tr-group > h3 {
  color: var(--tr-text-hi);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
}
.tr-group > h3 span { font-family: var(--tr-mono); font-size: .78rem; color: var(--tr-muted); font-weight: 400; }
.tr-group > p { color: var(--tr-muted); font-size: .9rem; max-width: 800px; margin: 4px 0 10px; }

.tr-tool {
  border: 1px solid var(--tr-line);
  border-radius: 10px;
  background: var(--tr-panel);
  margin-bottom: 8px;
  overflow: hidden;
}
.tr-tool > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tr-tool > summary::-webkit-details-marker { display: none; }
.tr-tool > summary:hover { background: var(--tr-panel-hi); }
.tr-tool[open] > summary { border-bottom: 1px solid var(--tr-line); }
.tr-name { font-family: var(--tr-mono); color: var(--tr-text-hi); font-size: .9rem; font-weight: 700; }
.tr-title { font-size: .88rem; color: var(--tr-muted); flex: 1; min-width: 140px; }
.tr-body { padding: 12px 14px; font-size: .9rem; color: var(--tr-text); line-height: 1.6; }
.tr-body p { margin: 0; }
.tr-body p + p { margin-top: 9px; }

.tr-tag {
  font-family: var(--tr-mono);
  font-size: .64rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--tr-line);
  color: var(--tr-muted);
  white-space: nowrap;
}
.tr-tag.read { color: var(--tr-green); border-color: currentColor; }
.tr-tag.write { color: var(--tr-amber); border-color: currentColor; }
.tr-tag.destructive { color: var(--tr-red); border-color: currentColor; }
.tr-tag.core { color: var(--tr-accent); border-color: currentColor; }

.tr-empty { color: var(--tr-muted); padding: 26px 0; font-style: italic; }

@media (max-width: 640px) {
  .tr-count { margin-left: 0; width: 100%; }
}
