/* Shared styling for the interactive demos (demos/src/). Colours are variables on
   .qb-demo, so a dark theme only needs to override these. */
.qb-demo {
  --qb-fg: #222; --qb-muted: #777; --qb-grid: #e3e3e3; --qb-axis: #444;
  --qb-bg: #fff; --qb-panel: #f6f7f9; --qb-accent: #1f77b4;
  --qb-c1: #1f77b4; --qb-c2: #d62728; --qb-c3: #2ca02c; --qb-c4: #ff7f0e; --qb-c5: #9467bd;
  display: flex; flex-wrap: wrap; gap: 1.2em; align-items: flex-start;
  color: var(--qb-fg); font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.35; margin: 1em 0;
}
.qb-demo svg { display: block; user-select: none; -webkit-user-select: none; }
.qb-demo svg text { fill: var(--qb-fg); font-family: inherit; }
.qb-demo .qb-plot { flex: 1 1 320px; min-width: 0; max-width: 560px; }
.qb-demo .qb-panel { flex: 0 1 300px; display: flex; flex-direction: column; gap: .55em; }
.qb-demo .grid { stroke: var(--qb-grid); }
.qb-demo .axis { stroke: var(--qb-axis); }
.qb-demo .handle { fill: #fff; stroke-width: 3; cursor: grab; }

.qb-demo .qb-slider { display: grid; grid-template-columns: auto 1fr 3.6em; gap: .5em; align-items: center; }
.qb-demo .qb-slider-name { white-space: nowrap; }
.qb-demo .qb-slider input[type=range] { width: 100%; min-width: 6em; accent-color: var(--qb-accent); }
.qb-demo .qb-slider output { font-family: ui-monospace, monospace; text-align: right; }
.qb-demo .qb-check { display: flex; align-items: center; gap: .3em; cursor: pointer; }
.qb-demo .qb-presets { display: flex; flex-wrap: wrap; gap: .35em; }
.qb-demo .qb-btn {
  font: inherit; font-size: .85em; padding: .25em .7em; border-radius: 6px; cursor: pointer;
  border: 1px solid #bbb; background: var(--qb-bg); color: var(--qb-fg);
}
.qb-demo .qb-btn:hover { border-color: var(--qb-accent); }
.qb-demo .qb-btn.active { background: var(--qb-accent); border-color: var(--qb-accent); color: #fff; }
.qb-demo .qb-readout {
  font-family: ui-monospace, monospace; font-size: .9em; white-space: pre-wrap;
  background: var(--qb-panel); border-radius: 6px; padding: .45em .6em;
}
.qb-demo .qb-note { font-size: .85em; color: var(--qb-muted); }
.qb-demo .qb-big { font-size: 1.25em; font-weight: 600; }

/* Inside a reveal.js slide: larger text, no outer margin, fit the content area. */
.reveal .qb-demo { font-size: 22px; margin: .2em 0; text-align: left; }
.reveal .qb-demo .qb-plot { max-width: none; }
.reveal .qb-demo .qb-btn { font-size: .8em; }

@media (max-width: 640px) {
  .qb-demo { flex-direction: column; }
  .qb-demo .qb-panel { flex-basis: auto; width: 100%; }
}

/* Chemistry plots use the shared qb-demo UI. Labels can wrap for scientific units. */
.qb-demo .ac-plots {flex:1 1 420px;min-width:0;max-width:640px;}
.qb-demo .ac-plots .qb-plot {width:100%;max-width:none;}
.qb-demo .ac-chart {width:100%;min-width:0;margin-bottom:.8em;}
.qb-demo .ac-axis-label {font-weight:600;margin:.25em 0;}
.qb-demo .ac-x-label {text-align:center;margin:.1em 0 .4em;}
.qb-demo .ac-controls {display:flex;flex-direction:column;gap:.7em;}
.qb-demo .qb-slider {grid-template-columns:minmax(0,1fr) minmax(80px,1fr) 4.3em;}
.qb-demo .qb-slider-name {white-space:normal;}
.qb-demo .ac-select {display:flex;flex-direction:column;gap:.2em;}
.qb-demo select {font:inherit;max-width:100%;padding:.2em;}
.qb-demo .ac-legend {display:flex;flex-wrap:wrap;gap:.3em .9em;font-size:.9em;}
.qb-demo .ac-legend span {display:inline-flex;align-items:center;gap:.4em;}
.qb-demo .ac-legend i {display:inline-block;width:1.2em;border-top:3px solid;}
.qb-demo .ac-inspect {min-height:2.6em;overflow-wrap:anywhere;}
.qb-demo .qb-readout p {margin:.3em 0;}
.qb-demo .qb-readout dl {margin:.3em 0;}
.qb-demo .qb-readout dd {margin:0 0 .4em 1em;}
.qb-demo [aria-invalid=true] {outline:2px solid #b22222;}
.qb-demo :focus-visible {outline:2px solid #1f77b4;outline-offset:3px;}
.qb-demo > * {min-width:0;}
.qb-demo .qb-panel {max-width:100%;}
.qb-demo .qb-readout {white-space:pre-line;overflow-wrap:anywhere;}
.qb-demo table {width:100%;font-size:.85em;border-collapse:collapse;}
.qb-demo th, .qb-demo td {padding:.35em;text-align:left;overflow-wrap:anywhere;}
.qb-demo caption {font-size:.95em;}
@media (max-width: 600px) {
  .qb-demo .ac-plots {flex-basis:auto;width:100%;}
}
.qb-demo .ac-history {max-width:100%;overflow-x:auto;}
.qb-demo .ac-history table {min-width:440px;}
/* Keep history headings readable; the enclosing region supplies horizontal scroll. */
.qb-demo .ac-history table {min-width:600px;}
.qb-demo .ac-history th, .qb-demo .ac-history td {overflow-wrap:normal;word-break:normal;}
