/* Logic Pro (js/logic.js): the owner's modern Logic, dark, inside an XP
   window frame (W15). Colors are sampled from the owner's screenshots; the
   track and region colors come from data/logic.json. */

.lg {
  --lg-bg: #2d2a35;          /* the tracks area */
  --lg-lane-line: #25232c;
  --lg-panel: #474747;       /* toolbars, header column, inspector */
  --lg-header: #575757;      /* a track header */
  --lg-header-sel: #737373;
  --lg-ruler: #333333;
  --lg-control: #a6a6a6;     /* the control bar */
  --lg-lcd: #24262d;
  --lg-notepad: #1e1e1e;
  --lg-text: #e6e6e6;
  --lg-dim: #9a9a9a;
  --lg-blue: #2f7df6;
  --lg-header-w: 236px;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--lg-bg);
  color: var(--lg-text);
  font: 11px -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  outline: none;
  user-select: none;
}

.nx-window .nx-body:has(> .lg) {
  padding: 0;
  overflow: hidden;
  display: flex;
}

.lg button {
  font: inherit;
  color: inherit;
}

.lg-ico {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ---- control bar ---- */

.lg-control {
  flex: none;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 10px;
  background: var(--lg-control);
  border-bottom: 1px solid #1e1e1e;
  color: #3c3c3c;
}

.lg-group,
.lg-transport {
  display: flex;
  gap: 2px;
}

.lg-right {
  margin-left: auto;
}

.lg-control button {
  width: 30px;
  height: 26px;
  border: none;
  border-radius: 5px;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 0;
}

.lg-group button {
  background: rgba(255, 255, 255, 0.28);
}

.lg-control button:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.1);
}

.lg-control button.on {
  background: #6d6d6d;
  color: #f2f2f2;
}

.lg-transport {
  margin-left: auto;
}

.lg-transport button.lg-play.on {
  background: none;
  color: #2f8f2f;
}

.lg-transport .lg-rec {
  color: #b83e32;
}

.lg-lcd {
  display: flex;
  gap: 20px;
  height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--lg-lcd);
  color: #f2f2f2;
  font-weight: 300;
}

.lg-lcd > div {
  display: grid;
  align-items: end;
  justify-items: center;
  padding-bottom: 2px;
}

.lg-lcd-pos {
  grid-template-columns: auto auto;
  column-gap: 9px;
}

.lg-lcd span {
  font-size: 26px;
  line-height: 29px;
  font-variant-numeric: tabular-nums;
}

.lg-lcd-bar {
  min-width: 2.1em;
  text-align: right;
}

.lg-lcd small {
  font-size: 7px;
  letter-spacing: 0.06em;
  color: #9da0a8;
}

.lg-lcd-pos small:first-of-type {
  justify-self: end;
}

.lg-volume {
  width: 140px;
  margin-left: auto;
  accent-color: #f2f2f2;
}

/* ---- the three columns ---- */

.lg-main {
  flex: 1;
  min-height: 0;
  display: flex;
}

.lg-tracks {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---- inspector ---- */

.lg-inspector {
  flex: none;
  width: 196px;
  overflow: auto;
  background: var(--lg-panel);
  border-right: 1px solid #1e1e1e;
}

.lg-inspector[hidden] {
  display: none;
}

.lg-insp-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid #3a3a3a;
  white-space: nowrap;
  overflow: hidden;
}

.lg-insp-head i {
  display: grid;
  width: 12px;
}

.lg-insp-head i .lg-ico {
  width: 10px;
  height: 10px;
}

.lg-insp-head.open i {
  transform: rotate(90deg);
}

.lg-insp-head span {
  font-weight: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lg-insp-fields {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 4px 6px;
  margin: 6px 0 8px;
  padding: 0 8px;
}

.lg-insp-fields dt {
  text-align: right;
  color: var(--lg-dim);
}

.lg-insp-fields dt.lg-more {
  text-align: left;
  grid-column: 1 / -1;
  color: var(--lg-text);
}

.lg-insp-fields dd {
  margin: 0;
}

.lg-box {
  display: inline-block;
  width: 11px;
  height: 11px;
  vertical-align: -2px;
  border-radius: 2px;
  background: #6a6a6a;
}

.lg-box.on {
  background: var(--lg-blue);
}

/* channel strips, two abreast, as under the owner's inspector */
.lg-strips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 8px 6px;
}

.lg-strip {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  font-size: 10px;
  text-align: center;
}

.lg-strip b {
  height: 17px;
  line-height: 17px;
  border-radius: 3px;
  background: #5a5a5a;
  font-weight: normal;
  color: #d8d8d8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lg-strip b.lg-cs-lab {
  background: none;
  color: var(--lg-dim);
}

.lg-strip b.lg-cs-slot {
  background: #3f3f3f;
  color: var(--lg-dim);
}

