/* Session track strips. Both the fader pointer and meters use the calibrated
   vertical positions defined by the same dB scale in mixer.js. */
.session-body {
    container: session-mixer / size;
    --send-height: 0px;
    --fader-room: calc(100cqh - 30px - 23px - var(--send-height));
    --auto-fader: max(206px, calc(var(--fader-room) - var(--slotsh, 150px)));
    --clip-height: max(25px, calc(var(--fader-room) - var(--fader-height, var(--auto-fader))));
}

.session-body.has-returns { --send-height: 62px; }
.session-body .slots {
    flex: 0 0 var(--clip-height);
    min-height:0;
    background:repeating-linear-gradient(to bottom,var(--skin-surface,#303239) 0 23px,var(--skin-border,#24262b) 23px 25px);
}

#tracks { flex:1 0 auto; min-width:max-content; }
.session-body .trackspace {
    flex:1 1 8px; min-width:6px; position:relative;
    background-size:100% var(--clip-height);
}
.session-body .strip {
    container: channel / inline-size;
    flex:0 0 var(--strip-width); width:var(--strip-width); min-width:0; max-width:none; min-height:0;
}
.session-body .trackspace + .return-strip { border-left:3px solid var(--skin-border,#17191e); }
#main-strip { flex:0 0 var(--strip-width); }
#main-strip .strip { flex:1; width:0; min-width:0; }
.session-body .channel-status { position:relative; }
.mixer-resize { position:absolute; z-index:3; touch-action:none; user-select:none; }
.mixer-resize[data-resize=width] { inset:0 0 0 auto; width:6px; cursor:col-resize; }
#main-strip .mixer-resize[data-resize=width] { left:0; right:auto; }
.mixer-resize[data-resize=height] { top:-5px; left:0; right:0; height:7px; cursor:row-resize; }
.live-mix > .mixer-resize[data-resize=height] { top:-2px; height:7px; border-top:2px solid var(--skin-border,#1b1d21); }
.trackspace .mixer-resize[data-resize=height] { top:calc(27px + var(--clip-height)); }
.mixer-resize:is(:hover,:focus-visible) { background:#8bd7dc66; outline:0; }

.session-body .trackhead {
    position:relative;
    padding-left: 0;
    gap: 2px;
}

.session-body .trackhead > .strip-title {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    height: 100%;
    width: auto;
    margin: 0;
    padding: 0 2px 0 6px;
    gap: 4px;
    justify-content: flex-start;
    text-align: left;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    opacity: 1;
}

#tracks .strip:not(.return-strip) .strip-title strong {
    order:-1;
    font-weight:700;
}
.session-body .strip-title .number { flex:none; }
@container channel (min-width:42px) and (max-width:105px) {
    #tracks .strip:not(.return-strip) .strip-title .number { display:none; }
}

.session-body .trackhead .strip-title:hover {
    background: #ffffff1c;
}

.session-body .trackhead .strip-title:focus-visible {
    outline: 2px solid #212127;
    outline-offset: -3px;
}

.session-body .device-target .trackhead {
    box-shadow: inset 0 -3px #231e28;
}

.session-body .mix.live-mix {
    container: mixer-controls / size;
    position: relative;
    --rail-width: 15px;
    --pointer-width: 15px;
    --label-width: 23px;
    display: grid;
    grid-template-columns: minmax(29px, 1fr) minmax(0, 57px);
    justify-content: center;
    gap: 2px;
    padding: 9px 5px 10px;
    flex: 1 1 0;
    min-height: 0;
    border-bottom: 0;
    background: var(--skin-surface,#2e3037);
}

.session-body .strip:nth-child(even) .live-mix { background: var(--skin-alternate,#303239); }

.strip-controls {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.strip-readouts, .strip-tools {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.strip-readouts {
    gap: 5px;
    width: 100%;
}

.live-mix .strip-peak, .live-mix .strip-gain {
    width: min(100%, 47px);
    height: 17px;
    min-height: 17px;
    padding: 0 2px;
    line-height: 15px;
    font: 550 11px/15px var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.55px;
    text-align: center;
    border: 1px solid var(--skin-border,#111318);
    color: var(--skin-fg,#e5e5e8);
    background: var(--skin-field,#1b1d22);
}

.live-mix .strip-peak {
    border-radius: 9px;
    color: var(--skin-muted,#c4c7ce);
}

.live-mix .strip-peak:hover { background: var(--skin-hover,#363941); }
.live-mix .strip-peak.overload { background: #8d454a; color: #fff2ed; }
.live-mix .strip-gain { border-radius: 1px; cursor: text; }
.live-mix .strip-gain:focus { outline: 1px solid var(--track); }

.strip-tools { gap: 4px; }
.strip-pan { position: relative; }
.pan-knob { --dial-size: 30px; --knob-origin: 0deg; touch-action: none; cursor: ns-resize; }
.live-mix [data-act="pan-center"] {
    position: absolute; z-index: 1; top: -3px; left: 0; width: 100%; height: 10px;
    min-height: 0; padding: 0; border: 0; background: transparent;
}
.strip-pan:has([data-act="pan-center"]:hover) { --cap-color: var(--knob-highlight); }

.live-mix .strip-activator, .live-mix .strip-solo {
    padding: 0 3px;
    width: 28px;
    border: 1px solid var(--skin-border,#121318);
    border-radius: 1px;
    font: 600 11px/1 var(--mono);
    color: var(--skin-fg,#c0c2cb);
    background: var(--skin-field,#1c1e24);
}

.live-mix .strip-activator { height: 25px; min-height: 25px; }
.live-mix .strip-solo { height: 17px; min-height: 17px; }
.live-mix .strip-activator[aria-pressed="true"] { background: var(--track); color: #1c1c20; }
.live-mix .strip-solo[aria-pressed="true"] { background: #86b9e6; color: #132a39; }

.stereo-out {
    color: var(--skin-muted,#b5b8c2);
    font: 10px/1.25 var(--mono);
    text-align: center;
}

.level-control {
    container: fader / size;
    position: relative;
    min-height: 0;
    max-width: calc(var(--pointer-width) + var(--rail-width) + var(--label-width));
    width: 100%;
    justify-self: center;
    cursor: ns-resize;
    touch-action: none;
    user-select: none;
}

.level-control:focus-visible {
    outline: 1px solid var(--track);
    outline-offset: 2px;
}

.output-meter {
    position: absolute;
    inset: 0 auto 0 var(--pointer-width);
    width: var(--rail-width);
    display: flex;
    gap: 1px;
    border-radius: 2px;
    background: #35373c;
    overflow: hidden;
    pointer-events: none;
}

.output-lane {
    flex: 1;
    position: relative;
    background: #141619;
    --peak-cut: 100%;
    --rms-cut: 100%;
}

.output-lane > i {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
        #d67067 0%, #d67067 10%, #c9b553 10%, #c9b553 19%, #69b474 19%, #488e5e 100%);
    clip-path: inset(var(--peak-cut) 0 0);
}

.output-lane > .rms-fill {
    background: linear-gradient(to bottom,
        #ff9990 0%, #ff9990 10%, #eddf81 10%, #eddf81 19%, #a1e69d 19%, #68c580 100%);
    clip-path: inset(var(--rms-cut) 0 0);
}

.level-tick {
    position: absolute;
    top: var(--tick);
    left: 0;
    width: 100%;
    height: 0;
    color: var(--skin-muted,#b7bac4);
    pointer-events: none;
}

.level-tick i {
    position: absolute;
    left: calc(var(--pointer-width) - 6px);
    width: 4px;
    height: 1px;
    background: var(--skin-tick,#82858f);
}

.level-tick.unity i { width: calc(var(--rail-width) + 6px); background: #bfc3cb; z-index: 1; }

.level-tick b {
    position: absolute;
    left: calc(var(--pointer-width) + var(--rail-width) + 3px);
    top: 0;
    transform: translateY(-50%);
    font: 500 10px/1 var(--mono);
    letter-spacing: -.6px;
    white-space: nowrap;
}

.fader-marker {
    position: absolute;
    z-index: 2;
    top: var(--pos);
    left: calc(var(--pointer-width) - 13px);
    height: 14px;
    width: 12px;
    transform: translateY(-50%);
    background: var(--skin-pointer,#d7d8dd);
    clip-path: polygon(0 0,100% 50%,0 100%);
}

.level-control:hover .fader-marker, .level-control:focus-visible .fader-marker { background: var(--skin-pointer-hover,#fff); }

@container session-mixer (max-height: 335px) {
    .strip .live-mix { padding-block: 6px 9px; }
}

@media (max-width: 1100px) {
    .session-body .mix.live-mix {
        --pointer-width: 13px;
        --rail-width: 12px;
        --label-width: 22px;
        grid-template-columns: minmax(29px, 1fr) calc(var(--pointer-width) + var(--rail-width) + var(--label-width));
        gap: 1px;
        padding-inline: 3px;
    }
}

@media (max-width: 790px) {
    .upper .session { min-height: 432px; }
}

.return-strip .slots {
    background:repeating-linear-gradient(to bottom,transparent 0,transparent 24px,var(--skin-border,#24262b) 24px,var(--skin-border,#24262b) 25px);
}
.send-bank {
    display:flex; align-items:center; justify-content:center; gap:4px;
    height:var(--send-height); flex:0 0 var(--send-height); padding:1px 2px; background:var(--skin-surface,#2b2d33); border-bottom:1px solid var(--skin-border,#1b1d21);
}
.send-bank button {
    display:flex; align-items:center; justify-content:center; gap:3px;
    flex:1 1 0; height:28px; max-width:64px; min-width:0; padding:1px;
    cursor:ns-resize; touch-action:none; border:0; border-radius:2px; background:transparent;
}
.send-bank button:hover,.send-bank button:focus-visible {background:var(--skin-hover,#3b3e46)}
.track-sends { position:relative; }
.sends-label { position:absolute; top:6px; left:50%; font:600 11px/1.2 var(--sans, sans-serif); color:var(--skin-muted,#c9cbd1); }
.track-sends [data-send] { position:absolute; top:4px; left:calc(50% - 38px); width:32px; height:35px; }
.track-sends [data-send=B] { top:23px; left:50%; }
.track-sends .rotary-face { --dial-size:29px; --cap:0px; }
.track-sends button b { position:absolute; bottom:-1px; left:0; right:0; color:var(--skin-muted,#c6c9d0); font:600 10px/11px var(--mono); }
.track-sends button output {
    display:none; position:absolute; z-index:5; bottom:100%; left:50%; transform:translateX(-50%);
    width:max-content; border:1px solid #535760; border-radius:3px; padding:2px 4px;
    color:#f1f2f4; background:#17191e; font:10px/13px var(--mono); pointer-events:none;
}
.track-sends button:is(:hover,:focus-visible,.adjusting) { z-index:4; background:transparent; }
.track-sends button:is(:hover,:focus-visible,.adjusting) output { display:block; }
.strip:has(.track-sends button:is(:hover,:focus-visible,.adjusting)) { z-index:1; }
.return-routing {font:10px var(--mono);color:var(--skin-muted,#b5b8c1)}
.send-taps { flex-wrap:wrap; gap:2px; }
.send-taps button { flex:0 1 auto; height:18px; min-height:16px; padding:0 3px; background:var(--skin-field,#212329); border:1px solid var(--skin-border,#42454c); font:9px var(--mono); cursor:pointer; }
.send-taps button[aria-pressed=true] { color:var(--knob-highlight); }
.clip-progress { display:flex; align-items:center; justify-content:space-evenly; gap:2px; flex:1; min-width:0; color:var(--skin-muted,#ced0d5); }
.clip-progress b,.clip-progress em { font:inherit; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.clip-progress i { width:13px; height:13px; flex:none; border:1px solid #18191d; border-radius:50%;
    background:conic-gradient(#15171c 0 var(--progress), var(--track) var(--progress) 100%); }
.clip-progress[data-kind=loop] i { position:relative; }
.clip-progress[data-kind=loop] i::after {
    content:''; position:absolute; top:0; left:50%; height:50%; width:1px; background:#121418;
}
.clip-progress[data-kind=once] i { flex:1; max-width:33px; height:5px; border-radius:0;
    background:linear-gradient(to right,var(--track) var(--progress),#15171c 0); }
.clip-progress[data-kind=once] em { display:none; }
.return-effect-display {
    display:flex; align-items:center; justify-content:space-between; gap:6px;
    margin:8px; min-height:36px; padding:6px; background:#202328; color:#acb3bb; font-size:11px;
}
.return-effect-display strong {font:11px var(--mono);color:#d4dedb}
@container fader (max-height: 250px) {
    .level-tick:nth-last-child(-n + 4):not(:last-child) b { display:none; }
}
@container fader (max-height: 155px) {
    .level-tick:nth-child(odd):not(:first-child) b { display:none; }
}
@container mixer-controls (max-height:130px) {
    .strip-tools { gap:2px; }
    .strip-pan { --dial-size:20px; }
    .pan-knob { --dial-size:20px; }
    .strip-readouts { gap:2px; }
    .live-mix .strip-activator { height:18px; min-height:18px; }
    .live-mix .strip-solo { height:14px; min-height:14px; }
}
@container mixer-controls (max-height:102px) {
    .strip-readouts { display:none; }
    .strip-controls { justify-content:flex-end; }
}
@container channel (max-width: 90px) {
    .session-body .mix.live-mix { --pointer-width:12px; --rail-width:11px; --label-width:0px;
        grid-template-columns:minmax(0,42px) 23px; gap:2px; padding-inline:3px; }
    .level-tick b { display:none; }
    .fader-marker { left:0; width:11px; }
    .channel-status { padding-inline:2px; gap:1px; }
    .track-sends [data-send] { left:calc(50% - 28px); }
    .track-sends [data-send=B] { left:50%; }
    .sends-label { font-size:9px; }
}
@container channel (max-width: 67px) {
    .session-body .mix.live-mix { grid-template-columns:minmax(17px,1fr) 19px; --pointer-width:10px; --rail-width:9px; }
    .strip-readouts { visibility:hidden; }
    .live-mix .strip-activator,.live-mix .strip-solo { width:18px; }
    .pan-knob { --dial-size:18px; }
    .sends-label { display:none; }
    .track-sends [data-send] { width:23px; height:27px; left:calc(50% - 20px); }
    .track-sends [data-send=B] { left:calc(50% - 3px); top:28px; }
    .track-sends .rotary-face { --dial-size:21px; }
    .trackhead [data-act=track-menu] { display:none; }
}
@container channel (max-width:53px) {
    .clip-progress b,.clip-progress em { display:none; }
}
@container channel (max-width: 41px) {
    .session-body .mix.live-mix { display:grid; grid-template: minmax(22px,1fr) auto / minmax(0,1fr);
        justify-items:center; gap:4px; padding:4px 1px; --pointer-width:6px; --rail-width:7px; }
    .strip-tools { grid-row:2; gap:2px; }
    .strip-controls { display:contents; }
    .strip-readouts,.strip-pan { display:none; }
    .level-control { grid-row:1; }
    .fader-marker { width:6px; height:8px; }
    .level-tick:not(.unity) { display:none; }
    .live-mix .strip-activator { min-height:15px; height:15px; }
    .live-mix .strip-solo { min-height:13px; height:13px; }
    .channel-status { justify-content:center; }
    .channel-status:has(.clip-progress:not([hidden])) { gap:0; padding:0; }
    .clip-progress[data-kind=once] i { max-width:13px; }
    .channel-status output,.slot .clipname,.scene-name,.scene-row em,.strip-title strong { display:none; }
    .slot { padding:0; }
    .slot.filled button { border:0; margin:0; }
    .slot button,.scene-row button { width:100%; min-width:0; }
    .track-sends [data-send],.track-sends [data-send=B] { left:50%; transform:translateX(-50%); }
    .send-taps button { font-size:8px; padding:0; }
    .return-routing { font-size:0; }
}

/* One action lane keeps the clip and track stops aligned at every strip width. */
.session-body .channel-status:has(button) { padding-inline:0 2px; gap:2px; justify-content:flex-start; }
.session-body :is(.slot,.scene-row) > button,
.session-body .channel-status button[data-act] {
    display:grid; place-items:center; flex:0 0 auto; width:clamp(12px,52cqi,22px);
    min-width:0; height:100%; min-height:0; padding:0;
}
.session-body :is(.empty-slot,.channel-status) button[data-act] > svg {
    width:15px; height:15px; color:var(--skin-stop-ink,#1a1b20);
}
.session-body :is(.empty-slot,.channel-status) button[data-act]:hover > svg,
.session-body :is(.empty-slot,.channel-status) button[data-act]:focus-visible > svg { color:#e8c4da; }
.session-body .channel-status button:focus-visible { outline:1px solid var(--pink); outline-offset:-2px; }
