/* stage bench — Paper & Signal. Consumes tokens via styles.css; this file owns
   only stage-specific structure. No boxes, hairlines only, one red in drops. */

:root {
  /* section-owned: bench geometry (per-surface decision, like plate heights) */
  --bench-h: min(74vh, 860px);
}

.back-link {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  color: var(--ink-soft); text-decoration: none;
  padding: 12px 0; /* target height */
}

.stage-head { padding-top: 42px; padding-bottom: 18px; }
.stage-head h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em;
  font-size: clamp(40px, 7vw, 84px); line-height: 1;
  margin: 10px 0 14px;
}
.stage-dek { max-width: 52ch; color: var(--ink-soft); font-size: 15px; }

.bench-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; padding-bottom: 10px;
}
.bench-controls { display: inline-flex; gap: 10px; }
.bench-controls button {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--ink); background: transparent;
  border: 1px solid var(--ink);
  min-height: 44px; padding: 0 14px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.bench-controls button:disabled {
  color: var(--faint); border-color: var(--line); cursor: default;
}
.bench-controls button:active:not(:disabled) { transform: scale(0.95); }

.bench-plate {
  position: relative;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  height: var(--bench-h);
}
#bench {
  width: 100%; height: 100%; display: block;
  touch-action: none; /* the bench is a 2-axis stage: it PANS, page scrolls outside it */
  outline-offset: -2px;
}

.ledger-row { padding: 10px 0 4px; }
.ledger {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--ink-soft);
}

/* tray — editorial index rows, not cards */
.tray { padding: 26px 0 60px; }
.tray-rows { margin-top: 10px; }
.tray-row {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr);
  gap: 14px; align-items: baseline;
  width: 100%; text-align: left;
  background: transparent; border: 0; border-top: 1px solid var(--line);
  padding: 14px 0; min-height: 52px;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-ui);
}
.tray-row:first-child { border-top-color: var(--ink); }
.tray-row:active { transform: scale(0.99); }
.tray-name { font-family: var(--font-display); font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.tray-name .placed-n { font-family: var(--font-mono); font-size: 10.5px; color: var(--red); margin-left: 10px; }
.tray-dims, .tray-src { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; color: var(--faint); }
.tray-row.is-loading .tray-name { color: var(--ink-soft); }
.tray-row[disabled] { cursor: default; }

/* paint rail — swatch chips, square, hairline-bordered controls */
.paint { padding: 0 0 60px; }
.paint-note { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--faint); margin: 6px 0 14px; }
.paint-rows { display: flex; flex-wrap: wrap; gap: 10px; }
.paint-chip {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--ink-soft); background: transparent;
  border: 1px solid var(--line);
  padding: 8px 14px 8px 8px; min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.paint-chip .swatch { width: 28px; height: 28px; border: 1px solid var(--line); flex: none; }
.paint-chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.paint-chip:active { transform: scale(0.97); }

.paint-deck { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 18px; }
.paint-q {
  width: 100%; max-width: 52ch;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em;
  color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--ink);
  padding: 10px 2px; min-height: 44px;
  outline-offset: 4px;
}
.paint-q::placeholder { color: var(--faint); }
.paint-brands { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.brand-chip {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--ink-soft); background: transparent;
  border: 1px solid var(--line);
  padding: 0 12px; min-height: 40px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.brand-chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
#paint-results { margin-bottom: 8px; }

/* context menu — a paper plate with a hard offset underplate (no soft shadows
   on the dark ground; a crisp offset is the print-compatible depth device) */
.ctx {
  position: fixed; z-index: 60;
  min-width: 220px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 0 var(--line);
  padding: 4px 0 6px;
}
.ctx-title {
  display: block;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.16em;
  color: var(--faint);
  padding: 8px 14px 6px;
  border-bottom: 1px solid var(--line);
}
.ctx-item {
  display: block; width: 100%; text-align: left;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink); background: transparent; border: 0;
  padding: 12px 14px; min-height: 42px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ctx-item:active { background: var(--paper-2); }
.ctx-danger { color: var(--red); }

@media (hover: hover) and (pointer: fine) {
  .ctx-item:hover { background: var(--paper-2); color: var(--red); }
  .back-link:hover { color: var(--red); }
  .bench-controls button:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
  .tray-row:hover .tray-name { color: var(--red); }
}

@media (max-width: 860px) {
  :root { --bench-h: 52vh; }
  .nav-tag { display: none; }
  .tray-row { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .bench-controls button:active:not(:disabled), .tray-row:active { transform: none; }
}
