:root {
  --ink: #1b1b1f;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg-sidebar: #fafafa;
  --accent: #6b4fbb;
  --accent-dark: #16151a;
  --code-bg: #f6f6f8;
  --badge-community: #0f8a5f;
  --badge-python: #b8860b;
  --badge-error: #c0362c;
  --badge-developer: #c0362c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
}

.topbar {
  background: var(--accent-dark);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  padding: 14px 0;
}
.brand span { color: #b7a6e8; font-weight: 400; }

.tabbar { display: flex; gap: 4px; align-self: stretch; }
.tab {
  color: #c9c5d6;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 4px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: #fff; }
.tab.active { color: #fff; border-bottom-color: var(--accent); }

.layout {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 50px);
}
.layout.has-sidebar { grid-template-columns: 260px 1fr; }
.layout.has-sidebar.has-aside { grid-template-columns: 260px 1fr 220px; }
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
}
.sidebar-section { margin-bottom: 24px; }
.sidebar-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px 4px;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 1px 0; }
.sidebar a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
}
.sidebar a:hover { background: #eee; }
.sidebar a.active { background: #ece6fa; color: var(--accent); font-weight: 600; }
.sidebar .count { color: var(--muted); font-weight: 400; font-size: 12px; }

.content {
  padding: 32px 40px;
  min-width: 0;
}
.layout:not(.has-sidebar) .content { max-width: 900px; margin: 0 auto; width: 100%; }

h1 { font-size: 26px; margin: 4px 0 10px; }
h2 { font-size: 19px; margin: 32px 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.lede { font-size: 16px; color: #333; max-width: 70ch; }
.muted { color: var(--muted); }
.doc-description { white-space: pre-wrap; font-size: 14.5px; max-width: none; }

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }

code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.88em;
  font-family: "Cascadia Code", Consolas, Menlo, monospace;
}

.code-block-wrap { position: relative; margin-top: 8px; }
.code-block {
  background: var(--code-bg);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: "Cascadia Code", Consolas, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
}
.copy-btn:hover { background: #f1f1f3; border-color: #d3d3d8; }
.copy-btn.copied { background: var(--badge-community); border-color: var(--badge-community); color: #fff; }

table { border-collapse: collapse; width: 100%; margin-top: 8px; }
.index-table th, .index-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.index-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 2px solid var(--border); }
.index-table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.index-table a:hover { text-decoration: underline; }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.icon-tile:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(107, 79, 187, 0.12); }
.icon-tile-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--code-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.icon-tile-img img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.icon-tile-placeholder { font-size: 22px; font-weight: 700; color: var(--muted); }
.icon-tile-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.icon-tile-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.icon-tile-tag { font-size: 10px; color: var(--muted); background: var(--code-bg); border-radius: 999px; padding: 1px 7px; }

.tag-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.tag-filter-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  text-decoration: none;
}
.tag-filter-chip:hover { border-color: var(--accent); color: var(--ink); }
.tag-filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.item-header { display: flex; gap: 20px; align-items: flex-start; margin-top: 6px; }
.item-icon {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.item-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.item-icon-placeholder { font-size: 36px; font-weight: 700; color: var(--muted); }
.item-header h1 { margin-top: 0; }

.authoring-guide {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 20px 0 28px;
}
.authoring-guide h2 { margin-top: 0; font-size: 16px; }
.guide-list { margin: 10px 0; padding-left: 20px; line-height: 1.7; }
.guide-list li { margin-bottom: 8px; }

.nested-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 20px 12px;
  margin: 16px 0;
}
.nested-block h3 { margin-bottom: 4px; }
.nested-block-desc { color: #333; }
.nested-block-depth-2, .nested-block-depth-3 { margin-left: 16px; background: var(--code-bg); }

.args-list { list-style: none; margin: 0; padding: 0; }
.args-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.7;
}
.args-list li:last-child { border-bottom: none; }
.arg-name {
  background: #eef0fd;
  color: #4639b5;
  border: 1px solid #d9dcf8;
  font-weight: 600;
}
.pill {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.88em;
  font-family: "Cascadia Code", Consolas, Menlo, monospace;
}
.args-list .badge { margin-left: 6px; vertical-align: 1px; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
}
.badge-community { background: var(--badge-community); }
.badge-python { background: var(--badge-python); }
.badge-error { background: var(--badge-error); }
.badge-developer { background: var(--badge-developer); }

/* Pipeline */
.pipeline-stages {
  display: flex;
  align-items: center;
  margin: 24px 0 32px;
  max-width: 480px;
}
.stage { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.stage-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--muted);
  background: #fff;
}
.stage.active .stage-icon { border-color: var(--accent); color: var(--accent); }
.stage.done .stage-icon { border-color: var(--badge-community); background: var(--badge-community); color: #fff; }
.stage-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stage.active .stage-label { color: var(--ink); }
.stage.done .stage-label { color: var(--ink); }
.stage-line { flex: 1; height: 2px; background: var(--border); margin: 0 8px; margin-bottom: 20px; }
.stage-line.done { background: var(--badge-community); }

.pipeline-error {
  background: #fdecea;
  border: 1px solid #f3c7c2;
  color: #8a2b22;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}

.pipeline-form { max-width: 640px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input[type="text"], .field input[type="file"], .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.field input[type="text"]:focus, .field textarea:focus { outline: none; border-color: var(--accent); }

.icon-match {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.icon-match img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.icon-match-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--code-bg);
  border: 1px dashed var(--border);
}

.source-toggle { border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.source-radio { display: none; }
.source-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.source-tabs label {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--code-bg);
  color: var(--muted);
  cursor: pointer;
}
#mode-upload:checked ~ .source-tabs label[for="mode-upload"],
#mode-github:checked ~ .source-tabs label[for="mode-github"] {
  background: var(--accent);
  color: #fff;
}
.panel-github { display: none; }
#mode-github:checked ~ .panel-upload { display: none; }
#mode-github:checked ~ .panel-github { display: block; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-primary:hover { background: #5a3fa3; }

.plan-item { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.plan-item.plan-ok { border-left: 4px solid var(--badge-community); }
.plan-item.plan-error { border-left: 4px solid var(--badge-error); }
.plan-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.plan-error-text { color: #8a2b22; font-size: 14px; margin: 0; }
.plan-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan-diff h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.code-block.small { font-size: 12px; max-height: 320px; overflow-y: auto; }

.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; }
.card-col h2 { margin-top: 0; }
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card-link:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(107, 79, 187, 0.12); }
.card-cta { color: var(--accent); font-weight: 600; font-size: 14px; }

.on-this-page {
  padding: 32px 16px;
  font-size: 13px;
}
.on-this-page h4 { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; margin-bottom: 10px; }
.on-this-page ul { list-style: none; padding: 0; margin: 0; }
.on-this-page li { margin-bottom: 6px; }
.on-this-page a { color: var(--ink); text-decoration: none; }
.on-this-page a:hover { color: var(--accent); }
.on-this-page li.toc-level-3 { margin-left: 14px; }

/* Rendered project documentation (registry_site/documentation.py) — a
   markdown->HTML dump of code context/*.md, styled to match the rest of
   the site's typography rather than browser defaults. */
.doc-content { max-width: 80ch; line-height: 1.65; }
.doc-content h1 { font-size: 24px; margin: 0 0 16px; }
.doc-content h2 { font-size: 19px; margin: 36px 0 12px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.doc-content h3 { font-size: 16px; margin: 24px 0 8px; }
.doc-content p { margin: 0 0 14px; }
.doc-content ul, .doc-content ol { margin: 0 0 14px; padding-left: 24px; }
.doc-content li { margin-bottom: 4px; }
.doc-content li > ul, .doc-content li > ol { margin-top: 4px; }
.doc-content a { color: var(--accent); text-decoration: none; }
.doc-content a:hover { text-decoration: underline; }
.doc-content strong { font-weight: 600; }
.doc-content hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.doc-content blockquote { margin: 0 0 14px; padding: 4px 16px; border-left: 3px solid var(--border); color: var(--muted); }
.doc-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.doc-content pre code { background: none; padding: 0; border-radius: 0; }
.doc-content table { border-collapse: collapse; margin: 0 0 14px; width: 100%; }
.doc-content th, .doc-content td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; font-size: 14px; }
.doc-content th { background: var(--code-bg); }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
