/* demos.css — styling for the interactive post demos.
   Reuses the site's CSS custom properties (defined in style.css / the Fisher
   post's inline <style>); every var() has a literal fallback so the widgets
   render correctly even if a variable is missing. */

.demo {
  margin: 30px 0;
  padding: 14px 16px 16px;
  background: var(--panel, #151a21);
  border: 1px solid var(--line, #222a35);
  border-radius: 10px;
}
.demo-fallback {
  margin: 0;
  color: var(--muted, #8a94a3);
  font-size: 13px;
}

.demo-head {
  margin-bottom: 10px;
  color: var(--fg, #d7dde6);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.demo-stagehost {
  width: 100%;
}
.demo-canvas {
  display: block;
  width: 100%;
  border: 1px solid var(--line, #222a35);
  border-radius: 8px;
  background: var(--bg, #0e1116);
  touch-action: none; /* let the canvas own drags on touch devices */
  cursor: grab;
}
.demo-canvas:active {
  cursor: grabbing;
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 12px;
}

.demo-slider {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 160px;
  min-width: 150px;
}
.demo-srow {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted, #8a94a3);
}
.demo-sval {
  color: var(--accent, #4aa3ff);
}
.demo-slider input[type="range"] {
  width: 100%;
  height: 22px;
  accent-color: var(--accent, #4aa3ff);
  cursor: pointer;
}

.demo-btn {
  font: inherit;
  font-size: 13px;
  color: var(--fg, #d7dde6);
  background: var(--bg, #0e1116);
  border: 1px solid var(--line, #222a35);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
.demo-btn:hover {
  border-color: var(--accent, #4aa3ff);
  color: var(--accent, #4aa3ff);
}

.demo-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted, #8a94a3);
  cursor: pointer;
}
.demo-check input {
  accent-color: var(--accent, #4aa3ff);
}

.demo-seg {
  display: inline-flex;
  border: 1px solid var(--line, #222a35);
  border-radius: 6px;
  overflow: hidden;
}
.demo-segbtn {
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted, #8a94a3);
  background: var(--bg, #0e1116);
  border: none;
  padding: 6px 12px;
}
.demo-segbtn + .demo-segbtn {
  border-left: 1px solid var(--line, #222a35);
}
.demo-segbtn.on {
  color: var(--bg, #0e1116);
  background: var(--accent, #4aa3ff);
}

.demo-readout {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted, #8a94a3);
}
.demo-readout b {
  color: var(--fg, #d7dde6);
  font-weight: 500;
}
.demo-readout .k {
  color: var(--accent, #4aa3ff);
  font-weight: 500;
}
.demo-readout .k2 {
  color: var(--accent2, #e0a458);
  font-weight: 500;
}
.demo-note {
  margin-top: 8px;
  font-size: 12px;
}

:focus-visible {
  outline: 2px solid var(--accent, #4aa3ff);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .demo-controls {
    gap: 10px 12px;
  }
  .demo-slider {
    flex-basis: 130px;
    min-width: 120px;
  }
}