.lg-strip b.lg-cs-read {
  background: #478846;
  color: #eaffea;
}

.lg-cs-pan {
  align-self: center;
  width: 26px;
  height: 26px;
  margin: 2px 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #8a8a8a, #4a4a4a);
  box-shadow: inset 0 0 0 1px #2a2a2a;
  position: relative;
}

.lg-cs-pan::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 3px;
  width: 2px;
  height: 8px;
  background: #e8e8e8;
}

.lg-cs-db {
  align-self: center;
  width: 40px;
  border-radius: 3px;
  background: #1e1e1e;
}

.lg-cs-fader {
  position: relative;
  align-self: center;
  width: 38px;
  height: 150px;
  border-radius: 3px;
  background: #2a2a2a;
}

.lg-cs-scale {
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 6px;
  border-radius: 2px;
  background: #151515;
}

.lg-cs-cap {
  position: absolute;
  left: 18px;
  top: 38px;
  width: 16px;
  height: 26px;
  border-radius: 3px;
  background: linear-gradient(#cfcfcf, #8f8f8f 45%, #6f6f6f 55%, #a8a8a8);
}

.lg-cs-ms {
  display: flex;
  justify-content: center;
  gap: 3px;
}

.lg-cs-ms b {
  width: 22px;
}

.lg-cs-ms b.solo {
  background: #e5c33a;
  color: #000;
}

.lg-cs-name {
  padding: 2px 0;
  border-top: 3px solid var(--lg-color);
  color: var(--lg-text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---- tracks toolbar ---- */

.lg-toolbar {
  flex: none;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 8px;
  background: var(--lg-panel);
  border-bottom: 1px solid #262626;
}

.lg-toolbar .xp-menubar {
  background: none;
  border: none;
  color: var(--lg-text);
  font: inherit;
}

.lg-toolbar .xp-menubar span::after {
  content: " ⌄";
  color: var(--lg-dim);
}

.lg-snap {
  color: var(--lg-dim);
}

.lg-snap:first-of-type {
  margin-left: auto;
}

.lg-snap b {
  font-weight: normal;
  color: var(--lg-text);
  margin-left: 4px;
  padding: 1px 34px 1px 6px;
  border-radius: 4px;
  background: #5c5c5c;
}

.lg-zoom {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--lg-dim);
}

.lg-zoom input {
  width: 90px;
  accent-color: #d0d0d0;
}

/* ---- arrange: one scroller; the ruler and the headers stick ---- */

/* .lg-arrange itself never scrolls -- it just clips and hosts the corner
   and header column, absolutely positioned so they sit outside the scroll
   box (see js/logic.js's syncHeaders) instead of scrolling with it. An
   absolutely positioned descendant still scrolls with its containing
   block if that ancestor is itself the overflow:auto element, so the
   actual horizontal+vertical scrolling happens one level down, in
   .lg-scroll; position:sticky on a grid/flex item (what .lg-corner and
   .lg-headers used to be) has the same problem in a different way -- it
   detaches once the item's own track is many times the viewport's width,
   which is exactly this case at any real zoom level. */
.lg-arrange {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--lg-bg);
}

.lg-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
}

.lg-grid {
  width: var(--lg-width, 1000px);
  min-height: 100%;
}

.lg-corner {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding-left: 8px;
  background: var(--lg-panel);
  border-bottom: 1px solid #1e1e1e;
  border-right: 1px solid #1e1e1e;
  box-sizing: border-box;
  width: var(--lg-header-w);
}

.lg-ruler {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 30px;
  box-sizing: border-box;
  background:
    linear-gradient(to right, #6a6a6a 1px, transparent 1px) var(--lg-bar-offset, 0) 100% / var(--lg-bar, 10px) 40% repeat-x,
    var(--lg-ruler);
  border-bottom: 1px solid #1e1e1e;
  cursor: pointer;
}

.lg-bar {
  position: absolute;
  top: 0;
  height: 100%;
  padding: 3px 0 0 4px;
  border-left: 1px solid #8a8a8a;
  color: #d0d0d0;
  font-size: 12px;
  pointer-events: none;
}

.lg-ruler-head {
  position: absolute;
  bottom: 0;
  width: 13px;
  height: 14px;
  margin-left: -6px;
  background: #d8d8d8;
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
  pointer-events: none;
}

.lg-headers {
  position: absolute;
  top: 30px;
  left: 0;
  z-index: 2;
  width: var(--lg-header-w);
  overflow: hidden;
  background: var(--lg-panel);
  border-right: 1px solid #1e1e1e;
}

.lg-header {
  height: var(--lg-row);
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 6px;
  background: var(--lg-header);
  border-bottom: 1px solid #3e3e3e;
  cursor: default;
}

.lg-header.selected {
  background: var(--lg-header-sel);
}

.lg-num {
  flex: none;
  width: 22px;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--lg-fill);
  color: #fff;
}

