/* plaza — a quiet dark gallery so the generated fingerprints carry the colour. */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-glow: #161b26;
  --bg-90: rgba(11, 13, 18, 0.82);
  --panel: #141821;
  --panel-2: #1b202b;
  --line: #2a3342;
  --ink: #e7ecf3;
  --muted: #9aa7ba;
  --faint: #6b7787;
  --accent: #7cc4ff;
  --accent-2: #b99cff;
  --radius: 14px;
  --maxw: 1180px;
  --font-2: Georgia, "Palatino Linotype", "Times New Roman", serif; /* second-level (subtitles) */
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --bg-glow: #e6edf7;
  --bg-90: rgba(245, 247, 250, 0.82);
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --line: #d9dfe8;
  --ink: #18212f;
  --muted: #54617a;
  --faint: #8893a4;
  --accent: #2563eb;
  --accent-2: #7c3aed;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg-glow) 0%, var(--bg) 60%);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---- header / hero ---- */
header.site {
  padding: 40px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
header.site h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
header.site h1 .dot { color: var(--accent-2); }
header.site p.tag { margin: 6px 0 0; color: var(--muted); }
header.site .meta { margin-top: 10px; color: var(--faint); font-size: 13px; }

/* header nav + theme toggle (shared by both pages) */
.site-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); font-size: 14px; }
.site-nav a:hover { color: var(--ink); }
.theme-toggle { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: 5px 10px; cursor: pointer; font-size: 15px; line-height: 1; }
.theme-toggle:hover { border-color: var(--faint); }

/* ---- search + filters ---- */
.controls {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg-90);
  backdrop-filter: blur(6px);
  padding: 14px 0 12px; margin-bottom: 18px;
}
.searchbar {
  display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
}
.searchbar input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--ink); font-size: 16px;
}
.searchbar .count { color: var(--faint); font-size: 13px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  font-size: 12.5px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 4px 11px; border-radius: 999px; cursor: pointer; user-select: none;
}
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip.on { color: #0b0d12; background: var(--accent); border-color: var(--accent); }

/* ---- catalog grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; padding-bottom: 8px; }
.cat-sec { margin-bottom: 28px; }
h2.cat { display: flex; align-items: center; gap: 10px; font-size: 16px; letter-spacing: -0.01em; color: var(--ink); margin: 22px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
h2.cat .cat-n { font-size: 12px; font-weight: 500; color: var(--faint); }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: var(--faint); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.card .art { aspect-ratio: 16 / 10; background: #0a0c11; position: relative; }
.card .art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card .art .kind {
  position: absolute; top: 9px; right: 10px; font-size: 10.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); background: var(--bg-90);
  border: 1px solid var(--line); padding: 2px 7px; border-radius: 999px; backdrop-filter: blur(3px);
}
.card .body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card .title { font-weight: 620; font-size: 15px; line-height: 1.3; }
.card .subtitle { font-family: var(--font-2); font-style: italic; font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.card .blurb { color: var(--muted); font-size: 13px; flex: 1; }
.card .stats { color: var(--faint); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card .stats b { color: var(--muted); font-weight: 600; }
.card .stats .size b { color: var(--accent); }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card .tags span { font-size: 11px; color: var(--faint); background: var(--panel-2); padding: 2px 8px; border-radius: 999px; }
.card .tags span.facet { color: var(--accent); border: 1px solid var(--line); }
.hero-facets { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 4px; }
.pill.facet { color: var(--accent); }
.card.skeleton .art { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: .85; } }

.empty { color: var(--faint); padding: 50px 0; text-align: center; }

/* ontology reference cards + modal */
.ogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding-bottom: 8px; }
.ocard { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; transition: border-color .12s, transform .12s; }
.ocard:hover, .ocard:focus { border-color: var(--accent); transform: translateY(-2px); outline: none; text-decoration: none; }
.ocard .art { aspect-ratio: 16 / 10; background: #0a0c11; position: relative; }
.ocard .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ocard .art .kind { position: absolute; top: 8px; right: 9px; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--bg-90); border: 1px solid var(--line); padding: 2px 7px; border-radius: 999px; backdrop-filter: blur(3px); }
.ocard-body { padding: 11px 13px; }
.ocard-name { font-weight: 620; font-size: 14px; }
.ocard-meta { color: var(--faint); font-size: 12px; margin-top: 3px; }

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.modal[hidden] { display: none; }
.modal-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; max-width: 540px; width: 100%; max-height: 80vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--faint); font-size: 24px; line-height: 1; cursor: pointer; }
.modal-x:hover { color: var(--ink); }
.modal-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.modal-card h2 { margin: 4px 0 8px; font-size: 22px; }
.modal-desc { color: var(--muted); margin: 0 0 12px; }
.modal-link { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.modal-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 18px 0 8px; }
.modal-used { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 9px; }
.modal-used a { font-size: 14px; }
.modal-terms { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0 2px; }
.modal-terms span { font: 11px ui-monospace, Consolas, monospace; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; }

