/* The live truck on the landing page. Hidden unless the script can run it, in
   which case the picture it replaces is hidden instead. */
.demo { display: none; }
.js .demo {
  display: grid; grid-template-columns: 268px minmax(0, 1fr) 288px; height: 700px; margin-top: 40px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 30px 70px -30px rgb(37 99 235 / .4);
}
.js .demo-fallback { display: none; }
.demo button { font: inherit; color: inherit; cursor: pointer; }

.demo-parts { display: flex; flex-direction: column; gap: 12px; padding: 16px; min-height: 0; border-right: 1px solid var(--line); }
.demo-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--ground); border-radius: 10px; }
.demo-seg button { min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600; }
.demo-seg button[aria-pressed="true"] { background: var(--card-2); color: var(--text); }
.demo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-chips button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 500; transition: background-color .15s, color .15s; }
.demo-chips button:hover { color: var(--text); }
.demo-chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.demo-list { list-style: none; margin: 0; padding: 0 4px 0 0; flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 4px; align-content: start; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.demo-list button { width: 100%; padding: 9px 11px; border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left; font-size: 13.5px; line-height: 1.3; font-weight: 500; transition: background-color .15s; }
.demo-list button:hover { background: var(--card-2); }
.demo-list button[aria-pressed="true"] { background: rgb(37 99 235 / .18); border-color: var(--accent); }
.demo-list small { display: block; margin-top: 2px; color: var(--text-2); font-size: 12px; font-weight: 400; }

.demo-stage { position: relative; min-width: 0; min-height: 0; background: #1b232e; }
.demo-canvas, .demo-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.demo-canvas canvas { cursor: grab; outline-offset: -3px; }
.demo-canvas canvas:active { cursor: grabbing; }
.demo-state { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text-2); font-size: 15px; }
.demo-state[hidden] { display: none; }

.demo-views, .demo-tools, .demo-xray { position: absolute; background: rgb(11 13 18 / .78); border: 1px solid var(--line); border-radius: 10px; }
.demo-views { top: 12px; left: 12px; display: flex; gap: 2px; padding: 3px; }
.demo-views button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; }
.demo-views button:hover { color: var(--text); }
.demo-views button[aria-pressed="true"] { background: var(--card-2); color: var(--text); }
.demo-xray { top: 12px; right: 12px; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; font-size: 13px; font-weight: 500; cursor: pointer; }
.demo-xray input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.demo-tools { right: 12px; bottom: 12px; display: grid; gap: 2px; padding: 3px; }
.demo-tools button { width: 36px; height: 36px; border: 0; border-radius: 7px; background: transparent; font-size: 18px; line-height: 1; }
.demo-tools button:hover { background: var(--card-2); }
.demo-hint { position: absolute; left: 12px; bottom: 12px; margin: 0; padding: 7px 12px; border-radius: 10px; background: rgb(11 13 18 / .78); font-size: 13px; color: var(--text); pointer-events: none; transition: opacity .4s; }
.demo-hint.gone { opacity: 0; }
.demo-tip { position: absolute; z-index: 1; padding: 6px 10px; border-radius: 8px; background: var(--ground); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; white-space: nowrap; pointer-events: none; transform: translate(12px, 12px); }
.demo-tip[hidden] { display: none; }

.demo-detail { padding: 20px; min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); font-size: 14px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.demo-detail .chip { display: inline-block; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--text-2); }
.demo-detail h3 { margin-top: 10px; font-size: 19px; }
.demo-detail .part { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.demo-facts { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 16px 0 0; }
.demo-facts dt { color: var(--text-2); }
.demo-facts dd { margin: 0; text-align: right; white-space: nowrap; font-weight: 500; font-variant-numeric: tabular-nums; }
.demo-counts { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }
/* A line down the left, because the order of these is the point of them. */
.demo-events { list-style: none; margin: 14px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 16px; }
.demo-events li { position: relative; }
.demo-events li::before { content: ""; position: absolute; left: -19px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); }
.demo-events b { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.demo-events b span { color: var(--text-2); font-weight: 400; font-size: 13px; font-variant-numeric: tabular-nums; }
.demo-events em { display: block; margin-top: 2px; font-style: normal; font-size: 13px; }
.demo-events p { margin: 3px 0 0; color: var(--text-2); font-size: 13.5px; }
.demo-events small { display: block; margin-top: 4px; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.demo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.demo-actions button { min-height: 38px; white-space: nowrap; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-size: 14px; font-weight: 600; transition: background-color .15s; }
.demo-actions button:hover { background: var(--card-2); }
.demo-sample { margin: 14px 0 0; color: var(--text-2); font-size: 12px; }

@media (prefers-reduced-motion: reduce) { .demo * { transition: none !important; } }

/* Narrower: the truck first and full width, what you clicked under it, the list last. */
@media (max-width: 1000px) {
  .js .demo { grid-template-columns: 1fr; height: auto; }
  .demo-stage { order: 1; height: min(62vh, 460px); }
  .demo-detail { order: 2; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .demo-parts { order: 3; border-right: 0; border-top: 1px solid var(--line); }
  .demo-list { max-height: 280px; flex: none; }
}
@media (max-width: 680px) {
  .demo-stage { height: 380px; }
  .demo-views button { padding: 0 9px; font-size: 12.5px; }
  /* Below the views bar rather than beside it: there is no room for both. */
  .demo-xray { top: 58px; left: 12px; right: auto; min-height: 36px; }
  .demo-tools { grid-template-columns: repeat(4, 1fr); }
  .demo-hint { bottom: 60px; }
}
