/* jev-demo query builder. Inherits jacobmapel.com's tokens; the fallbacks mirror docs/STYLE.md. */
.jevd {
  --jd-bg: var(--bg, #faf8f4);
  --jd-elev: var(--bg-elev, #f1ede4);
  --jd-fg: var(--fg, #1f1d1a);
  --jd-muted: var(--fg-muted, #6b665d);
  --jd-rule: var(--rule, #d9d3c4);
  --jd-accent: var(--accent, #6b3a1f);
  --jd-accent-soft: var(--accent-soft, #f3e9dd);
  --jd-sans: var(--font-sans, "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  --jd-mono: var(--font-mono, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace);
  --jd-bad: #9b2c1f;
  font-family: var(--jd-sans); font-size: 0.9375rem; line-height: 1.5; color: var(--jd-fg);
  border: 1px solid var(--jd-rule); border-radius: 12px; background: var(--jd-bg);
  padding: 16px; display: grid; gap: 16px; margin-block: 1.5rem;
  /* grid items default to min-width:auto, so one long unwrapped line (the JSON <pre>) would widen
     the whole widget past the page column; pin every track to the container's width */
  grid-template-columns: minmax(0, 1fr); max-width: 100%; min-width: 0;
}
.jevd > *, .jevd .jd-results, .jevd .jd-res, .jevd details { min-width: 0; }
.jevd .jd-results, .jevd .jd-res { grid-template-columns: minmax(0, 1fr); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .jevd { --jd-bad: #e8836f; } }
:root[data-theme="dark"] .jevd { --jd-bad: #e8836f; }
.jevd * { box-sizing: border-box; }
.jevd .jd-status { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 0.8125rem; color: var(--jd-muted); }
.jevd .jd-dot { width: 8px; height: 8px; border-radius: 50%; background: #2f8f55; display: inline-block; margin-inline-end: 6px; }
.jevd .jd-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.jevd label { font-size: 0.8125rem; color: var(--jd-muted); display: grid; gap: 4px; }
.jevd textarea, .jevd input, .jevd select {
  font: inherit; color: var(--jd-fg); background: var(--jd-bg); border: 1px solid var(--jd-rule);
  border-radius: 8px; padding: 7px 9px; width: 100%; font-size: 0.875rem;
}
.jevd textarea { font-family: var(--jd-mono); font-size: 0.8125rem; min-height: 96px; resize: vertical; }
.jevd select { width: auto; }
.jevd button {
  font: inherit; font-size: 0.8125rem; border-radius: 8px; padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--jd-rule); background: var(--jd-elev); color: var(--jd-fg);
}
.jevd button.jd-primary { background: var(--jd-accent); border-color: var(--jd-accent); color: var(--jd-bg); font-weight: 600; }
.jevd button:disabled { opacity: 0.55; cursor: not-allowed; }
.jevd button:focus-visible, .jevd input:focus-visible, .jevd textarea:focus-visible, .jevd select:focus-visible {
  outline: 2px solid var(--jd-accent); outline-offset: 1px;
}
.jevd .jd-link { background: none; border: 0; padding: 2px 4px; color: var(--jd-accent); text-decoration: underline; }
.jevd .jd-qs { display: grid; gap: 12px; }
.jevd .jd-q { border: 1px solid var(--jd-rule); border-radius: 10px; padding: 12px; display: grid; gap: 10px; background: var(--jd-elev); }
.jevd .jd-q-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.jevd .jd-q-head label:nth-child(2) { flex: 1 1 220px; }
.jevd .jd-q-id { font-family: var(--jd-mono); font-size: 0.8125rem; color: var(--jd-muted); padding-bottom: 8px; }
.jevd .jd-opts { display: grid; gap: 6px; }
.jevd .jd-opt { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(120px, 2fr) auto; gap: 6px; align-items: center; }
.jevd .jd-opt.lvl { grid-template-columns: 2.2em 1fr auto; }
.jevd .jd-opt .jd-n { font-family: var(--jd-mono); font-size: 0.8125rem; color: var(--jd-muted); text-align: end; }
.jevd .jd-results { display: grid; gap: 14px; }
.jevd .jd-res { display: grid; gap: 6px; }
.jevd .jd-res-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 0.875rem; }
.jevd .jd-res-head b { font-weight: 600; }
.jevd .jd-res-head span { color: var(--jd-muted); font-variant-numeric: tabular-nums; }
.jevd .jd-bar { display: grid; grid-template-columns: minmax(70px, 30%) 1fr 3.6em; gap: 8px; align-items: center; font-size: 0.8125rem; }
.jevd .jd-bar .jd-lab { overflow-wrap: anywhere; }
.jevd .jd-track { height: 12px; border-radius: 0 4px 4px 0; background: var(--jd-accent-soft); position: relative; }
.jevd .jd-fill { position: absolute; inset: 0 auto 0 0; background: var(--jd-accent); border-radius: 0 4px 4px 0; opacity: 0.45; }
.jevd .jd-bar.top .jd-fill { opacity: 1; }
.jevd .jd-bar .jd-p { text-align: end; font-family: var(--jd-mono); font-variant-numeric: tabular-nums; color: var(--jd-muted); }
.jevd .jd-err { color: var(--jd-bad); font-size: 0.875rem; }
.jevd details { border-top: 1px solid var(--jd-rule); padding-top: 10px; }
.jevd summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; }
/* match the site's code blocks: it forces a dark --code-bg on every <pre> in both themes */
.jevd pre {
  font-family: var(--jd-mono); font-size: 0.75rem; line-height: 1.45;
  background: var(--code-bg, #1a1816); color: #e8e4dc;
  border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 8px 0 0; white-space: pre; max-width: 100%;
}
.jevd .jd-ended { font-size: 0.9375rem; display: grid; gap: 8px; }
.jevd .jd-note { font-size: 0.8125rem; color: var(--jd-muted); }
@media (max-width: 520px) {
  .jevd { padding: 12px; }
  .jevd .jd-opt { grid-template-columns: 1fr auto; }
  .jevd .jd-opt input:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}