/* fullscreen schema lightbox */
.fs-btn { text-transform: none; font: 12px ui-sans-serif, system-ui, sans-serif; margin-left: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 3px 10px; cursor: pointer; }
.fs-btn:hover { color: var(--ink); border-color: var(--faint); }
.modal-wide { max-width: 95vw; width: 95vw; max-height: 92vh; height: 92vh; display: flex; flex-direction: column; padding: 16px 18px; }
.modal-schema { flex: 1; min-height: 0; align-items: stretch; }
.modal-schema .schema-graph { height: 100%; min-height: 0; }
.modal-schema .uml { height: 100%; }
.modal-schema .schema-info { height: 100%; overflow: auto; }

/* ---- detail page ---- */
.back { display: inline-block; margin: 24px 0 8px; color: var(--muted); }
.detail-hero { display: grid; grid-template-columns: 320px 1fr; gap: 26px; align-items: start; margin-bottom: 26px; }
.detail-hero .art { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16 / 10; background: #0a0c11; }
.detail-hero .art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.detail-hero .art-cap { color: var(--faint); font-size: 12px; margin-top: 8px; line-height: 1.4; }
.detail-hero .art-cap code { color: var(--muted); }
.detail-hero .hero-links { margin-top: 8px; }

/* files dropdown + copy-link (under the thumbnail) */
.files { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.files-dd { position: relative; }
.files-dd > summary { list-style: none; cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font-size: 13.5px; color: var(--ink); }
.files-dd > summary::-webkit-details-marker { display: none; }
.files-dd[open] > summary { border-color: var(--faint); }
.files-menu { position: absolute; z-index: 25; margin-top: 6px; min-width: 270px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 14px 34px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 3px; }
.file-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.file-opt:hover { background: var(--panel-2); text-decoration: none; }
.file-opt small { color: var(--faint); }
.copy-link { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 8px 14px; font-size: 13.5px; cursor: pointer; }
.copy-link:hover { border-color: var(--faint); }
.ft { font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px; border-radius: 6px; }
.ft.rete { background: #241a2e; color: #c9a6ff; }
.ft.parquet { background: #1d2b3a; color: #8fd0ff; }
.ft.duckdb { background: #2e2718; color: #ffd479; }
.ft.sqlite { background: #16241f; color: #7fe0b0; }

/* d3 ontology/schema graph */
.schema-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.schema-graph { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: 440px; }
.schema-info { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-size: 13px; min-height: 120px; }
.si-hint { color: var(--faint); }
.si-title { font-weight: 700; font-size: 15px; }
.si-iri { color: var(--faint); font-size: 11px; word-break: break-all; margin: 2px 0 8px; font-family: ui-monospace, Consolas, monospace; }
.si-rels { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.si-rel { font-size: 12px; color: var(--muted); }
.si-rel .dir { color: var(--accent); font-weight: 700; }
.si-rel .n { color: var(--faint); float: right; }
/* UML class diagram (ELK orthogonal routing) */
.uml { width: 100%; height: 560px; display: block; }
.ubox { cursor: pointer; }
.ubox-bg { fill: var(--panel-2); stroke: var(--line); stroke-width: 1; }
.ubox-hdfull { stroke: rgba(0,0,0,0.22); stroke-width: 0.5; }
.ubox-badge { fill: rgba(255,255,255,0.85); font: 600 10px ui-sans-serif, system-ui, sans-serif; pointer-events: none; }
.ubox-title { fill: #fff; font: 600 13px ui-sans-serif, system-ui, sans-serif; }
.ubox-attr { fill: var(--muted); font: 11px ui-monospace, "Cascadia Code", Consolas, monospace; }
.ubox.dim { opacity: .25; }
.ubox.hot .ubox-bg { stroke: var(--accent); stroke-width: 2; }
.uedge { fill: none; stroke: var(--faint); stroke-width: 1.4; stroke-opacity: .7; }
.uedge.hot { stroke: var(--accent); stroke-opacity: 1; stroke-width: 2; }
.uedge.dim { stroke-opacity: .1; }
.uarrow { fill: var(--faint); }
.uedge-label text { fill: var(--muted); font: 11px ui-monospace, Consolas, monospace; }
.uedge-label rect { fill: var(--panel); opacity: .85; }
.uedge-label.hot text { fill: var(--accent); }
.uedge-label.dim { opacity: .2; }
@media (max-width: 820px) { .schema-wrap { grid-template-columns: 1fr; } }
.detail-hero h1 { margin: 2px 0 2px; font-size: 26px; letter-spacing: -0.01em; }
.detail-hero .hero-subtitle { font-family: var(--font-2); font-style: italic; font-size: 17px; color: var(--muted); margin: 0 0 8px; line-height: 1.3; }
.detail-hero .desc { color: var(--muted); }
.detail-hero .facts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0; color: var(--faint); font-size: 13px; }
.detail-hero .facts b { color: var(--ink); font-weight: 620; font-variant-numeric: tabular-nums; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.warn { color: #ffd0d0; border-color: #5a2a2a; background: #2a1414; }
.pill.ok { color: #cdebd6; border-color: #2a4a36; background: #14241a; }

.section { margin: 26px 0; }
.section h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 12px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.barlist { display: flex; flex-direction: column; gap: 6px; }
.barlist .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.barlist .row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.barlist .row .n { color: var(--faint); font-variant-numeric: tabular-nums; }
.barlist .row .track { grid-column: 1 / -1; height: 4px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.barlist .row .track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* external-provider connections */
.conns { display: flex; flex-wrap: wrap; gap: 8px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.conn:hover { border-color: var(--accent); text-decoration: none; }
.conn small { color: var(--faint); }
.card .conns-mini { font-size: 11.5px; color: var(--muted); }

.companions { display: flex; flex-wrap: wrap; gap: 10px; }
.companion {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--ink);
}
.companion .ft { font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px; border-radius: 6px; }
.companion .ft.rete { background: #241a2e; color: #c9a6ff; }
.companion .ft.parquet { background: #1d2b3a; color: #8fd0ff; }
.companion .ft.duckdb { background: #2e2718; color: #ffd479; }
.companion .ft.sqlite { background: #16241f; color: #7fe0b0; }
.companion small { color: var(--faint); }

/* ---- explore panel ---- */
.explore { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.explore .ac { position: relative; }
.explore input.search {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font-size: 15px; padding: 11px 13px; outline: none;
}
.explore input.search:focus { border-color: var(--accent); }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  max-height: 280px; overflow: auto; box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.ac-list .item { padding: 8px 13px; cursor: pointer; font-size: 13.5px; display: flex; flex-direction: column; }
.ac-list .item:hover, .ac-list .item.active { background: #232a38; }
.ac-list .item .iri { color: var(--faint); font-size: 11px; }
.ac-list .empty-ac { padding: 10px 13px; color: var(--faint); font-size: 13px; }

.starter { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.starter button {
  font-size: 12px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; cursor: pointer;
}
.starter button:hover { color: var(--ink); border-color: var(--faint); }
textarea.sparql {
  width: 100%; min-height: 110px; resize: vertical; margin-top: 8px;
  background: #0c0f15; color: #d7e3f2; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font: 12.5px/1.5 ui-monospace, Consolas, monospace; outline: none;
}
textarea.sparql:focus { border-color: var(--accent); }
.run-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
button.run {
  background: var(--accent); color: #08111b; border: 0; border-radius: 10px;
  font-weight: 650; padding: 9px 18px; cursor: pointer; font-size: 14px;
}
button.run:disabled { opacity: .5; cursor: default; }
.run-row .status { color: var(--faint); font-size: 13px; }

.results { margin-top: 14px; overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 10px; }
table.rs { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.rs th, table.rs td { text-align: left; padding: 7px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rs th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); }
table.rs td { color: var(--ink); }
table.rs tr:hover td { background: #161b25; }

.notice { color: var(--faint); font-size: 12.5px; margin-top: 10px; }
.warnbox { background: #241616; border: 1px solid #4a2727; color: #f3c9c9; padding: 12px 14px; border-radius: 10px; font-size: 13px; }

@media (max-width: 820px) {
  .detail-hero { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr; }
}
