:root {
  --paper: #EDF0EC;
  --surface: #F8FAF7;
  --ink: #1D2B44;
  --muted: #566274;
  --rule: #C9D1CB;
  --onto: #23577A;
  --onto-soft: #DCE8F0;
  --taxo: #A8741A;
  --taxo-soft: #F2E6CF;
  --flag: #B23A3A;
  --flag-soft: #F4DEDB;
  --ok: #2E6B4F;
  --code-bg: #E3E8E4;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151B24; --surface: #1C2430; --ink: #E4E9F0; --muted: #9AA6B6; --rule: #344050;
    --onto: #7DB3D8; --onto-soft: #1F3446; --taxo: #DDAA55; --taxo-soft: #3A2F1C; --flag: #E58A84; --flag-soft: #3D2323; --ok: #7CC4A0; --code-bg: #10161E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151B24; --surface: #1C2430; --ink: #E4E9F0; --muted: #9AA6B6; --rule: #344050;
  --onto: #7DB3D8; --onto-soft: #1F3446; --taxo: #DDAA55; --taxo-soft: #3A2F1C; --flag: #E58A84; --flag-soft: #3D2323; --ok: #7CC4A0; --code-bg: #10161E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.55 var(--sans); overflow-x: hidden; }
a { color: var(--onto); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--taxo); outline-offset: 2px; }
code, pre, textarea#sparql { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--code-bg); padding: 0.05em 0.3em; border-radius: 3px; overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main > section { margin-bottom: 88px; }
.tbl td.num, .slider output, .pipeline i, #sweep text { font-variant-numeric: tabular-nums; }
h1 { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.3rem); line-height: 1.06; letter-spacing: -0.02em; font-weight: 800; margin: 0.2em 0 0.45em; max-width: 19ch; }
h2 { font-size: clamp(1.45rem, 1.1rem + 1.4vw, 1.95rem); line-height: 1.15; letter-spacing: -0.01em; font-weight: 750; margin: 0 0 0.6em; }
h3 { font-size: 1.12rem; font-weight: 700; margin: 2em 0 0.5em; }
p { margin: 0 0 1em; }
.small { font-size: 0.9rem; color: var(--muted); }

.masthead { padding-top: 28px; padding-bottom: 28px; }
.site { display: flex; justify-content: space-between; font-weight: 600; font-size: 0.95rem; }
.site a { color: var(--ink); text-decoration: none; }
.site .lang a { color: var(--muted); font-weight: 500; }
.lede { font-size: 1.15rem; max-width: 62ch; }
.honest { border-left: 4px solid var(--taxo); padding: 0.2em 0 0.2em 0.9em; color: var(--ink); font-weight: 500; }
.status { font-weight: 600; }
.status a { font-weight: 700; }
.status.pass::before, .status.fail::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.5em; vertical-align: 0.05em; background: var(--ok); }
.status.fail::before { background: var(--flag); }

.k-onto { color: var(--onto); font-weight: 700; }
.k-taxo { color: var(--taxo); font-weight: 700; }

/* ---------------- ask */
.askbar { background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; padding: 14px 16px 12px; }
.askbar textarea { width: 100%; border: 0; background: transparent; color: var(--ink); font: 600 clamp(1.15rem, 1rem + 1vw, 1.55rem)/1.3 var(--sans); resize: none; min-height: 2.6em; padding: 0; overflow: hidden; }
.askbar textarea:focus { outline: none; }
.askbar:focus-within { border-color: var(--onto); }
.askbar-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 8px; }
.hint { color: var(--muted); font-size: 0.85rem; }
button { font: 700 0.95rem var(--sans); background: var(--ink); color: var(--paper); border: 0; border-radius: 6px; padding: 0.6em 1.1em; cursor: pointer; }
button:disabled { opacity: 0.55; cursor: progress; }
button.quiet { background: transparent; color: var(--onto); border: 1.5px solid var(--onto); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; }
.chips button { background: transparent; color: var(--ink); border: 1.5px solid var(--rule); font-weight: 500; font-size: 0.86rem; text-align: left; border-radius: 4px; padding: 0.35em 0.7em; max-width: 100%; }
.chips button[aria-pressed="true"] { border-color: var(--ink); background: var(--surface); }
.chips button.cl { border-style: dashed; }

