/* The bench, which is the front page turned face-down.
 *
 * This file adds no layout and almost no new components. It loads *after*
 * site.css and does one thing: swap the palette end for end, so every rule
 * already written — nav, sections, cards, buttons, code blocks — comes out
 * negative without being restated. That is the whole reason site.css puts its
 * colors in custom properties and never hardcodes one below :root.
 *
 * The inversion is not a filter. `filter: invert(1)` was the first attempt and
 * it is wrong here for the same reason it is wrong everywhere: it takes the
 * accent with it, and this page's accent is the only thing on it that means
 * something. Orange stays orange. What flips is paper and ink.
 *
 * And the islands flip with everything else, which is the part worth looking
 * at. On the front page a terminal is a dark rectangle on paper — a thing that
 * emits light, sitting on a thing that doesn't. Here the page is the dark one,
 * so the log and the code blocks are the *paper* insets. Same rule, read from
 * the other side: whatever the page is, a readout is the opposite of it.
 */

:root {
  --bg:      #141413;
  --bg-2:    #1c1c1a;
  --panel:   #232320;
  --panel-2: #2c2c28;
  --line:    #2f2f2b;
  --line-2:  #46453f;
  --ink:     #f0eee6;
  --dim:     #a4a199;
  --faint:   #7c7a73;
  --accent:  #e0916d;
  --warn:    #e0a53c;
  --hot:     #f0655a;
}

/* The islands, inverted along with the page: paper insets on a dark sheet. */
.console, .readout, pre.term, pre.log, .chassis {
  --bg-2:    #f0eee6;
  --panel:   #e3ded0;
  --panel-2: #dad3c3;
  --line:    #d9d2c0;
  --line-2:  #c2b8a3;
  --ink:     #141413;
  --dim:     #6b6a63;
  --faint:   #83827d;
  --accent:  #b8512f;
}

/* The two translucent bars name their own background in site.css, because a
 * backdrop-filter needs a real color to sit under the blur. They are the only
 * two places the swap has to be spelled out. */
.nav { background: rgba(20, 20, 19, 0.78); }
.statusbar { background: rgba(20, 20, 19, 0.88); }
a:hover { color: #fff; }

/* ── the bench's own furniture ───────────────────────────────────────────── */
/* `section` on the front page is a full-width band with a rule above it. Here
 * the panels are cards in a column, so they are divs and the band rule never
 * applies. */
.panel {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.1rem 1.2rem; margin: 0 0 1rem;
}
.panel > h2 {
  font: 500 11.5px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 0.9rem;
}
.panel > h2 b { color: var(--accent); font-weight: 500; }
/* The one panel that is the point of the page. */
.panel.focus { border-color: var(--accent); background: var(--panel); }

.cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cols > .panel { margin: 0; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.note { color: var(--dim); font-size: 13.5px; margin: 0.35rem 0; max-width: 68ch; }
.note code { font: 0.9em/1 var(--mono); color: var(--ink); }
.val { color: var(--accent); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.status { color: var(--faint); font-size: 12.5px; }
.status b { color: var(--accent); font-weight: 400; }

/* Every control on this page is the front page's .btn — there are forty of
 * them and none of them wanted a class attribute to say so. */
button {
  font: 13px/1 var(--sans); cursor: pointer;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 6px;
  padding: 8px 12px; margin: 0 0.3rem 0.3rem 0;
  transition: background 120ms, border-color 120ms, color 120ms;
}
button, label, .pad, .glyphs {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
button:hover { background: var(--panel-2); border-color: var(--faint); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: default; transform: none; }
button.on { background: var(--accent); border-color: var(--accent); color: var(--bg); }

select, input[type=number], input[type=text] {
  font: 13px/1 var(--mono); letter-spacing: 0;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 8px;
}
input[type=range] { width: 100%; accent-color: var(--accent); }
label { display: block; margin: 0.7rem 0 0.2rem; color: var(--faint); font: 500 11.5px/1 var(--mono); letter-spacing: 0.06em; }

/* The 4×4 target pad. It is the device's grid, at the device's proportions —
 * the same square that the front page draws sixteen encoders into. */
.pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin: 0.7rem 0; }
.pad button {
  margin: 0; aspect-ratio: 1; padding: 0;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  font: 13px/1.2 var(--mono); letter-spacing: 0;
}
.pad button small { color: var(--faint); font-size: 10px; }
.pad button.on small { color: inherit; opacity: 0.7; }

/* The word preview: the same 4×4 as the target pad, but read-only and lit
 * rather than clickable. It exists so the usage panel is worth something with
 * no device attached — which is most of the time anyone looks at a word. The
 * cells carry no transition: the fade is the animation, thirty frames a second
 * of it, and a CSS ease on top would smear one letter into the next. */
.glyphs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem;
  margin: 0.9rem 0; padding: 0.5rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
}
.glyphs div {
  aspect-ratio: 1; border-radius: 50%;
  border: 1px solid var(--line-2); background: transparent;
}

pre.log {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 0.7rem 0.85rem; height: 200px; overflow: auto; margin: 0.7rem 0 0;
  font: 12px/1.7 var(--mono); letter-spacing: 0;
  white-space: pre-wrap; color: var(--dim);
}

table { border-collapse: collapse; width: 100%; font: 12px/1.9 var(--mono); letter-spacing: 0; }
th, td { text-align: right; padding: 0.1rem 0.45rem; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--faint); font-weight: 400; }
td { color: var(--dim); }
tbody td:first-child { color: var(--ink); }

.banner {
  border-left: 2px solid var(--warn); background: var(--bg-2);
  padding: 0.8rem 1rem; margin: 0 0 1rem; color: var(--ink); font-size: 13.5px;
  border-radius: 0 var(--r) var(--r) 0;
}
.banner code { font: 0.9em/1 var(--mono); color: var(--warn); }
.banner.bad { border-color: var(--hot); }

kbd {
  font: 11px/1 var(--mono);
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 4px; padding: 3px 5px; color: var(--dim);
}
