/* Channel rack and instrument inspector (rack.js). */

/* ---------------------------------------------------------------- channel rack */

.rack {
  display: flex;
  height: 100%;
  min-height: 0;
  /* Its side panel narrows as the rack does: a bar of steps stays in sight. */
  container-type: inline-size;
}
@container (max-width: 1100px) {
  .inspector {
    width: 270px;
  }
}
@container (max-width: 900px) {
  .inspector {
    width: 230px;
    padding: 10px 10px 16px;
  }
}
.rack-list {
  flex: 1;
  overflow: auto;
  padding: 10px 12px 18px;
  min-width: 0;
}
.rack-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  margin-bottom: 4px;
  /* As wide as its steps, so its sticky lead (below) has the row's whole length to stay in. */
  width: max-content;
  min-width: 100%;
}
/* Fixed widths up to the steps (a long pattern must not squeeze the meter:
 * the ruler above the steps lines up with them). */
.rack-lead > .led-meter {
  flex: none;
}
/* A row's controls and name (and the ruler's lead over them) stay at the left while the steps
 * scroll sideways under them: in a narrow rack the names do not go out of sight. */
.rack-lead,
.rr-lead {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--ob-2);
}
.rack-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  align-self: stretch;
  padding-right: 8px;
}
.rack-row.sel .ch-name {
  border-color: var(--line-3);
  color: var(--gold-hi);
  box-shadow:
    0 0 14px rgba(212, 175, 55, 0.18),
    var(--inset);
}
.ch-mute {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle at 40% 35%, #b5f5d3, #3caf82 55%, #1b5b44);
  box-shadow: 0 0 8px rgba(80, 210, 150, 0.6);
  cursor: pointer;
  flex: none;
}
.ch-mute.off {
  background: radial-gradient(circle at 40% 35%, #4a4450, #221e27);
  box-shadow: none;
}
.ch-ins {
  width: 26px;
  height: 22px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font: 500 10px/1 var(--mono);
  color: var(--muted);
  background: var(--ob-0);
  border: 1px solid var(--line);
  cursor: ns-resize;
  flex: none;
}
.ch-name {
  width: 138px;
  height: 28px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--lacquer-hi);
  box-shadow: var(--inset);
  cursor: pointer;
  overflow: hidden;
}
.ch-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.ch-name .swatch {
  width: 4px;
  height: 16px;
  border-radius: 2px;
}
.steps {
  display: flex;
  gap: 3px;
}
.step-group {
  display: flex;
  gap: 3px;
  margin-right: 5px;
}
.step {
  width: 22px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.6);
  background: linear-gradient(180deg, #2a2530, #1a171e);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 210, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  position: relative;
}
.step-group.alt .step {
  background: linear-gradient(180deg, #3a1e27, #24131a);
}
.step:hover {
  border-color: rgba(212, 175, 55, 0.5);
}
.step.on,
.step-group.alt .step.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 88%, white 12%), color-mix(in srgb, var(--c) 70%, black 30%));
  box-shadow:
    0 0 12px color-mix(in srgb, var(--c) 60%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  border-color: rgba(255, 240, 200, 0.35);
}
.step.on::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: calc(var(--vel) * 60%);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.18);
}
.step.play {
  outline: 1px solid var(--gold-hi);
  outline-offset: 1px;
}
.mini-roll {
  height: 28px;
  border-radius: 6px;
  background: #0c0a0f;
  border: 1px solid var(--line);
  flex: none;
}
.rack-add {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.inspector {
  width: 330px;
  flex: none;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #17141b, #0f0d12);
  overflow: auto;
  padding: 12px 14px 18px;
}
.insp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.insp-title {
  font: 600 22px/1 var(--serif);
  font-style: italic;
  color: var(--gold-hi);
}
.insp-sub {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 4px;
}
.insp-doc {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.35;
  margin: 4px 0 12px;
}
.params {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 6px;
}
/* A kit sound's level and pan: room for their labels (under them) before what follows. */
.kit-mix {
  gap: 14px 18px;
  padding-bottom: 16px;
}
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.option {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.option label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.param-group {
  margin-top: 14px;
  padding: 10px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}
.param-group-title {
  font: italic 600 14px/1 var(--serif);
  color: var(--gold);
  margin: 0 0 10px 4px;
  letter-spacing: 0.04em;
}
.arp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.arp-head .param-group-title {
  margin-bottom: 0;
}
.arp .options {
  margin: 10px 0 0;
}
.inspector .field .select {
  width: 100%;
}

/* What the rack is (rack.js): the pattern, and how its squares work. */
.rack-guide {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 8px;
  max-width: 920px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.rack-guide b {
  flex: none;
  font: italic 600 14px/1 var(--serif);
  color: var(--gold-hi);
}
/* The bar and beat count above the steps, lined up with them: the lead
 * spans the mute LED, two knobs, the insert, the name and the meter. */
.rack-ruler {
  height: 16px;
  margin-bottom: 2px;
}
.rr-lead {
  /* The row's lead: the mute LED, two knobs, the insert, the name, the meter, their gaps, and the
     room after them. */
  width: calc(13px + 22px + 22px + 26px + 138px + 36px + 5 * 8px + 8px);
  flex: none;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: right;
  padding-right: 52px;
}
.rr-beat {
  width: calc(4 * 22px + 3 * 3px);
  margin-right: 5px;
  padding-left: 3px;
  border-left: 1px solid var(--line);
  font: 500 10px/16px var(--mono);
  color: var(--dim);
}
.rr-beat.bar {
  color: var(--gold);
  font-weight: 700;
  border-left-color: var(--line-3);
}
/* An instrument dragged from the browser: onto a row replaces, onto the list adds. */
.rack-row.drop .ch-name {
  border-color: var(--gold-hi);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35);
}
.rack-row.drop::after {
  content: "⇄ replace instrument";
  font-size: 10px;
  color: var(--gold-hi);
  white-space: nowrap;
}
.rack-list.drop {
  outline: 1px dashed var(--line-3);
  outline-offset: -4px;
}
.insp-swap-row {
  display: flex;
  gap: 6px;
}
.insp-swap-row .select {
  flex: 1;
  min-width: 0;
}

/* A kit's sounds, under it: a row each, set in, lighter. */
.rack-row.kit-sound {
  height: 28px;
  margin-bottom: 2px;
}
/* The places an instrument's row has its strip and level: kept, empty, so the steps line up. */
.ch-ins.none,
.led-meter.none {
  visibility: hidden;
}
.rack-row.kit-sound .ch-name {
  height: 24px;
  margin-left: 18px;
  width: 120px;
  background: transparent;
  font-size: 12px;
}
.kit-key {
  margin-left: auto;
  font: 500 9px/1 var(--mono);
  color: var(--dim);
  white-space: nowrap;
}
.kit-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 6px 0;
}
.kit-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--lacquer-hi);
  color: var(--champagne);
  cursor: pointer;
  text-align: left;
}
.layer-item {
  margin: 6px 0;
}
