/* The Rack's note editors: the step sequencer's channel list and grid,
   and the piano roll. Split out of css/rack.css along its own section
   banners; the rail and chain files sit around it. */
/* ---------- Step sequencer: channel list ---------- */

.rack-channels {
  width: 200px;
  padding: var(--rack-ruler) 6px 2px;
  overflow-y: auto;
}

.rack-ch-list {
  display: grid;
  grid-auto-rows: var(--rack-row);
}

.rack-ch {
  display: flex;
  align-items: center;
  gap: 6px;
  height: calc(var(--rack-row) - 4px);
  margin: auto 0;
  width: 100%;
  padding: 0 9px 0 4px;
  background: var(--sh-inset);
  border: none;
  border-radius: 999px;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.rack-ch:hover {
  background: #242424;
}

.rack-ch-caret {
  font-size: 12px;
  color: #b2b2b2;
  flex-shrink: 0;
}

.rack-ch-name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-condensed);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
}

/* The two knobs a channel carries, drawn as one recessed pair. */
.rack-knobpair {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.rack-knob,
.rack-knob-mini {
  position: relative;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #6e6e6e, #4c4c4c 72%);
  flex-shrink: 0;
}

.rack-knob::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  width: 1.5px;
  height: 5px;
  border-radius: 1px;
  background: #f1f1f1;
  transform: translateX(-50%);
}

.rack-knob-mini::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 1.5px;
  border-radius: 1px;
  background: #f1f1f1;
  transform: translate(-50%, -50%);
}

.rack-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #02c564;
  box-shadow: 0 0 6px rgba(2, 197, 100, 0.6);
  flex-shrink: 0;
}

/* ---------- Step sequencer: grid ---------- */

.rack-steps {
  overflow-x: auto;
  overflow-y: hidden;
}

/* The ruler and each row are their own horizontal grid of steps; the rows stack
   in the block direction, so only these inner grids lay out by column. */
.rack-steps-ruler,
.rack-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 22px;
  width: max-content;
}

.rack-steps-ruler {
  height: var(--rack-ruler);
  align-items: center;
}

.rack-tick {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  height: 6px;
}

.rack-tick.is-beat {
  border-left-color: rgba(255, 255, 255, 0.14);
  height: 100%;
}

.rack-tick i {
  position: absolute;
  top: 2px;
  left: 4px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: #8a8a8a;
}

.rack-steps-rows {
  display: grid;
  grid-auto-rows: calc(var(--rack-row) - 4px);
  gap: 4px 0;
  width: max-content;
}

.rack-row {
  align-items: center;
}

/* A step button: a rounded block with a dark slot across its top, the shape the
   hardware sequencers this borrows from print on every pad. */
.rack-step {
  position: relative;
  justify-self: center;
  width: 15px;
  height: calc(var(--rack-row) - 9px);
  border-radius: 5px;
  background: #373737;
}

.rack-step.is-shade {
  background: #252525;
}

.rack-step::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  height: 2.5px;
  border-radius: 1px;
  background: #141414;
}

.rack-step.is-on {
  background: #00a59f;
  box-shadow: 0 0 8px rgba(0, 165, 159, 0.35);
}

.rack-step.is-on::after {
  background: rgba(0, 40, 44, 0.75);
}

/* ---------- Piano roll ---------- */

.pr-canvas {
  position: relative;
  display: grid;
  grid-template-columns: var(--pr-head) var(--pr-grid);
  grid-template-rows:
    var(--pr-ruler)
    repeat(var(--pr-rows), var(--pr-row))
    minmax(0, 1fr)
    var(--pr-auto);
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  background: #161616;
}

.pr-corner {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 6;
  background: #161616;
}

.pr-ruler {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 5;
  background: #161616;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pr-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding-left: 4px;
}

.pr-tick.is-bar {
  border-left-color: rgba(255, 255, 255, 0.2);
}

.pr-tick i {
  position: absolute;
  top: 4px;
  left: 5px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: #8a8a8a;
}

.pr-tick.is-bar i {
  font-weight: 700;
  font-size: 11px;
  color: #f0f0f0;
}

/* The keyboard. It rides the vertical scroll with the rows but holds the left
   edge, which is what keeps the pitch under the pointer where it looks. */
.pr-keys {
  grid-column: 1;
  grid-row: 2 / span var(--pr-rows);
  position: sticky;
  left: 0;
  z-index: 4;
  display: grid;
  grid-auto-rows: var(--pr-row);
  background: #f0f0f0;
}

.pr-key {
  position: relative;
}

/* A black key is a shorter, darker block notched into the white run. */
.pr-key.is-black::after {
  content: '';
  position: absolute;
  inset: 0 0 0 42%;
  background: #1a1a1a;
  border-radius: 0 2px 2px 0;
}

.pr-grid {
  grid-column: 2;
  grid-row: 2 / span var(--pr-rows);
  position: relative;
  display: grid;
  grid-auto-rows: var(--pr-row);
  background-image:
    repeating-linear-gradient(to right, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 152px),
    repeating-linear-gradient(to right, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 38px);
}

/* White-key rows carry the tint; black-key rows step back into the surface. */
.pr-lane {
  background: rgba(var(--c-rgb), 0.15);
}

.pr-lane.is-black {
  background: rgba(0, 0, 0, 0.25);
}

.pr-note {
  position: absolute;
  display: flex;
  align-items: center;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--c-note);
  border: 1px solid rgba(var(--c-rgb), 0.85);
  overflow: hidden;
}

.pr-note i {
  font-family: var(--font-text);
  font-size: 8px;
  font-style: normal;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
}

/* The automation lane closes the roll off and stays put while the pitches
   scroll behind it. */
.pr-auto {
  grid-column: 1 / -1;
  grid-row: -2 / -1;
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: #1c1c1c;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 -8px 14px rgba(0, 0, 0, 0.45);
}

.pr-auto-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 55%;
  height: 1px;
  background: var(--c);
}

.pr-point {
  position: absolute;
  top: 55%;
  width: 5px;
  height: 5px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55);
}

