/*
 * A booth at 3 a.m. Near-black with a violet cast, readouts in IBM Plex Mono
 * like the displays on a mixer, her name in Fraunces italic. One UV accent for
 * what is live; cyan marks a track mixing in, magenta a track mixing out.
 */
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300 800;
  font-display: swap;
  src: url("fonts/fraunces-italic-300-800.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-normal-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-normal-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-normal-600.woff2") format("woff2");
}

:root {
  --bg: #07060a;
  --panel: #0f0d14;
  --well: #0a0910;
  --line: #262131;
  --text: #ece8f2;
  --dim: #8b8598;
  --uv: #a97dff;
  --uv-glow: rgba(169, 125, 255, 0.45);
  --in: #43dcf5;
  --out: #ff3d81;
  --serif: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 400 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, rgba(120, 70, 220, 0.16), transparent 60%), var(--bg);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--uv); outline-offset: 3px; }
a { color: var(--text); text-decoration-color: var(--uv); text-underline-offset: 3px; }
[hidden] { display: none !important; }
.mono { font: 500 12px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.dim { color: var(--dim); }
.small { font-size: 14px; }
.text { appearance: none; background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--text); border-bottom: 1px solid var(--uv); }
.text:hover { color: var(--uv); }

.booth { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }

/* ---- masthead ---------------------------------------------------------- */
.top { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 8px 32px; padding-bottom: 28px; }
.top h1 { grid-row: span 2; margin: 0; display: flex; align-items: baseline; gap: 14px; line-height: 0.9; }
.top h1 .dj {
  font: 600 14px/1 var(--mono);
  letter-spacing: 0.2em;
  padding: 6px 8px 5px;
  border: 1px solid var(--uv);
  color: var(--uv);
  transform: translateY(-0.6em);
}
.top h1 em { font: italic 300 clamp(56px, 11vw, 120px) / 0.9 var(--serif); letter-spacing: -0.03em; }
.tagline { margin: 0; color: var(--dim); max-width: 26em; }
.session { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--dim); }
.session input {
  width: 16em;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--text);
  font: 500 13px/1.2 var(--mono);
  letter-spacing: 0.04em;
}

/* ---- layout ------------------------------------------------------------ */
main { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
.deck, .desk, .tracklist { border: 1px solid var(--line); background: var(--panel); }
.tracklist { grid-column: 1 / -1; }

/* ---- the booth cam ----------------------------------------------------- */
.cam { grid-column: 1 / -1; margin: 0; border: 1px solid var(--line); background: var(--panel); }
.screen { position: relative; overflow: hidden; width: 100%; aspect-ratio: 752 / 416; background: #1a1708; }
.screen > img, .screen > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.screen > video { opacity: 0; }
.screen > img { z-index: 0; }
.screen.still-only > video { visibility: hidden; }
.screen.off { display: none; }
.cam-bar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; padding: 10px 14px; }
.cam-bar a { color: var(--dim); }
.cam-bar button { flex: none; }

/* ---- the deck ---------------------------------------------------------- */
.deck { padding: 18px 22px 22px; }
.deck-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; color: var(--dim); }
.onair { display: inline-flex; align-items: center; gap: 8px; }
.onair i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.playing .onair { color: var(--text); }
.playing .onair i { background: var(--out); box-shadow: 0 0 10px var(--out); }
.mix { margin-left: auto; padding: 3px 8px; border: 1px solid var(--line); }
.mix[data-stage="in"] { color: var(--in); border-color: var(--in); }
.mix[data-stage="body"] { color: var(--uv); border-color: var(--uv); }
.mix[data-stage="out"] { color: var(--out); border-color: var(--out); }

#title { margin: 18px 0 2px; font: italic 400 clamp(36px, 6vw, 60px) / 1 var(--serif); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.section { margin: 0 0 18px; min-height: 1.4em; }

.readout { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--well); }
.readout > div { padding: 10px 14px 12px; border-left: 1px solid var(--line); min-width: 0; }
.readout > div:first-child { border-left: 0; }
.readout small { display: block; color: var(--dim); margin-bottom: 4px; }
.readout b { display: block; font: 600 22px/1.15 var(--mono); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout #key { font-size: 16px; line-height: 1.6; }
.readout .of { color: var(--dim); font-weight: 400; font-size: 14px; }

.meter-row { display: flex; align-items: center; gap: 20px; margin: 16px 0 10px; }
.pips, .beats { display: flex; gap: 4px; }
.pips { flex: 1; }
.pips i { flex: 1; height: 10px; background: var(--line); }
.pips i.done { background: rgba(169, 125, 255, 0.4); }
.pips i.here { background: var(--uv); box-shadow: 0 0 10px var(--uv-glow); }
.beats i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); }
.beats i.on { background: var(--text); border-color: var(--text); }

