/* Piano roll and playlist (pianoroll.js, playlist.js). */

/* ---------------------------------------------------------------- piano roll & playlist */

.editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.editor-main {
  flex: 1;
  display: grid;
  min-height: 0;
  position: relative;
}
.pr {
  grid-template-columns: 64px 1fr;
  grid-template-rows: 26px 1fr 74px;
}
.pl {
  grid-template-columns: 168px 1fr;
  grid-template-rows: 28px 1fr;
}

.ruler {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #19161d, #110f14);
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}
.ruler-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(212, 175, 55, 0.25);
  padding: 7px 0 0 5px;
  font: 600 12px/1 var(--serif);
  color: var(--muted);
}
.ruler-mark.beat {
  border-left-color: rgba(212, 175, 55, 0.08);
}
/* A repeat: double bars at both ends, like the signs in a score; how many
 * times it plays at its top right, its endings' brackets along the bottom. */
.ruler-repeat {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 3px double var(--gold);
  border-right: 3px double var(--gold);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0), rgba(212, 175, 55, 0.14));
  pointer-events: none;
}
.ruler-repeat-times {
  position: absolute;
  right: 4px;
  top: 6px;
  font: italic 700 12px/1 var(--serif);
  color: var(--gold-hi);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
/* An ending (volta): a bracket with its passes. */
.ruler-ending {
  position: absolute;
  bottom: 0;
  height: 8px;
  box-sizing: border-box;
  border-top: 1px solid var(--rose);
  border-left: 1px solid var(--rose);
  padding-right: 4px;
  text-align: right;
  font: 600 9px/8px var(--serif);
  color: var(--rose);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}
.corner {
  background: #141117;
  border-bottom: 1px solid var(--line-2);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--dim);
  text-transform: uppercase;
}

.scroller {
  position: relative;
  overflow: auto;
  min-height: 0;
  min-width: 0;
}
.scroller-y {
  overflow: hidden;
}
.canvas-grid {
  position: relative;
}
.grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(212, 175, 55, 0.22) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 240, 210, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 240, 210, 0.025) 1px, transparent 1px);
  background-size:
    var(--bar) 100%,
    var(--beat) 100%,
    var(--step) 100%;
}
.bar-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(212, 175, 55, 0.22);
  pointer-events: none;
}

.keys {
  position: relative;
  overflow: hidden;
  background: #0a090c;
  border-right: 1px solid var(--line-2);
}
.key {
  position: absolute;
  left: 0;
  right: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.key.white {
  background: linear-gradient(90deg, #d9cfbd, #f7f0e1 70%, #e6dccb);
}
.key.black {
  background: linear-gradient(90deg, #0e0c10, #2a2530 80%, #16131a);
  right: 26%;
  z-index: 2;
  border-radius: 0 3px 3px 0;
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}
.key.c span {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font: 700 9px/1 var(--sans);
  color: #6d5a33;
}
/* A drum kit's keys carry their drums' names. */
.key span.drum {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font: 600 8.5px/1 var(--sans);
  color: #5a4a2b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.key.black span.drum {
  color: #d9cfbd;
}
.key.down {
  background: var(--metal) !important;
}
.lane {
  position: absolute;
  left: 0;
  right: 0;
}
.lane.black {
  background: rgba(0, 0, 0, 0.24);
}
.lane.oct {
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
}

.note {
  position: absolute;
  border-radius: 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 85%, white 15%), color-mix(in srgb, var(--c) 72%, black 28%));
  border: 1px solid color-mix(in srgb, var(--c) 50%, black 50%);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  opacity: calc(0.55 + var(--vel) * 0.45);
  cursor: move;
  overflow: hidden;
  font: 600 9px/1 var(--sans);
  color: rgba(20, 14, 4, 0.8);
  padding: 2px 4px;
  white-space: nowrap;
}
.note.sel {
  outline: 2px solid var(--ivory);
  outline-offset: 0;
  box-shadow: 0 0 14px rgba(246, 238, 221, 0.55);
  z-index: 2;
}
.note.ghost {
  opacity: 0.18;
  pointer-events: none;
  box-shadow: none;
}
.note-edge {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  cursor: ew-resize;
}
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--gold-hi);
  box-shadow: 0 0 10px rgba(245, 226, 166, 0.9);
  pointer-events: none;
  z-index: 5;
}
.marquee {
  position: absolute;
  border: 1px dashed var(--gold-hi);
  background: rgba(212, 175, 55, 0.08);
  pointer-events: none;
  z-index: 6;
}
/* The shift tool: the time opened (gold) or closed (rose) by the drag. */
.shift-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(212, 175, 55, 0.12);
  pointer-events: none;
  z-index: 5;
}
.shift-band.close {
  background: rgba(208, 138, 147, 0.16);
}
.shift-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--gold-hi);
  pointer-events: none;
  z-index: 6;
}
/* An empty piano roll: drawing starts a pattern. */
.pr-draft {
  position: absolute;
  left: 64px;
  right: 0;
  top: 26px;
  bottom: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  text-align: center;
  color: var(--dim);
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  pointer-events: none;
  z-index: 4;
}

.vel-lane {
  position: relative;
  overflow: hidden;
  background: #0c0a0f;
  border-top: 1px solid var(--line-2);
}
.vel-bar {
  position: absolute;
  bottom: 0;
  width: 5px;
  margin-left: -1px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(0deg, var(--gold-lo), var(--gold-hi));
  cursor: ns-resize;
}
.vel-bar.sel {
  background: linear-gradient(0deg, #b9a58a, var(--ivory));
}
.vel-label {
  background: #110f14;
  border-top: 1px solid var(--line-2);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--dim);
  text-transform: uppercase;
}

.tracks-head {
  position: relative;
  overflow: hidden;
  background: #0f0d12;
  border-right: 1px solid var(--line-2);
}
.track-head {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  background: linear-gradient(180deg, #1d1a22, #151218);
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.04);
  cursor: pointer;
}
.track-head.sel {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.14), #151218);
}
.track-head .t-name {
  flex: 1;
  font: 600 14px/1 var(--serif);
  color: var(--champagne);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track-head .t-num {
  font: 500 9px/1 var(--mono);
  color: var(--dim);
  width: 14px;
}
.track-lane {
  position: absolute;
  left: 0;
  right: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}
.track-lane:nth-child(odd) {
  background: rgba(255, 240, 210, 0.012);
}
.clip {
  position: absolute;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 40%, #16131a), color-mix(in srgb, var(--c) 22%, #0d0b10));
  border: 1px solid color-mix(in srgb, var(--c) 70%, black 30%);
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: move;
}
.clip.sel {
  outline: 2px solid var(--ivory);
  box-shadow: 0 0 18px rgba(246, 238, 221, 0.4);
}
.clip-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 16px;
  padding: 2px 7px;
  font: 700 10px/12px var(--sans);
  color: #1d1406;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 85%, white 15%), color-mix(in srgb, var(--c) 70%, black 30%));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clip canvas {
  position: absolute;
  left: 0;
  right: 0;
  top: 16px;
  bottom: 0;
  width: 100%;
  height: calc(100% - 16px);
}
.clip-edge {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 2;
}
.clip.muted {
  filter: grayscale(0.8) brightness(0.6);
}