.lg-header.selected .lg-num {
  background: #d0e4fc;
  color: #1d1d1d;
}

.lg-disc {
  flex: none;
  width: calc(14px + var(--lg-depth, 0) * 8px);
  display: flex;
  justify-content: flex-end;
}

.lg-disc button {
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  background: none;
  color: #cfcfcf;
  display: grid;
  place-items: center;
}

.lg-disc .lg-ico {
  width: 9px;
  height: 9px;
}

.lg-disc button.open {
  transform: rotate(90deg);
}

.lg-icon {
  flex: none;
  width: 18px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: color-mix(in srgb, var(--lg-color) 30%, #3a3a3a);
  color: var(--lg-color);
}

.lg-icon .lg-ico {
  width: 13px;
  height: 13px;
}

.lg-folder .lg-icon,
.lg-stack .lg-icon {
  background: none;
}

.lg-hms {
  flex: none;
  display: flex;
  gap: 2px;
}

.lg-hms i {
  width: 14px;
  height: 13px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: #666;
  color: #fff;
  font: 9px/1 -apple-system, "Helvetica Neue", Arial, sans-serif;
}

.lg-hms i.solo {
  background: #e5c33a;
  color: #000;
}

.lg-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lg-pan {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a8a8a;
}

.lg-lanes {
  position: relative;
}

.lg-lane {
  position: relative;
  height: var(--lg-row);
  border-bottom: 1px solid var(--lg-lane-line);
  background: linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px) var(--lg-bar-offset, 0) 0 / var(--lg-bar, 10px) 100%;
}

.lg-lane.lg-stack {
  background-color: #2a2d35;
}

.lg-lane-label {
  position: absolute;
  left: 4px;
  top: 0;
  line-height: var(--lg-row);
  font-weight: 700;
  font-size: 11px;
}

.lg-region {
  position: absolute;
  top: 1px;
  bottom: 1px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--lg-fill);
  border: 1px solid #111;
  color: color-mix(in srgb, var(--lg-fill) 12%, #fff);
  font-size: 11px;
  line-height: calc(var(--lg-row) - 4px);
  padding: 0 5px;
  white-space: nowrap;
  cursor: default;
}

.lg-region.take span::before {
  content: "▶ ";
  font-size: 8px;
  vertical-align: 1px;
}

.lg-region.selected {
  background: color-mix(in srgb, var(--lg-fill) 22%, #fff);
  color: #1c1c28;
}

.lg-region.muted {
  background: #48474b;
  color: #b3b3b3;
}

.lg-region.muted span::before {
  content: "●";
  color: color-mix(in srgb, var(--lg-fill) 45%, #fff);
  margin-right: 4px;
}

.lg-region.selected.muted {
  background: #8d8c92;
  color: #1c1c28;
}

.lg-region[data-summary] {
  font-style: italic;
}

.lg-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #fff;
  z-index: 1;
  pointer-events: none;
}

/* ---- Note Pad ---- */

.lg-notepad {
  flex: none;
  width: 268px;
  display: flex;
  flex-direction: column;
  background: var(--lg-notepad);
  border-left: 1px solid #111;
}

.lg-notepad[hidden] {
  display: none;
}

.lg-np-tabs {
  display: flex;
  justify-content: center;
  padding: 7px 0 5px;
  background: #2b2b2b;
}

.lg-np-tabs button {
  width: 96px;
  padding: 3px 0;
  border: none;
  background: #3d3d3d;
  font-size: 12px;
}

.lg-np-tabs button:first-child {
  border-radius: 5px 0 0 5px;
}

.lg-np-tabs button:last-child {
  border-radius: 0 5px 5px 0;
}

.lg-np-tabs button.on {
  background: var(--lg-blue);
}

.lg-np-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 8px;
  background: #2b2b2b;
  border-bottom: 1px solid #111;
}

.lg-np-tools b {
  min-width: 26px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #3d3d3d;
  font-weight: normal;
}

.lg-np-edit {
  margin-left: auto;
  padding: 2px 14px;
  border: none;
  border-radius: 4px;
  background: #3d3d3d;
}

.lg-np-edit.on {
  background: var(--lg-blue);
}

.lg-np-body {
  flex: 1;
  overflow: auto;
  padding: 10px 16px 24px;
  font-size: 13px;
  line-height: 1.45;
  color: #f0f0f0;
  user-select: text;
  outline: none;
}

.lg-np-body p {
  margin: 0 0 14px;
}

.lg-np-body .lg-cite {
  color: var(--lg-dim);
  font-size: 12px;
}

.lg-np-body[contenteditable="true"] {
  background: #252525;
}