.strip { display: flex; gap: 2px; height: 22px; }
.strip i { flex: 1; background: var(--well); border-top: 2px solid var(--line); opacity: 0.55; }
.strip i.in { border-top-color: var(--in); }
.strip i.body { border-top-color: var(--uv); }
.strip i.out { border-top-color: var(--out); }
.strip i.done { opacity: 0.9; }
.strip i.here { opacity: 1; background: rgba(169, 125, 255, 0.28); }

.roles { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 4px; color: var(--dim); }
.light { display: inline-flex; align-items: center; gap: 6px; }
.light i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.light.on { color: var(--text); }
.light.on i { background: var(--uv); box-shadow: 0 0 8px var(--uv); }

/* Two decks: the one with the low end lit, the other coming in or going out. */
.transition { margin: 16px 0 0; padding: 6px 10px; border: 1px solid var(--uv); color: var(--uv); }
.decks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.deck-card { border: 1px solid var(--line); background: var(--well); padding: 10px 12px; min-width: 0; opacity: 0.45; }
.deck-card.live { opacity: 1; }
.deck-card.dominant { border-color: var(--uv); }
.dc-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dc-tag { margin-left: auto; color: var(--dim); }
.deck-card[data-role="in"] .dc-tag { color: var(--in); }
.deck-card[data-role="out"] .dc-tag { color: var(--out); }
.deck-card.dominant .dc-tag { color: var(--uv); }
.dc-meta { margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-card .roles { gap: 4px 12px; margin: 10px 0 0; font-size: 12px; }
@media (max-width: 640px) {
  .decks { grid-template-columns: minmax(0, 1fr); }
}

.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 20px; }
.play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--uv);
  background: var(--well);
  color: var(--uv);
  font-size: 22px;
  display: grid;
  place-items: center;
}
.play:hover { background: rgba(169, 125, 255, 0.12); }
.playing .play { background: var(--uv); color: var(--bg); box-shadow: 0 0 24px var(--uv-glow); }
.skip { padding: 12px 16px; border: 1px solid var(--line); background: var(--well); }
.skip:hover { border-color: var(--text); }
.skip.armed { border-color: var(--in); color: var(--in); }
.skip-note { flex: 1 1 14em; }

/* ---- the mixer side ---------------------------------------------------- */
.desk { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.desk h2, .tracklist h2 { margin: 0; color: var(--dim); }
.engines { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.engine { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); background: var(--well); font: 500 13px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.engine .led { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.engine[aria-checked="true"] { border-color: var(--uv); }
.engine[aria-checked="true"] .led { background: var(--uv); box-shadow: 0 0 8px var(--uv); }
.engine.pending .led { background: var(--in); }
.engine .fill { position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--progress, 0) * 100%); background: var(--in); transition: width 0.3s; }
#engine-desc { margin: 0; min-height: 3em; }
.fader { display: grid; gap: 8px; color: var(--dim); margin-top: auto; }
.fader input { width: 100%; accent-color: var(--uv); }

/* ---- tracklist --------------------------------------------------------- */
.tracklist { padding: 18px 22px; }
.tl-head, .tracks li { display: grid; grid-template-columns: 4.5em 2.5em minmax(0, 1.4fr) minmax(0, 1fr) 3.5em; gap: 12px; }
.tl-head { padding: 12px 0 6px; border-bottom: 1px solid var(--line); }
.tracks { list-style: none; margin: 0; padding: 0; }
.tracks li { padding: 8px 0; border-bottom: 1px solid var(--line); font: 400 14px/1.4 var(--mono); color: var(--dim); }
.tracks li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tracks li .s { font: italic 400 17px/1.25 var(--serif); color: var(--text); }
.tracks li.now { color: var(--text); }
.tracks li.now .n { color: var(--uv); }
.tracks li .b { text-align: right; }
.tl-head span:last-child { text-align: right; }
#tracks-empty { margin: 12px 0 0; }

/* ---- footer ------------------------------------------------------------ */
.foot { margin-top: 28px; max-width: 46em; color: var(--dim); }
.foot p { margin: 0 0 10px; }
.foot .build code { font-family: var(--mono); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  background: var(--uv);
  color: var(--bg);
  font: 500 13px/1.4 var(--mono);
}

@media (prefers-reduced-motion: reduce) {
  .engine .fill { transition: none; }
}

@media (max-width: 820px) {
  .booth { padding: 20px 16px 48px; }
  .top { grid-template-columns: minmax(0, 1fr); }
  .top h1 { grid-row: auto; }
  main { grid-template-columns: minmax(0, 1fr); }
  .cam { margin: 0 -16px; border-left: 0; border-right: 0; }
  .deck { padding: 16px; }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout > div:nth-child(3) { border-left: 0; }
  .readout > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .tracklist { padding: 16px; }
  .tl-head, .tracks li { grid-template-columns: 4em 2em minmax(0, 1fr) 3em; gap: 8px; }
  .tl-head span:nth-child(4), .tracks li .k { display: none; }
}
