/* DJ-set: home tile, the desk (a column per track on upright screens, a row per track on short
   sideways ones: its sign, three pads and its volume slider), the tempo slider and the record bar.
   Shared look lives in css/style.css; the "sound is off" line is Drumstel's (.drums-muted). */

#tile-dj .tile-art { display: flex; align-items: center; justify-content: center; }
.dj-tile-svg { width: 100%; height: 100%; max-width: 104px; display: block; }

#dj-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 12px 12px;
}
.dj-deck {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: var(--bz-radius-l);
  background: #3b3478;
  box-shadow: 0 5px 0 #231f52, var(--bz-shadow-s);
}
.dj-track { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; }
.dj-head { flex: none; width: 40px; height: 40px; border-radius: 12px; background: #fff; padding: 3px; }
.dj-head svg { width: 100%; height: 100%; display: block; }
.btn.dj-pad {
  flex: none;
  width: var(--dj-size, min(100%, 84px));
  height: var(--dj-size, auto);
  aspect-ratio: 1;
  min-width: 48px;
  min-height: 48px;
  padding: 6px;
  border-radius: 16px;
  background: #fff; /* older WebViews without color-mix */
  background: color-mix(in srgb, var(--dj-pad) 45%, #ffffff);
  box-shadow: 0 4px 0 var(--dj-edge);
  position: relative;
}
.btn.dj-pad svg:not(.lock) { width: 100%; height: 100%; display: block; opacity: 0.75; }
.btn.dj-pad.on { background: var(--dj-pad); outline: 4px solid #fff; outline-offset: -4px; }
.btn.dj-pad.on svg:not(.lock) { opacity: 1; }
.btn.dj-pad.pulse { animation: dj-pulse 0.3s ease-out 1; }
.btn.dj-pad.locked svg:not(.lock) { opacity: 0.4; }
.btn.dj-pad .lock { position: absolute; right: 4px; bottom: 4px; width: 20px; height: 20px; padding: 3px; border-radius: 50%; background: #fff; fill: var(--bz-ink-quiet); }
.btn.dj-pad:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--dj-edge); }
@keyframes dj-pulse { 0% { transform: scale(1); } 30% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* the sliders (role slider, built in dj.js): a thumb of 44 px that lies along the longer side */
.dj-slider { --sl-pos: 0.5; position: relative; touch-action: none; cursor: pointer; border-radius: 22px; outline-offset: 2px; }
.dj-slider:focus-visible { outline: 3px solid var(--bz-focus); }
.sl-track { position: absolute; border-radius: 6px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.sl-fill { position: absolute; background: var(--dj-pad, var(--bz-group-acc)); }
.sl-thumb { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 4px solid var(--dj-edge, var(--bz-group-acc)); box-shadow: var(--bz-shadow-s); }
.dj-slider.held .sl-thumb { transform: scale(1.08); }
/* upright (a volume in its column) */
.dj-vol { flex: 1 1 auto; width: 48px; min-height: 96px; }
.dj-vol .sl-track { left: 19px; width: 10px; top: 22px; bottom: 22px; }
.dj-vol .sl-fill { left: 0; right: 0; bottom: 0; height: calc(var(--sl-pos) * 100%); }
.dj-vol .sl-thumb { left: 2px; bottom: calc(var(--sl-pos) * (100% - 44px)); }
/* across (the tempo, and the volumes on short sideways phones) */
.dj-tempo { flex: 1; height: 48px; min-width: 120px; }
.dj-tempo .sl-track, .dj-across .sl-track { top: 19px; height: 10px; left: 22px; right: 22px; background: var(--bz-brand-tint); }
.dj-tempo .sl-fill, .dj-across .sl-fill { top: 0; bottom: 0; left: 0; width: calc(var(--sl-pos) * 100%); background: var(--bz-group-acc); }
.dj-tempo .sl-thumb, .dj-across .sl-thumb { top: 2px; left: calc(var(--sl-pos) * (100% - 44px)); }

.dj-side { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dj-status { margin: 0; min-height: 2.5em; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: var(--bz-weight-head); color: var(--bz-ink); text-wrap: balance; }
.dj-beat { display: flex; gap: 8px; }
.dj-beat i { width: 12px; height: 12px; border-radius: 50%; background: var(--bz-brand-tint); border: 2px solid var(--bz-brand-edge); }
.dj-beat i.on { background: var(--bz-group-acc); border-color: var(--bz-group-ink); }
.dj-tempo-row { width: min(100%, 520px); display: flex; align-items: center; gap: 8px; }
.dj-tempo-box { flex: 1; display: flex; }
.dj-end { flex: none; width: 40px; height: 40px; }
.dj-end svg { width: 100%; height: 100%; display: block; }
.dj-buttons { display: flex; gap: 12px; justify-content: center; }
.btn.dj-btn { width: 64px; height: 64px; min-width: 0; padding: 6px; border-radius: 20px; background: var(--bz-surface); box-shadow: var(--bz-edge-s) var(--bz-brand-edge); }
.btn.dj-btn svg { width: 100%; height: 100%; display: block; }
#dj-off svg { color: var(--bz-ink-soft); padding: 8px; }
.btn.dj-btn.recording { background: #fde4e4; outline: 3px solid #d9363e; outline-offset: -3px; animation: dj-rec 1.6s ease-in-out infinite; }
.btn.dj-btn.empty svg { opacity: 0.45; }
#dj-set[aria-pressed='true'] { background: var(--bz-group-tint); outline: 3px solid var(--bz-group-acc); outline-offset: -3px; }
@keyframes dj-rec { 0%, 100% { box-shadow: var(--bz-edge-s) var(--bz-brand-edge); } 50% { box-shadow: var(--bz-edge-s) var(--bz-brand-edge), 0 0 0 6px rgba(217, 54, 62, 0.18); } }

/* short upright phones: the line of help gives its room to the pads (the buttons show the state) */
@media (orientation: portrait) and (max-height: 700px) {
  .dj-status { display: none; }
  .dj-head { display: none; } /* every pad carries its track's sign already */
  .dj-side { gap: 6px; }
  .btn.dj-btn { width: 56px; height: 56px; }
}
@media (max-width: 360px) {
  .dj-deck { gap: 6px; padding: 8px; }
  .dj-head { width: 34px; height: 34px; }
  .dj-vol { width: 46px; }
}
/* short sideways phones: a row per track (sign, pads, the volume across), the bar on the right */
@media (orientation: landscape) and (max-height: 520px) {
  #screen-dj { flex-direction: row; }
  .dj-hud .bar-title h2 { font-size: 1.2rem; }
  #dj-stage { flex: 1; min-width: 0; flex-direction: row; padding: 10px 10px 10px 0; }
  .dj-deck { grid-template-columns: none; grid-template-rows: repeat(4, minmax(0, 1fr)); padding: 6px 10px; gap: 4px; }
  .dj-track { flex-direction: row; gap: 8px; }
  .dj-head { width: 34px; height: 34px; }
  .btn.dj-pad { width: var(--dj-size, 56px); height: var(--dj-size, 56px); min-width: 48px; min-height: 48px; }
  .dj-vol { width: auto; height: 48px; min-height: 0; min-width: 100px; flex: 1 1 auto; }
  .dj-vol .sl-track { top: 19px; height: 10px; left: 22px; right: 22px; bottom: auto; width: auto; }
  .dj-vol .sl-fill { top: 0; bottom: 0; left: 0; right: auto; height: auto; width: calc(var(--sl-pos) * 100%); }
  .dj-vol .sl-thumb { top: 2px; bottom: auto; left: calc(var(--sl-pos) * (100% - 44px)); }
  .dj-side { width: 270px; justify-content: center; }
  .dj-end { width: 32px; height: 32px; }
  .dj-tempo { min-width: 150px; }
  .dj-status { font-size: var(--bz-text-s); }
  .btn.dj-btn { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn.dj-pad.pulse, .btn.dj-btn.recording { animation: none; }
}

/* ---------- the scratch record and the toetjes (Mark, 1 Dec 2026) ---------- */
#dj-view svg { width: 34px; height: 34px; }
.dj-extra {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: 10px;
  padding: 12px;
  border-radius: var(--bz-radius-l);
  background: #3b3478;
  box-shadow: 0 5px 0 #231f52, var(--bz-shadow-s);
}
.dj-extra[hidden], .dj-deck[hidden] { display: none; }
.dj-record {
  flex: 0 1 auto;
  width: min(72vw, 40vh, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
  background: #1b1840;
  box-shadow: 0 0 0 6px #4b4291, 0 8px 18px rgba(0, 0, 0, 0.35);
}
.dj-record.held { cursor: grabbing; box-shadow: 0 0 0 6px #ffd166, 0 8px 18px rgba(0, 0, 0, 0.35); }
.dj-record:focus-visible { outline: 3px solid #fff; outline-offset: 6px; }
.dj-record-disc { display: block; width: 100%; height: 100%; }
.dj-record-svg { width: 100%; height: 100%; display: block; }
.dj-fx, .dj-keys { display: grid; justify-content: center; gap: 8px; width: 100%; }
.dj-fx { grid-template-columns: repeat(5, minmax(0, 60px)); }
.dj-keys { grid-template-columns: repeat(5, minmax(0, 60px)); }
.btn.dj-fxpad { width: 100%; height: auto; aspect-ratio: 1; min-width: 48px; min-height: 48px; padding: 4px; border-radius: 18px; background: #f4f1ff; box-shadow: 0 4px 0 #c8c2f0; }
.btn.dj-fxpad svg { width: 100%; height: 100%; display: block; }
.btn.dj-key { width: 100%; height: 72px; min-width: 48px; padding: 0; border-radius: 12px; background: var(--dj-keyc); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); }
.btn.dj-fxpad.hit, .btn.dj-key.hit { animation: dj-pulse 0.3s ease-out 1; }
@media (orientation: portrait) and (max-height: 700px) {
  .dj-extra { gap: 6px; padding: 8px; }
  .dj-record { width: min(64vw, 30vh, 240px); }
  .dj-fx, .dj-keys { gap: 5px; }
  .btn.dj-key { height: 52px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* the record on the left, the pads and the keys stacked on the right */
  .dj-extra { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr 1fr; align-items: center; justify-items: center; gap: 6px 10px; padding: 8px; }
  .dj-record { grid-row: 1 / span 2; width: min(calc(100vh - 140px), 180px); }
  .dj-fx, .dj-keys { grid-column: 2; gap: 4px; }
  .dj-fx { grid-template-columns: repeat(5, minmax(0, 52px)); }
  .dj-keys { grid-template-columns: repeat(5, minmax(0, 52px)); }
  /* the record view takes the whole width: the tempo and the record buttons wait on the pads view */
  #screen-dj[data-view='record'] .dj-side { display: none; }
  .btn.dj-key { height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn.dj-fxpad.hit, .btn.dj-key.hit { animation: none; }
}
/* small sideways phones (568x320, 640x360): a narrower bar, the pads without their row sign (every
   pad carries it), shorter volume sliders */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 680px) {
  .dj-side { width: 190px; gap: 6px; }
  .dj-track { gap: 4px; }
  .dj-deck { padding: 6px 8px; }
  .dj-status { display: none; }
  .dj-head { display: none; }
  .dj-vol { min-width: 64px; }
  .dj-tempo { min-width: 96px; }
  .dj-end { width: 28px; height: 28px; }
  .btn.dj-btn { width: 52px; height: 52px; }
}

/* the crossfader (Mark: "ik mis een fader"): across the top of the record panel, a pads sign left and
   a record right; the pad whose sound the keys play is outlined */
.dj-fader-row { width: min(100%, 420px); display: flex; align-items: center; gap: 8px; }
.dj-fader-box { flex: 1; display: flex; }
.dj-fader { flex: 1; height: 48px; min-width: 120px; }
.dj-fader .sl-track { top: 17px; height: 14px; left: 22px; right: 22px; background: linear-gradient(90deg, #ffb38f, #7bdff2); }
.dj-fader .sl-fill { display: none; }
.dj-fader .sl-thumb { top: 2px; left: calc(var(--sl-pos) * (100% - 44px)); border-radius: 12px; width: 44px; }
.dj-fade-end { flex: none; width: 34px; height: 34px; }
.dj-fade-end svg { width: 100%; height: 100%; display: block; }
.btn.dj-fxpad.loaded { outline: 3px solid #fff; outline-offset: 2px; }
.btn.dj-key svg { width: 70%; height: 70%; display: block; margin: auto; opacity: 0.85; }
@media (orientation: landscape) and (max-height: 520px) {
  .dj-extra { grid-template-rows: auto 1fr 1fr; }
  .dj-fader-row { grid-column: 2; grid-row: 1; width: 100%; }
  .dj-fx { grid-row: 2; }
  .dj-keys { grid-row: 3; }
  .dj-record { grid-row: 1 / span 3; }
}
/* short upright phones: the record view takes the whole height (the tempo and the record buttons
   wait on the pads view, as on sideways phones) */
@media (orientation: portrait) and (max-height: 700px) {
  #screen-dj[data-view='record'] .dj-side { display: none; }
}
