/* The home page viewer: a canvas driven by the wasm engine (docs/DESIGN.md §2). */

.viewer-title {
  margin-block: 0 var(--space-6);
}

.viewer {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.viewer-canvas {
  width: 100%;
  max-width: 26rem;
  aspect-ratio: 1;
  margin-inline: auto;
  display: block;
  background: var(--ink);
  border: var(--border-width-1) solid var(--line-rule);
  border-radius: var(--radius-default);
  /* The engine renders one pixel per cell; smoothing would invent colours it never chose. */
  image-rendering: pixelated;
}

/* The line stays reserved while the message comes and goes, so the engine finishing its
   build cannot shift the controls under the canvas. */
.viewer-status {
  margin: 0;
  min-height: calc(var(--font-size-sm) * var(--line-height-normal));
  color: var(--ink-muted);
}

.viewer-status--error {
  color: var(--negative);
}

.viewer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.viewer-control {
  flex: 1 1 8rem;
  margin: 0;
}

.viewer-speed {
  width: 100%;
  accent-color: var(--ink);
}

.viewer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.viewer-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-3);
  background: var(--paper-soft);
  border: var(--border-width-1) solid var(--line-strong);
  border-radius: var(--radius-default);
}

.viewer-metric dt {
  margin-bottom: var(--space-1);
}

.viewer-metric dd {
  margin: 0;
}

.viewer-params {
  margin: var(--space-2) 0 0;
  color: var(--ink-muted);
  line-height: var(--line-height-relaxed);
  overflow-wrap: anywhere;
}

.viewer-copy {
  margin-top: var(--space-6);
  max-width: 60ch;
  line-height: var(--line-height-relaxed);
  color: var(--ink-secondary);
}