.pipeline { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border-top: 3px solid var(--rule); }
.pipeline li { padding: 10px 10px 0 0; position: relative; }
.pipeline li::before { content: ""; position: absolute; top: -3px; left: 0; height: 3px; width: 0; background: var(--onto); transition: width 380ms ease-out; }
.pipeline li.done::before { width: 100%; }
.pipeline li.stop::before { width: 100%; background: var(--taxo); }
.pipeline li.bad::before { width: 100%; background: var(--flag); }
.pipeline b { display: block; font-size: 0.95rem; }
.pipeline span { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.pipeline i { display: block; font-style: normal; font-weight: 700; font-size: 0.85rem; color: var(--onto); min-height: 1.3em; }
@media (prefers-reduced-motion: reduce) { .pipeline li::before { transition: none; } }

.answer { min-height: 120px; }
.answer .meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }
.answer .meta strong { color: var(--ink); }
.ans-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; align-items: start; }
pre.sparql { background: var(--code-bg); border-radius: 6px; padding: 12px 14px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 0.8rem; }
.sparql .t-onto { color: var(--onto); font-weight: 600; }
.sparql .t-taxo { color: var(--taxo); font-weight: 600; }
.checks { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.86rem; }
.checks li { padding-left: 1.2em; position: relative; margin: 2px 0; }
.checks li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--ok); }
.checks li.err::before { background: var(--flag); }
.checks li.warn::before { background: var(--taxo); }
.clarify { border-left: 4px solid var(--taxo); background: var(--taxo-soft); padding: 12px 16px; border-radius: 0 6px 6px 0; font-size: 1.05rem; }
.errbox { border-left: 4px solid var(--flag); background: var(--flag-soft); padding: 12px 16px; border-radius: 0 6px 6px 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px solid var(--rule); padding: 8px 0; }
.rows details summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.rows details summary::-webkit-details-marker { display: none; }
.rows details summary .sub { color: var(--muted); font-weight: 400; font-size: 0.86rem; }
.rows details[open] summary { color: var(--onto); }
.cites { list-style: none; padding: 6px 0 4px 12px; margin: 6px 0 0; border-left: 3px solid var(--onto-soft); font-size: 0.84rem; }
.cites li { margin: 3px 0; }
.cites .src { color: var(--muted); }
.more { color: var(--muted); font-size: 0.88rem; margin-top: 8px; }

