:root {
  --fg: #1a1d23;
  --muted: #6b7280;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e3e6ea;
  --accent: #2451b7;
  --accent-fg: #fff;
  --danger: #b91c1c;
  --ok: #15803d;
  --code-bg: #f3f4f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar h1 a { color: var(--fg); }
.topbar nav { display: flex; gap: 12px; align-items: center; }

main {
  max-width: 1024px;
  margin: 0 auto;
  padding: 24px;
}

.foot {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

button, .btn {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
button:hover, .btn:hover { border-color: #aaa; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.ghost { background: transparent; }

input[type=text], textarea, select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  width: 100%;
}

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--code-bg);
  color: var(--muted);
}
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.warn { background: #fef3c7; color: #92400e; }
.definedby-badge { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }

.muted { color: var(--muted); }
.flex { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.right { text-align: right; }
.gap { margin-top: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #1a1d23;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
  max-width: 360px;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }

h2 { margin: 0 0 12px; font-size: 18px; }
h3 { margin: 16px 0 8px; font-size: 14px; }

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

.project-heading { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.project-heading .project-code {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--code-bg);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  margin-right: 4px;
}
.project-prefix { color: var(--muted); }

/* ---- collapsible project group cards (home) ---- */
button.group-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin: 0; padding: 0;
  background: transparent; border: none; cursor: pointer;
  text-align: left; font: inherit;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
button.group-toggle:hover { color: var(--accent); }
.group-twisty { font-size: 11px; width: 12px; flex: none; line-height: 1; }
.group-body { margin-top: 10px; overflow-x: auto; }

.admin-link {
  font-size: 12px;
  color: var(--muted);
}

/* ---- friendly viewer: copy-IRI icon button ---- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  flex: none;
}
.icon-btn:hover { color: var(--accent); background: var(--code-bg); }
.icon-btn svg { display: block; }

.nowrap { white-space: nowrap; }

/* ---- language switcher ---- */
.lang-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.lang-switch-wrap > span { font-size: 12px; }
select.lang-switch {
  width: auto;
  padding: 4px 8px;
  font-size: 13px;
}

/* ---- concept hierarchy tree ---- */
ul.tree { list-style: none; margin: 0; padding: 0; }
ul.tree.tree-root { margin-top: 4px; }
ul.tree ul.tree {
  margin-left: 10px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.tree-node { position: relative; padding: 2px 0; }

.concept { padding: 6px 0; }
.concept-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.concept-icon { display: inline-flex; align-items: center; color: var(--accent); flex: none; }
.concept-label { font-weight: 600; }

/* ---- concept pill: the concept name as one recognisable badge ---- */
.concept-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 12px 3px 9px;
  border-radius: 999px;
  background: var(--primary-pale, #ede8f9);
  border: 1px solid rgba(92, 63, 165, .22);
  color: var(--primary-dark, #3d2875);
  font-size: 13.5px;
  line-height: 1.35;
  vertical-align: middle;
}
.concept-pill .concept-label { white-space: nowrap; }
a.concept-pill { text-decoration: none; transition: background .15s, border-color .15s; }
a.concept-pill:hover {
  text-decoration: none;
  background: #e2daf6;
  border-color: rgba(92, 63, 165, .45);
}
.concept-name { font-weight: 600; color: var(--fg); }
.concept-ref { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.concept-ref .concept-name { font-weight: 500; }
.pill-row { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.concept-alt { font-size: 12.5px; font-style: italic; margin-top: 4px; }
.concept-def { font-size: 13px; margin-top: 3px; max-width: 70ch; }
.concept-rel { font-size: 12px; margin-top: 3px; }
.concept-rel .concept-pill { font-size: 12px; padding: 1px 9px 1px 7px; }

.editorial-note {
  margin-top: 10px;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  color: #1e3a8a;
  font-size: 13px;
}

.chip {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--code-bg);
  color: var(--accent);
}
/* Green id badge — distinguishes a vocabulary's id/project from the
   purple (accent) chips used for concept metadata. */
.chip.green { background: #dcfce7; color: var(--ok); }

/* Type marker shown above a vocabulary / concept title. */
.type-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: 8px;
}
.type-label svg { display: block; flex: none; }
.concept-parent { font-size: 11px; }

/* ---- viewer toolbar: hierarchy / A–Z toggle + expand controls ---- */
.concept-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.seg-btn {
  border: none;
  border-radius: 0;
  padding: 5px 12px;
  background: var(--card);
  color: var(--fg);
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--accent); color: var(--accent-fg); }
.seg-btn:hover:not(.active) { background: var(--code-bg); }

/* ---- collapse twisty ---- */
.twisty {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  width: 18px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  flex: none;
}
.twisty:hover { color: var(--accent); }
.twisty-spacer { display: inline-block; width: 18px; flex: none; }
.tree-node.collapsed > ul.tree { display: none; }

/* ---- flat A–Z list ---- */
.flat-list { list-style: none; margin: 0; padding: 0; }
.flat-item { padding: 6px 0; border-bottom: 1px solid var(--border); }
.flat-item:last-child { border-bottom: none; }

/* ---- concept detail: narrow-terms box ---- */
ul.narrow-terms { list-style: none; margin: 0; padding: 0; }
ul.narrow-terms li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
ul.narrow-terms li:last-child { border-bottom: none; }
ul.narrow-terms a { font-weight: 600; }

/* ---- format viewer modal (JSON / RDF / Turtle) ---- */
.voc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.voc-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: min(860px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.voc-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.voc-modal-title {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Clickable full URL of the shown output, top-left of the viewer head. */
.voc-modal-url {
  font-size: 12px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.voc-modal-url:hover { text-decoration: underline; }
.voc-modal-body {
  margin: 0;
  padding: 16px;
  overflow: auto;
  flex: 1;
  background: var(--code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  tab-size: 2;
}
.voc-modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* A withdrawn (archived) vocabulary is still served — this is how a human
   arriving from an old link learns what the API says via owl:deprecated. */
.retired-banner {
  border-color: #e7dcc4;
  background: #f6f1e7;
  color: #6b5433;
}
.retired-banner a { color: #7c5c3e; text-decoration: underline; }
