/* The page. Two columns where there is room for two, and one where there is not. */

:root {
  color-scheme: light dark;
  /* Both surfaces are mixed from `currentColor`, so the whole page follows the
     browser's light and dark setting without a second palette to keep in step. */
  --edge: color-mix(in srgb, currentColor 18%, transparent);
  --sunk: color-mix(in srgb, currentColor 5%, transparent);
  --bad: #c0392b;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* The light-mode red is too dark to read on a dark ground. */
    --bad: #ff7b6b;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  padding: 1.5rem;
  font: 14px/1.5 system-ui, sans-serif;
  max-width: 72rem;
}

h1 {
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
}

p.sub {
  margin: 0 0 1.25rem;
  opacity: 0.7;
}

.grid {
  display: grid;
  gap: 1rem;
  /* One column below about 46rem, because two columns of 22rem plus the gap is
     what a readable line of assembly needs. */
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

textarea,
pre {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 0.6rem;
  background: var(--sunk);
  color: inherit;
}

textarea {
  resize: vertical;
}

pre {
  margin: 0;
  min-height: 8rem;
  /* A listing line is as wide as it is. It scrolls inside its own box rather than
     wrapping, because a wrapped listing loses the column the offsets line up in,
     and rather than widening the page, because then everything else scrolls too. */
  overflow-x: auto;
  white-space: pre;
}

/* The listing sits under the output, and the gap is the label's rather than the
   box's: `pre` is used in both columns and only this one needs the space. */
.stacked {
  margin-top: 1rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 1rem 0;
}

button {
  font: inherit;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--edge);
  background: var(--sunk);
  color: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: currentColor;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

input,
select {
  font: inherit;
  padding: 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--edge);
  background: var(--sunk);
  color: inherit;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* A label on a control in a row, rather than one over a panel. */
.field label {
  margin: 0;
  font-weight: 400;
  opacity: 0.75;
}

.field.spaced {
  margin-bottom: 1rem;
}

#status {
  /* Reserved whether or not there is a message, so that nothing below it moves
     when one appears. */
  min-height: 1.5rem;
  margin: 0.75rem 0;
  font-variant-numeric: tabular-nums;
}

#status.bad {
  color: var(--bad);
}