/* ---------------- ontology */
.diagram { margin: 24px 0 8px; }
.diagram svg { width: 100%; min-width: 640px; height: auto; display: block; }
.diagram figcaption { color: var(--muted); font-size: 0.86rem; margin-top: 8px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
#class-diagram text { font: 500 12px var(--sans); fill: var(--ink); }
#class-diagram .nodes text { text-anchor: middle; font-weight: 700; font-size: 13px; }
#class-diagram .nodes .small text { font-size: 11.5px; font-weight: 600; }
#class-diagram .cls rect { fill: var(--surface); stroke: var(--onto); stroke-width: 1.6; }
#class-diagram .con rect { fill: var(--taxo-soft); stroke: var(--taxo); stroke-width: 1.4; }
#class-diagram .edges-onto path { fill: none; stroke: var(--onto); stroke-width: 1.6; }
#class-diagram .edges-onto text { fill: var(--onto); font-size: 11px; }
#class-diagram .edges-taxo path { fill: none; stroke: var(--taxo); stroke-width: 1.5; stroke-dasharray: 5 4; }
#class-diagram .edges-taxo text { fill: var(--taxo); font-size: 11px; font-weight: 600; }
#class-diagram .sub path { fill: none; stroke: var(--rule); stroke-width: 2; }
#class-diagram .m-onto { fill: var(--onto); }
#class-diagram .m-taxo { fill: var(--taxo); }
.trees { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 28px 0; }
.tree h4 { margin: 0 0 6px; font-size: 0.95rem; color: var(--taxo); }
.tree ul { list-style: none; margin: 0; padding-left: 12px; border-left: 2px dashed var(--taxo); font-size: 0.86rem; }
.tree > ul { padding-left: 10px; }
.tree li { margin: 2px 0; }
.tree .dep { text-decoration: line-through; color: var(--muted); }
.tree .dep + small { color: var(--taxo); display: block; }
.version { border-top: 2px solid var(--rule); padding-top: 4px; }
.files a { font-weight: 600; }

/* ---------------- ER */
.er-figure { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 24px 0; }
.er-readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 20px; border-top: 3px solid var(--ink); padding-top: 10px; }
.er-readout div { font-size: 0.82rem; color: var(--muted); line-height: 1.3; }
.er-readout b { display: block; font-size: 1.5rem; color: var(--ink); font-weight: 800; letter-spacing: -0.01em; }
.er-readout .p b { color: var(--onto); }
.er-readout .r b { color: var(--taxo); }
.chart { margin: 0; }
.chart svg { width: 100%; min-width: 540px; height: auto; display: block; }
#sweep text { font: 500 11px var(--sans); fill: var(--muted); }
#sweep .grid { stroke: var(--rule); stroke-width: 1; }
#sweep .lp { fill: none; stroke: var(--onto); stroke-width: 2.4; }
#sweep .lr { fill: none; stroke: var(--taxo); stroke-width: 2.4; }
#sweep .ld { fill: none; stroke-width: 1.4; stroke-dasharray: 3 3; }
#sweep .chosen { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 2 3; }
#sweep .cursor { stroke: var(--ink); stroke-width: 2; }
#sweep .lab-p { fill: var(--onto); font-weight: 700; }
#sweep .lab-r { fill: var(--taxo); font-weight: 700; }
#sweep .lab-c { fill: var(--ink); font-weight: 600; }
.chart figcaption { color: var(--muted); font-size: 0.86rem; }
.slider { display: flex; align-items: center; gap: 12px; margin: 6px 0; font-weight: 600; font-size: 0.9rem; }
.slider input { flex: 1; accent-color: var(--onto); min-width: 0; }
.slider output { min-width: 3.5em; text-align: right; font-weight: 700; }
.sample { background: var(--surface); border-radius: 8px; padding: 14px 16px; border: 1px solid var(--rule); }
.sample .canon { font-size: 1.2rem; font-weight: 800; margin: 0 0 8px; }
.sample .canon code { font-size: 0.7em; font-weight: 400; }
.recs { list-style: none; margin: 0 0 12px; padding: 0; font-size: 0.88rem; }
.recs li { padding: 3px 0; border-bottom: 1px dotted var(--rule); }
.recs .srcname { display: inline-block; min-width: 6.5em; color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.pair fieldset { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
.pair legend { font-weight: 700; font-size: 0.9rem; padding: 0 4px; }
.pair label { display: block; font-size: 0.8rem; color: var(--muted); margin: 4px 0; }
.pair input { display: block; width: 100%; font: 500 0.95rem var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 5px 7px; }
.pair button { grid-column: 1 / -1; justify-self: start; }
.pair-out { margin-top: 14px; }
.verdict { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.bars { list-style: none; margin: 0; padding: 0; font-size: 0.84rem; }
.bars li { display: grid; grid-template-columns: 11em 1fr 3.4em; gap: 8px; align-items: center; margin: 2px 0; }
.bars .track { position: relative; height: 10px; background: var(--code-bg); border-radius: 2px; }
.bars .fill { position: absolute; top: 0; height: 10px; border-radius: 2px; }
.bars .pos { background: var(--onto); left: 50%; }
.bars .neg { background: var(--flag); right: 50%; }
.bars .v { text-align: right; font-weight: 600; }

/* ---------------- tables */
.tbl { border-collapse: collapse; width: 100%; font-size: 0.86rem; min-width: 560px; }
.tbl th, .tbl td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tbl th { font-weight: 700; color: var(--muted); font-size: 0.8rem; border-bottom: 2px solid var(--ink); }
.tbl td.num { text-align: right; font-weight: 700; padding-right: 14px; }
.tbl .pass { color: var(--ok); font-weight: 700; }
.tbl .fail { color: var(--flag); font-weight: 700; }
.tbl tr.failed td { background: var(--flag-soft); }
.bench-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 20px; border-top: 3px solid var(--ink); padding-top: 10px; margin-bottom: 18px; }
.bench-sum div { font-size: 0.82rem; color: var(--muted); line-height: 1.3; }
.bench-sum b { display: block; font-size: 1.5rem; color: var(--ink); font-weight: 800; }

/* ---------------- console */
#sparql { width: 100%; background: var(--code-bg); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 12px; line-height: 1.5; resize: vertical; }
#sparql-form button { margin-top: 8px; }
.sparql-out { margin-top: 14px; }
.limits li { margin-bottom: 0.6em; }
.foot { border-top: 2px solid var(--rule); padding-top: 16px; padding-bottom: 40px; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 860px) {
  .ans-grid { grid-template-columns: minmax(0, 1fr); }
  .trees { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .pipeline { grid-template-columns: minmax(0, 1fr); border-top: 0; }
  .pipeline li { border-top: 3px solid var(--rule); padding: 8px 0; display: grid; grid-template-columns: 8.5em 1fr; gap: 0 10px; }
  .pipeline li span { grid-column: 2; grid-row: 1 / span 2; }
  .pipeline li i { grid-column: 1; }
  .trees { grid-template-columns: minmax(0, 1fr); }
  .er-readout, .bench-sum { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .bars li { grid-template-columns: 9em 1fr 3em; }
}
