/* Shared styles for the xql-toolchain demo site.
   Palette matches the editor's xql-dark theme so the pages and the embedded Monaco agree. */

:root {
  --bg: #1e293b;
  --bg-raised: #263449;
  --bg-sunken: #172032;
  --bar: #303c50;
  --line: #334155;
  --fg: #eaebeb;
  --fg-dim: #94a3b8;
  --fg-faint: #64748b;
  --accent: #29b2ff;
  --green: #51c151;
  --red: #f44747;
  --amber: #cca700;
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- top nav */

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.topnav .brand {
  font-weight: 600;
  letter-spacing: .3px;
  margin-right: 16px;
  padding: 12px 0;
  color: var(--fg);
  text-decoration: none;
}
.topnav a:not(.brand) {
  color: var(--fg-dim);
  text-decoration: none;
  padding: 12px 12px;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}
.topnav a:not(.brand):hover { color: var(--fg); }
.topnav a.active { color: var(--fg); border-bottom-color: var(--accent); }
.topnav .spacer { flex: 1; }

/* ---------------------------------------------------------------- generic */

.page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 32px 24px 80px; }
.wrap.wide { max-width: 1100px; }

h1, h2, h3, h4 { line-height: 1.3; margin: 1.8em 0 .6em; }
h1 { font-size: 28px; margin-top: .4em; }
h2 { font-size: 20px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
h3 { font-size: 16px; }
p { margin: .8em 0; }
a { color: var(--accent); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
strong { color: #fff; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--bg-sunken);
  padding: .12em .38em;
  border-radius: 3px;
}
pre {
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
}
pre code { background: none; padding: 0; font-size: inherit; }

blockquote {
  margin: 1.6em 0;
  padding: 2px 20px;
  background: var(--bg-raised);
  border-left: 3px solid var(--amber);
  border-radius: 0 6px 6px 0;
}
blockquote h3 { margin-top: .9em; }

table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 13px; }
th, td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--fg-dim); font-weight: 600; }
td code { white-space: nowrap; }

ul, ol { padding-left: 22px; }
li { margin: .3em 0; }

.lede { color: var(--fg-dim); font-size: 15px; }

.note {
  background: var(--bg-raised);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 10px 16px;
  margin: 1.4em 0;
  font-size: 13px;
  color: var(--fg-dim);
}
.note strong { color: var(--fg); }

/* ---------------------------------------------------- terminal blocks (cli) */

.term {
  background: #0f1626;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 1em 0 1.8em;
  overflow: hidden;
}
.term-cap {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--fg-dim);
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--line);
}
.term pre { margin: 0; border: 0; border-radius: 0; background: none; }
.term .cmd { color: var(--green); }
.term .cmd::before { content: "$ "; color: var(--fg-faint); }
.term .err-line { color: var(--red); }
.term .warn-line { color: var(--amber); }
.term .exit { color: var(--fg-faint); }

/* -------------------------------------------------------- example browser */

.browser { display: flex; flex-direction: column; min-height: 0; }
.browser-filters {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.browser-filters input,
.browser-filters select {
  background: var(--bg-sunken);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
  font: inherit;
  font-size: 12.5px;
}
.browser-filters input { flex: 1; min-width: 0; }
.browser-count { padding: 4px 10px; font-size: 11.5px; color: var(--fg-faint); flex: 0 0 auto; }

.ex-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.ex-list li {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(51, 65, 85, .5);
  cursor: pointer;
  font-size: 12.5px;
  margin: 0;
}
.ex-list li:hover { background: var(--bg-raised); }
.ex-list li.sel { background: #31435e; }
.ex-list .ex-name { display: flex; gap: 6px; align-items: baseline; }
.ex-list .ex-desc {
  color: var(--fg-faint);
  font-size: 11.5px;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ex-list .ex-labels { margin-top: 3px; }

.badge {
  font-size: 10.5px;
  padding: 0 5px;
  border-radius: 3px;
  flex: 0 0 auto;
  font-family: var(--mono);
}
.badge.clean { color: var(--green); }
.badge.warn { color: var(--amber); }
.badge.err { color: var(--red); }
.tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  margin-right: 4px;
  border-radius: 9px;
  background: #33415580;
  color: var(--fg-dim);
}

.empty { padding: 16px; color: var(--fg-faint); font-size: 12.5px; }

/* --------------------------------------------------------- editor page */

/* The editor wants a definite height to fill, but the integration snippet below it wants the
   page to scroll — so this page drops the flex-column body and gives the editor a viewport
   fraction instead. */
body.has-editor { display: block; overflow-y: auto; }
body.has-editor .split { height: 78vh; }
body.has-editor .snippet-pane { flex: none; overflow: visible; border-top: 1px solid var(--line); }

.split { flex: 1; display: flex; min-height: 0; }
.split > .side {
  width: 300px;
  flex: 0 0 300px;
  border-right: 1px solid var(--line);
  background: var(--bg-sunken);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.split > .main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.editor-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.editor-bar h2 { font-size: 13px; margin: 0; border: 0; padding: 0; font-weight: 600; }
.editor-bar .desc { font-size: 12px; color: var(--fg-dim); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-bar button {
  background: #475569; color: var(--fg); border: 0; border-radius: 4px;
  padding: 4px 9px; font-size: 12px; cursor: pointer;
}
.editor-bar button:hover { background: #5a6b82; }
.editor-bar button:disabled { opacity: .4; cursor: default; }
#status { font-size: 12px; padding: 2px 8px; border-radius: 3px; flex: 0 0 auto; }
#status.ok { color: var(--green); }
#status.err { color: var(--red); }

#editor { flex: 1; min-height: 0; }
#problems {
  height: 150px;
  flex: 0 0 auto;
  overflow: auto;
  background: var(--bg-sunken);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
}
#problems .row { padding: 3px 14px; cursor: pointer; display: flex; gap: 8px; }
#problems .row:hover { background: var(--bg-raised); }
#problems .sev-err { color: var(--red); }
#problems .sev-warn { color: var(--amber); }
#problems .loc { color: var(--green); }
#problems .empty { padding: 6px 14px; }

/* ------------------------------------------------------ highlight page */

.hl-block {
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0 0 18px;
  overflow: hidden;
}
.hl-head { padding: 8px 14px; border-bottom: 1px solid var(--line); background: #1c2740; }
.hl-head .t { font-size: 13px; font-weight: 600; }
.hl-head .d { font-size: 12px; color: var(--fg-dim); margin-top: 2px; }
.hl-code {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}
.hl-browse { display: flex; gap: 18px; align-items: flex-start; }
.hl-browse .side {
  width: 300px; flex: 0 0 300px; max-height: 560px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg-sunken); display: flex; flex-direction: column; min-height: 0;
}
.hl-browse .picked { flex: 1; min-width: 0; }

/* Monaco's colorize() output inherits the page font size; keep it in step. */
.hl-code .mtk1, .hl-code span { font-family: var(--mono); }

@media (max-width: 820px) {
  .split { flex-direction: column; }
  .split > .side { width: auto; flex: 0 0 220px; border-right: 0; border-bottom: 1px solid var(--line); }
  .hl-browse { flex-direction: column; }
  .hl-browse .side { width: auto; flex: 0 0 auto; }
}
