/* Your visit as a logic trace (home page footer, drawn by assets/js/trace.js).
   An instrument panel made from the page's own tokens. Each channel is drawn
   in its layer's colour (--ch-l4 to --ch-l0). */

.trace {
  --trace-row: 24px;
  margin-bottom: 28px; padding: 12px 16px 6px;
  border-radius: var(--r-3); background: var(--bg-1);
  box-shadow: inset 0 0 0 1px var(--line-2), var(--edge);
}
.trace [data-ch="l4"] { --ch: var(--ch-l4, var(--accent)); }
.trace [data-ch="l3"] { --ch: var(--ch-l3, var(--accent)); }
.trace [data-ch="l2"] { --ch: var(--ch-l2, var(--accent)); }
.trace [data-ch="l1"] { --ch: var(--ch-l1, var(--accent)); }
.trace [data-ch="l0"] { --ch: var(--ch-l0, var(--accent)); }

.trace__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.trace__cap { margin: 0; font-size: 13.5px; color: var(--text-3); }
.trace__dl { min-height: 30px; font-family: var(--f-sans); font-size: 13px; letter-spacing: 0; }
/* the soft keys: Save image beside Download .vcd */
.trace__keys { display: flex; flex-wrap: wrap; gap: 8px; }

/* label column on the left, the plot beside it, the time axis underneath */
.trace__body { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 14px; }
.trace__labels { margin: 0; padding: 0; list-style: none; }
.trace__labels li {
  display: flex; align-items: center; gap: 6px; height: var(--trace-row);
  font-size: 13px; font-weight: 520; color: var(--text-3); white-space: nowrap; transition: color 0.2s;
}
.trace__labels b { font-family: var(--f-mono); font-size: 12px; font-weight: 500; color: var(--ch); }
.trace__labels li.is-hot { color: var(--text-1); }

.trace__plot {
  position: relative; height: calc(var(--trace-row) * 5);
  border-radius: var(--r-1); background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--line-1);
  cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.trace__plot:focus-visible { border-radius: var(--r-1); }
.trace__plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trace__grid { fill: none; stroke: var(--line-1); stroke-width: 1; shape-rendering: crispEdges; }
.trace__plot rect { fill: color-mix(in srgb, var(--ch) 14%, transparent); }
.trace__wave { fill: none; stroke: var(--ch); stroke-width: 1.5; stroke-linejoin: miter; }

.trace__axis { grid-column: 2; position: relative; height: 24px; font-family: var(--f-mono); font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-3); }
.trace__axis span { position: absolute; top: 5px; transform: translateX(-50%); white-space: nowrap; }
.trace__axis span:first-child { transform: none; }
.trace__axis span.is-end { transform: translateX(-100%); }

/* the cursor: a line through every channel and a reading beside it */
.trace__cursor { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: var(--text-2); pointer-events: none; }
.trace__tip {
  position: absolute; top: 4px; left: 8px; padding: 3px 7px;
  border-radius: var(--r-1); background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line-2);
  font-family: var(--f-mono); font-size: 11.5px; line-height: 1.4; font-variant-numeric: tabular-nums; color: var(--text-1); white-space: nowrap;
}
.trace__cursor.is-flip .trace__tip { left: auto; right: 8px; }

@media (max-width: 640px) {
  .trace { --trace-row: 22px; padding: 12px 12px 4px; }
  .trace__body { column-gap: 10px; }
  .trace__labels span { display: none; }
}
