/* instrument.css — the standard Forte instrument page: header, parameter
   sidebar, a grid of view cards, and the keyboard. A page sets its palette
   in its own style.css (at least --accent) after loading this file. */

:root {
  --bg: #0e0e10;
  --panel: #151518;
  --card: #1a1a1e;
  --line: #2a2a31;
  --grid: rgba(255, 255, 255, 0.06);
  --text: #ebebef;
  --muted: #9393a0;
  --accent: #f0b35a;
  --accent-2: #7cb8ff;
  --accent-ink: #160d02;
  --key-down: color-mix(in srgb, var(--accent) 45%, #fff);
  --warn: #ff6b6b;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

button, select {
  font: inherit;
  color: var(--text);
  background: #24242a;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
}
button:hover, select:hover { border-color: #44444e; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.primary.running { background: #24352a; color: #7ddc9a; }

header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand h1 { font-size: 17px; margin: 0; }
.brand .sub { color: var(--muted); }
.status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.hot { color: var(--warn); border-color: var(--warn); }

main { display: grid; grid-template-columns: 320px 1fr; min-height: 0; }
#controls {
  border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto;
  padding: 12px 14px 24px; max-height: calc(100vh - 215px);
}
.preset-row { display: flex; gap: 8px; margin-bottom: 10px; }
.preset-row select { flex: 1; min-width: 0; }
details.group { border-top: 1px solid var(--line); padding: 6px 0 8px; }
details.group summary { cursor: pointer; font-weight: 600; padding: 4px 0; list-style: none; display: flex; justify-content: space-between; }
details.group summary::after { content: "▾"; color: var(--muted); }
details.group:not([open]) summary::after { content: "▸"; }
.param { margin: 7px 0 9px; }
.param .row { display: flex; justify-content: space-between; gap: 8px; }
.param .val { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.param .hint { color: var(--muted); font-size: 11px; margin-top: 2px; }
input[type=range] { width: 100%; margin: 4px 0 0; accent-color: var(--accent); height: 16px; }

#views {
  padding: 14px; display: grid; grid-template-rows: minmax(260px, 1.1fr) minmax(260px, 1fr);
  gap: 12px; min-width: 0; max-height: calc(100vh - 215px); overflow: auto;
}
.row { display: grid; grid-template-columns: 1.45fr 1fr; gap: 12px; min-height: 0; }
.row.single { grid-template-columns: 1fr; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; display: flex; flex-direction: column; min-height: 0; min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.card-head h2 { font-size: 13px; margin: 0; font-weight: 600; }
.tools { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.muted { color: var(--muted); }
.muted b { color: var(--text); }
.caption { color: var(--muted); font-size: 11px; margin-top: 4px; }
canvas { width: 100%; flex: 1; min-height: 0; display: block; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 11px; padding-top: 4px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

dl.info, #info { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
dl.info dt, #info dt { color: var(--muted); }
dl.info dd, #info dd { margin: 0; }
#info-card { overflow: auto; }
table.modes, #modes { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.modes th, table.modes td, #modes th, #modes td { padding: 2px 6px; text-align: right; border-bottom: 1px solid var(--line); }
table.modes th, #modes th { color: var(--muted); font-weight: 500; }
table.modes td:last-child, table.modes th:last-child, #modes td:last-child, #modes th:last-child { text-align: left; }

footer { border-top: 1px solid var(--line); background: var(--panel); padding: 8px 14px 12px; }
.kb-help { display: flex; gap: 18px; color: var(--muted); flex-wrap: wrap; margin-bottom: 7px; }
.kb-help b { color: var(--text); font-weight: 600; }
.kb-help b.off { color: var(--muted); }
.kb-help b.on { color: #7ddc9a; }
.kb-help b.off, .kb-help b.on { font-weight: 600; }
kbd { font: 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; margin: 0 1px; color: var(--text); background: #222228; }
#keyboard { position: relative; height: 115px; user-select: none; touch-action: none; }
.wk, .bk { position: absolute; top: 0; border-radius: 0 0 4px 4px; display: flex; align-items: flex-end; justify-content: center; }
.wk { background: #eeeeec; border: 1px solid #94948f; height: 100%; color: #555; font-size: 10px; padding-bottom: 4px; }
.bk { background: #151517; border: 1px solid #000; height: 62%; z-index: 2; color: #aaa; font-size: 9px; padding-bottom: 3px; }
.wk.mapped::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); opacity: 0.7; }
.bk.mapped { background: #26262c; }
.wk.down { background: var(--key-down); }
.bk.down { background: var(--accent); color: #000; }
.wk.focus { box-shadow: inset 0 -4px 0 var(--accent-2); }
.bk.focus { box-shadow: inset 0 -4px 0 var(--accent-2); }
.wk .c-label { position: absolute; bottom: 18px; color: #8a8a85; font-size: 9px; }

#toast { position: fixed; bottom: 160px; left: 50%; transform: translateX(-50%); background: #2a1d1d; border: 1px solid var(--warn); color: var(--text); padding: 8px 14px; border-radius: 8px; z-index: 10; }

input[type=checkbox] { accent-color: var(--accent); }
.param.check { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.param.check .hint { flex-basis: 100%; }
.param select { width: 100%; margin-top: 3px; }
.param > label { display: block; }

/* PI Requests (shared/backing.js): the rhythm box's buttons, its tempo lamp and the chord it plays */
.backing-transport { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.backing-transport button { padding: 4px 9px; }
.backing-transport button.running { background: #24352a; color: #7ddc9a; border-color: transparent; }
.backing-transport button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.backing-led { width: 9px; height: 9px; border-radius: 50%; background: #3a1414; margin-left: 4px; flex: none; }
.backing-led.on { background: #ff6b6b; box-shadow: 0 0 6px #ff6b6b; }
.backing-led.down { background: #ffd0d0; box-shadow: 0 0 8px #ff6b6b; }
.backing-chord { color: var(--accent); font-variant-numeric: tabular-nums; min-width: 3em; }

@media (max-width: 1050px) {
  main { grid-template-columns: 1fr; min-height: auto; }
  #controls { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  #views { max-height: none; grid-template-rows: auto auto; }
  .row { grid-template-columns: 1fr; }
  canvas { min-height: 230px; }
}
@media (max-width: 600px) {
  header, footer { padding-left: 12px; padding-right: 12px; }
  #views { padding: 10px; }
  #keyboard { height: 96px; }
}
